xref: /dpdk/doc/guides/conf.py (revision 6597fa4a30add6e0790f0e25833c3e073d76a877)
13f6f8362SLouise Kilheeney#!/usr/bin/env python3
200d2970bSBruce Richardson# SPDX-License-Identifier: BSD-3-Clause
300d2970bSBruce Richardson# Copyright(c) 2010-2015 Intel Corporation
41ab07743SBernard Iremonger
5536884d6SJohn McNamarafrom docutils import nodes
62654ce5cSThomas Monjalonfrom packaging.version import Version
7536884d6SJohn McNamarafrom sphinx import __version__ as sphinx_version
89db3f521SJohn McNamarafrom os import listdir
9430b35deSLuca Boccassifrom os import environ
109db3f521SJohn McNamarafrom os.path import basename
119db3f521SJohn McNamarafrom os.path import dirname
129db3f521SJohn McNamarafrom os.path import join as path_join
137f932642SJuraj Linkešfrom sys import argv, stderr, path
149db3f521SJohn McNamara
159db3f521SJohn McNamaraimport configparser
169db3f521SJohn McNamara
1746562be6SJohn McNamaratry:
1846562be6SJohn McNamara    import sphinx_rtd_theme
1946562be6SJohn McNamara    html_theme = "sphinx_rtd_theme"
20c523e864SThomas Monjalonexcept ImportError:
2146562be6SJohn McNamara    print('Install the sphinx ReadTheDocs theme for improved html documentation '
22028c5740SThomas Monjalon          'layout: https://sphinx-rtd-theme.readthedocs.io/',
23028c5740SThomas Monjalon          file=stderr)
24c523e864SThomas Monjalon    html_theme = "default"
25f7aaae2fSBernard Iremonger
26028c5740SThomas Monjalonstop_on_error = ('-W' in argv)
27028c5740SThomas Monjalon
284557f45fSJohn McNamaraproject = 'Data Plane Development Kit'
294557f45fSJohn McNamarahtml_logo = '../logo/DPDK_logo_vertical_rev_small.png'
302654ce5cSThomas Monjalonif Version(sphinx_version) >= Version('3.5'):
3186ff0663SThomas Monjalon    html_permalinks = False
3286ff0663SThomas Monjalonelse:
33dff6be0aSJohn McNamara    html_add_permalinks = ""
3441492ef8SSiobhan Butlerhtml_show_copyright = False
352b68e480SJohn McNamarahighlight_language = 'none'
36f7aaae2fSBernard Iremonger
377bda955fSAnatoly Burakovrelease = environ.setdefault('DPDK_VERSION', "None")
387e23a23aSThomas Monjalonversion = release
39f7aaae2fSBernard Iremonger
403fbcfb76SThomas Monjalonmaster_doc = 'index'
41ebf8050aSJohn McNamara
4244a718c4SBilly McFall# Maximum feature description string length
43cf9b3c36SYuval Avneryfeature_str_len = 30
4444a718c4SBilly McFall
454a22e6eeSJohn McNamara# Figures, tables and code-blocks automatically numbered if they have caption
464a22e6eeSJohn McNamaranumfig = True
474a22e6eeSJohn McNamara
48576de42bSChristian Ehrhardt# Configuration for man pages
49576de42bSChristian Ehrhardtman_pages = [("testpmd_app_ug/run_app", "testpmd",
50576de42bSChristian Ehrhardt              "tests for dpdk pmds", "", 1),
51576de42bSChristian Ehrhardt             ("tools/pdump", "dpdk-pdump",
52576de42bSChristian Ehrhardt              "enable packet capture on dpdk ports", "", 1),
53576de42bSChristian Ehrhardt             ("tools/proc_info", "dpdk-procinfo",
548afe8267SChristian Ehrhardt              "access dpdk port stats and memory info", "", 1),
558afe8267SChristian Ehrhardt             ("tools/pmdinfo", "dpdk-pmdinfo",
569d3ad924SChristian Ehrhardt              "dump a PMDs hardware support info", "", 1),
579d3ad924SChristian Ehrhardt             ("tools/devbind", "dpdk-devbind",
589d3ad924SChristian Ehrhardt              "check device status and bind/unbind them from drivers", "", 8)]
59576de42bSChristian Ehrhardt
607f932642SJuraj Linkeš# DTS API docs additional configuration
617f932642SJuraj Linkešif environ.get('DTS_DOC_BUILD'):
62a0d77f20SPaul Szczepanek    extensions = ['sphinx.ext.napoleon', 'sphinx.ext.autodoc']
63*6597fa4aSLuca Vizzarro
64*6597fa4aSLuca Vizzarro    # Pydantic models require autodoc_pydantic for the right formatting
65*6597fa4aSLuca Vizzarro    try:
66*6597fa4aSLuca Vizzarro        import sphinxcontrib.autodoc_pydantic
67*6597fa4aSLuca Vizzarro        extensions.append("sphinxcontrib.autodoc_pydantic")
68*6597fa4aSLuca Vizzarro    except ImportError:
69*6597fa4aSLuca Vizzarro        print(
70*6597fa4aSLuca Vizzarro            "The DTS API doc dependencies are missing. "
71*6597fa4aSLuca Vizzarro            "The generated output won't be as intended, "
72*6597fa4aSLuca Vizzarro            "and autodoc may throw unexpected warnings.",
73*6597fa4aSLuca Vizzarro            file=stderr,
74*6597fa4aSLuca Vizzarro        )
75*6597fa4aSLuca Vizzarro
767f932642SJuraj Linkeš    # Napoleon enables the Google format of Python doscstrings.
777f932642SJuraj Linkeš    napoleon_numpy_docstring = False
787f932642SJuraj Linkeš    napoleon_attr_annotations = True
797f932642SJuraj Linkeš    napoleon_preprocess_types = True
807f932642SJuraj Linkeš
817f932642SJuraj Linkeš    # Autodoc pulls documentation from code.
827f932642SJuraj Linkeš    autodoc_default_options = {
837f932642SJuraj Linkeš        'members': True,
847f932642SJuraj Linkeš        'member-order': 'bysource',
857f932642SJuraj Linkeš        'show-inheritance': True,
867f932642SJuraj Linkeš    }
877f932642SJuraj Linkeš    autodoc_class_signature = 'separated'
887f932642SJuraj Linkeš    autodoc_typehints = 'both'
897f932642SJuraj Linkeš    autodoc_typehints_format = 'short'
907f932642SJuraj Linkeš    autodoc_typehints_description_target = 'documented'
917f932642SJuraj Linkeš
927f932642SJuraj Linkeš    # DTS docstring options.
937f932642SJuraj Linkeš    add_module_names = False
947f932642SJuraj Linkeš    toc_object_entries = True
957f932642SJuraj Linkeš    toc_object_entries_show_parents = 'hide'
967f932642SJuraj Linkeš    # DTS Sidebar config.
97c523e864SThomas Monjalon    if html_theme == "sphinx_rtd_theme":
987f932642SJuraj Linkeš        html_theme_options = {
997f932642SJuraj Linkeš            'collapse_navigation': False,
1007f932642SJuraj Linkeš            'navigation_depth': -1,  # unlimited depth
1017f932642SJuraj Linkeš        }
1027f932642SJuraj Linkeš
1037f932642SJuraj Linkeš    # Add path to DTS sources so that Sphinx can find them.
1047f932642SJuraj Linkeš    dpdk_root = dirname(dirname(dirname(__file__)))
1057f932642SJuraj Linkeš    path.append(path_join(dpdk_root, 'dts'))
1067f932642SJuraj Linkeš
1077f932642SJuraj Linkeš    # Get missing DTS dependencies. Add path to buildtools to find the get_missing_imports function.
1087f932642SJuraj Linkeš    path.append(path_join(dpdk_root, 'buildtools'))
1097f932642SJuraj Linkeš    import importlib
1107f932642SJuraj Linkeš    # Ignore missing imports from DTS dependencies, allowing us to build the docs without them.
1117f932642SJuraj Linkeš    # There's almost no difference between docs built with and without dependencies.
1127f932642SJuraj Linkeš    # The qualified names of imported objects are fully expanded with dependencies, such as:
1137f932642SJuraj Linkeš    # fabric.Connection (without) vs. fabric.connection.Connection (with)
1147f932642SJuraj Linkeš    autodoc_mock_imports = importlib.import_module('check-dts-requirements').get_missing_imports()
1157f932642SJuraj Linkeš
116be05eb44SJohn McNamara
117536884d6SJohn McNamara# ####### :numref: fallback ########
118536884d6SJohn McNamara# The following hook functions add some simple handling for the :numref:
119536884d6SJohn McNamara# directive for Sphinx versions prior to 1.3.1. The functions replace the
120536884d6SJohn McNamara# :numref: reference with a link to the target (for all Sphinx doc types).
121536884d6SJohn McNamara# It doesn't try to label figures/tables.
122536884d6SJohn McNamaradef numref_role(reftype, rawtext, text, lineno, inliner):
123536884d6SJohn McNamara    """
124536884d6SJohn McNamara    Add a Sphinx role to handle numref references. Note, we can't convert
125536884d6SJohn McNamara    the link here because the doctree isn't build and the target information
126536884d6SJohn McNamara    isn't available.
127536884d6SJohn McNamara    """
128536884d6SJohn McNamara    # Add an identifier to distinguish numref from other references.
129536884d6SJohn McNamara    newnode = nodes.reference('',
130536884d6SJohn McNamara                              '',
131536884d6SJohn McNamara                              refuri='_local_numref_#%s' % text,
132536884d6SJohn McNamara                              internal=True)
133536884d6SJohn McNamara    return [newnode], []
134536884d6SJohn McNamara
135be05eb44SJohn McNamara
136536884d6SJohn McNamaradef process_numref(app, doctree, from_docname):
137536884d6SJohn McNamara    """
138536884d6SJohn McNamara    Process the numref nodes once the doctree has been built and prior to
139536884d6SJohn McNamara    writing the files. The processing involves replacing the numref with a
140536884d6SJohn McNamara    link plus text to indicate if it is a Figure or Table link.
141536884d6SJohn McNamara    """
142536884d6SJohn McNamara
143536884d6SJohn McNamara    # Iterate over the reference nodes in the doctree.
144536884d6SJohn McNamara    for node in doctree.traverse(nodes.reference):
145536884d6SJohn McNamara        target = node.get('refuri', '')
146536884d6SJohn McNamara
147536884d6SJohn McNamara        # Look for numref nodes.
148536884d6SJohn McNamara        if target.startswith('_local_numref_#'):
149536884d6SJohn McNamara            target = target.replace('_local_numref_#', '')
150536884d6SJohn McNamara
151536884d6SJohn McNamara            # Get the target label and link information from the Sphinx env.
152536884d6SJohn McNamara            data = app.builder.env.domains['std'].data
153536884d6SJohn McNamara            docname, label, _ = data['labels'].get(target, ('', '', ''))
154536884d6SJohn McNamara            relative_url = app.builder.get_relative_uri(from_docname, docname)
155536884d6SJohn McNamara
156536884d6SJohn McNamara            # Add a text label to the link.
157536884d6SJohn McNamara            if target.startswith('figure'):
158536884d6SJohn McNamara                caption = 'Figure'
159536884d6SJohn McNamara            elif target.startswith('table'):
160536884d6SJohn McNamara                caption = 'Table'
161536884d6SJohn McNamara            else:
162536884d6SJohn McNamara                caption = 'Link'
163536884d6SJohn McNamara
164536884d6SJohn McNamara            # New reference node with the updated link information.
165536884d6SJohn McNamara            newnode = nodes.reference('',
166536884d6SJohn McNamara                                      caption,
167536884d6SJohn McNamara                                      refuri='%s#%s' % (relative_url, label),
168536884d6SJohn McNamara                                      internal=True)
169536884d6SJohn McNamara            node.replace_self(newnode)
170536884d6SJohn McNamara
1719db3f521SJohn McNamara
1728a441eb9SThomas Monjalondef generate_overview_table(output_filename, table_id, section, table_name, title):
1739db3f521SJohn McNamara    """
174807418f2SPablo de Lara    Function to generate the Overview Table from the ini files that define
175807418f2SPablo de Lara    the features for each driver.
1769db3f521SJohn McNamara
1779db3f521SJohn McNamara    The default features for the table and their order is defined by the
1789db3f521SJohn McNamara    'default.ini' file.
1799db3f521SJohn McNamara
1809db3f521SJohn McNamara    """
181807418f2SPablo de Lara    # Default warning string.
182807418f2SPablo de Lara    warning = 'Warning generate_overview_table()'
1839db3f521SJohn McNamara
1849db3f521SJohn McNamara    # Get the default features and order from the 'default.ini' file.
1859db3f521SJohn McNamara    ini_path = path_join(dirname(output_filename), 'features')
1869db3f521SJohn McNamara    config = configparser.ConfigParser()
1879db3f521SJohn McNamara    config.optionxform = str
1889db3f521SJohn McNamara    config.read(path_join(ini_path, 'default.ini'))
189807418f2SPablo de Lara    default_features = config.items(section)
1909db3f521SJohn McNamara
1919db3f521SJohn McNamara    # Create a dict of the valid features to validate the other ini files.
1929db3f521SJohn McNamara    valid_features = {}
1939db3f521SJohn McNamara    max_feature_length = 0
1949db3f521SJohn McNamara    for feature in default_features:
1959db3f521SJohn McNamara        key = feature[0]
1969db3f521SJohn McNamara        valid_features[key] = ' '
1979db3f521SJohn McNamara        max_feature_length = max(max_feature_length, len(key))
1989db3f521SJohn McNamara
199807418f2SPablo de Lara    # Get a list of driver ini files, excluding 'default.ini'.
2009db3f521SJohn McNamara    ini_files = [basename(file) for file in listdir(ini_path)
2019db3f521SJohn McNamara                 if file.endswith('.ini') and file != 'default.ini']
2029db3f521SJohn McNamara    ini_files.sort()
2039db3f521SJohn McNamara
2049db3f521SJohn McNamara    # Build up a list of the table header names from the ini filenames.
20548595b8dSThomas Monjalon    pmd_names = []
2069db3f521SJohn McNamara    for ini_filename in ini_files:
2079db3f521SJohn McNamara        name = ini_filename[:-4]
2089db3f521SJohn McNamara        name = name.replace('_vf', 'vf')
20948595b8dSThomas Monjalon        pmd_names.append(name)
2108b8036a6SElena Agostini    if not pmd_names:
2118b8036a6SElena Agostini        # Add an empty column if table is empty (required by RST syntax)
2128b8036a6SElena Agostini        pmd_names.append(' ')
2139db3f521SJohn McNamara
21448595b8dSThomas Monjalon    # Pad the table header names.
21548595b8dSThomas Monjalon    max_header_len = len(max(pmd_names, key=len))
21648595b8dSThomas Monjalon    header_names = []
21748595b8dSThomas Monjalon    for name in pmd_names:
2189db3f521SJohn McNamara        if '_vec' in name:
2199db3f521SJohn McNamara            pmd, vec = name.split('_')
22048595b8dSThomas Monjalon            name = '{0:{fill}{align}{width}}vec'.format(pmd,
22148595b8dSThomas Monjalon                    fill='.', align='<', width=max_header_len-3)
2229db3f521SJohn McNamara        else:
22348595b8dSThomas Monjalon            name = '{0:{fill}{align}{width}}'.format(name,
22448595b8dSThomas Monjalon                    fill=' ', align='<', width=max_header_len)
2259db3f521SJohn McNamara        header_names.append(name)
2269db3f521SJohn McNamara
227807418f2SPablo de Lara    # Create a dict of the defined features for each driver from the ini files.
2289db3f521SJohn McNamara    ini_data = {}
2299db3f521SJohn McNamara    for ini_filename in ini_files:
2309db3f521SJohn McNamara        config = configparser.ConfigParser()
2319db3f521SJohn McNamara        config.optionxform = str
2329db3f521SJohn McNamara        config.read(path_join(ini_path, ini_filename))
2339db3f521SJohn McNamara
2349db3f521SJohn McNamara        # Initialize the dict with the default.ini value.
2359db3f521SJohn McNamara        ini_data[ini_filename] = valid_features.copy()
2369db3f521SJohn McNamara
2370a91cdd4SThomas Monjalon        # Check for a section.
238807418f2SPablo de Lara        if not config.has_section(section):
2399db3f521SJohn McNamara            continue
2409db3f521SJohn McNamara
2419db3f521SJohn McNamara        # Check for valid features names.
242807418f2SPablo de Lara        for name, value in config.items(section):
2439db3f521SJohn McNamara            if name not in valid_features:
2449db3f521SJohn McNamara                print("{}: Unknown feature '{}' in '{}'".format(warning,
2459db3f521SJohn McNamara                                                                name,
246028c5740SThomas Monjalon                                                                ini_filename),
247028c5740SThomas Monjalon                                                                file=stderr)
248028c5740SThomas Monjalon                if stop_on_error:
249028c5740SThomas Monjalon                    raise Exception('Warning is treated as a failure')
2509db3f521SJohn McNamara                continue
2519db3f521SJohn McNamara
252878f99d1SThomas Monjalon            if value:
2539db3f521SJohn McNamara                # Get the first letter only.
2549db3f521SJohn McNamara                ini_data[ini_filename][name] = value[0]
2559db3f521SJohn McNamara
256807418f2SPablo de Lara    # Print out the RST Driver Overview table from the ini file data.
2579db3f521SJohn McNamara    outfile = open(output_filename, 'w')
2589db3f521SJohn McNamara    num_cols = len(header_names)
2599db3f521SJohn McNamara
2608a441eb9SThomas Monjalon    print_table_css(outfile, table_id)
261c1af2905SDavid Marchand    print('.. _' + table_name + ':', file=outfile)
2628a441eb9SThomas Monjalon    print('.. table:: ' + table_name + '\n', file=outfile)
263807418f2SPablo de Lara    print_table_header(outfile, num_cols, header_names, title)
2649db3f521SJohn McNamara    print_table_body(outfile, num_cols, ini_files, ini_data, default_features)
2659db3f521SJohn McNamara
2669db3f521SJohn McNamara
267807418f2SPablo de Laradef print_table_header(outfile, num_cols, header_names, title):
2689db3f521SJohn McNamara    """ Print the RST table header. The header names are vertical. """
2699db3f521SJohn McNamara    print_table_divider(outfile, num_cols)
2709db3f521SJohn McNamara
2719db3f521SJohn McNamara    line = ''
2729db3f521SJohn McNamara    for name in header_names:
2739db3f521SJohn McNamara        line += ' ' + name[0]
2749db3f521SJohn McNamara
275807418f2SPablo de Lara    print_table_row(outfile, title, line)
2769db3f521SJohn McNamara
27748595b8dSThomas Monjalon    for i in range(1, len(header_names[0])):
2789db3f521SJohn McNamara        line = ''
2799db3f521SJohn McNamara        for name in header_names:
2809db3f521SJohn McNamara            line += ' ' + name[i]
2819db3f521SJohn McNamara
2829db3f521SJohn McNamara        print_table_row(outfile, '', line)
2839db3f521SJohn McNamara
2849db3f521SJohn McNamara    print_table_divider(outfile, num_cols)
2859db3f521SJohn McNamara
2869db3f521SJohn McNamara
2879db3f521SJohn McNamaradef print_table_body(outfile, num_cols, ini_files, ini_data, default_features):
2889db3f521SJohn McNamara    """ Print out the body of the table. Each row is a NIC feature. """
2899db3f521SJohn McNamara
2909db3f521SJohn McNamara    for feature, _ in default_features:
2919db3f521SJohn McNamara        line = ''
2929db3f521SJohn McNamara
2939db3f521SJohn McNamara        for ini_filename in ini_files:
2949db3f521SJohn McNamara            line += ' ' + ini_data[ini_filename][feature]
2959db3f521SJohn McNamara
2969db3f521SJohn McNamara        print_table_row(outfile, feature, line)
2979db3f521SJohn McNamara
2989db3f521SJohn McNamara    print_table_divider(outfile, num_cols)
2999db3f521SJohn McNamara
3009db3f521SJohn McNamara
3019db3f521SJohn McNamaradef print_table_row(outfile, feature, line):
3029db3f521SJohn McNamara    """ Print a single row of the table with fixed formatting. """
3039db3f521SJohn McNamara    line = line.rstrip()
30444a718c4SBilly McFall    print('   {:<{}}{}'.format(feature, feature_str_len, line), file=outfile)
3059db3f521SJohn McNamara
3069db3f521SJohn McNamara
3079db3f521SJohn McNamaradef print_table_divider(outfile, num_cols):
3089db3f521SJohn McNamara    """ Print the table divider line. """
3099db3f521SJohn McNamara    line = ' '
3109db3f521SJohn McNamara    column_dividers = ['='] * num_cols
3119db3f521SJohn McNamara    line += ' '.join(column_dividers)
3129db3f521SJohn McNamara
31344a718c4SBilly McFall    feature = '=' * feature_str_len
3149db3f521SJohn McNamara
3159db3f521SJohn McNamara    print_table_row(outfile, feature, line)
3169db3f521SJohn McNamara
3179db3f521SJohn McNamara
3188a441eb9SThomas Monjalondef print_table_css(outfile, table_id):
3198a441eb9SThomas Monjalon    template = """
3208a441eb9SThomas Monjalon.. raw:: html
3218a441eb9SThomas Monjalon
3228a441eb9SThomas Monjalon   <style>
3238a441eb9SThomas Monjalon      .wy-nav-content {
3248a441eb9SThomas Monjalon         opacity: .99;
3258a441eb9SThomas Monjalon      }
3268a441eb9SThomas Monjalon      table#idx {
3278a441eb9SThomas Monjalon         cursor: default;
3288a441eb9SThomas Monjalon         overflow: hidden;
3298a441eb9SThomas Monjalon      }
330cc64c593SThomas Monjalon      table#idx p {
331cc64c593SThomas Monjalon         margin: 0;
332cc64c593SThomas Monjalon         line-height: inherit;
333cc64c593SThomas Monjalon      }
3348a441eb9SThomas Monjalon      table#idx th, table#idx td {
3358a441eb9SThomas Monjalon         text-align: center;
336cc64c593SThomas Monjalon         border: solid 1px #ddd;
3378a441eb9SThomas Monjalon      }
3388a441eb9SThomas Monjalon      table#idx th {
339cc64c593SThomas Monjalon         padding: 0.5em 0;
340cc64c593SThomas Monjalon      }
341cc64c593SThomas Monjalon      table#idx th, table#idx th p {
342cc64c593SThomas Monjalon         font-size: 11px;
3438a441eb9SThomas Monjalon         white-space: pre-wrap;
3448a441eb9SThomas Monjalon         vertical-align: top;
3459a5a5405SThomas Monjalon         min-width: 0.9em;
3469a5a5405SThomas Monjalon      }
3479a5a5405SThomas Monjalon      table#idx col:first-child {
3489a5a5405SThomas Monjalon         width: 0;
3498a441eb9SThomas Monjalon      }
3508a441eb9SThomas Monjalon      table#idx th:first-child {
3518a441eb9SThomas Monjalon         vertical-align: bottom;
3528a441eb9SThomas Monjalon      }
3538a441eb9SThomas Monjalon      table#idx td {
3548a441eb9SThomas Monjalon         padding: 1px;
3558a441eb9SThomas Monjalon      }
356cc64c593SThomas Monjalon      table#idx td, table#idx td p {
357cc64c593SThomas Monjalon         font-size: 11px;
358cc64c593SThomas Monjalon      }
3598a441eb9SThomas Monjalon      table#idx td:first-child {
3608a441eb9SThomas Monjalon         padding-left: 1em;
3618a441eb9SThomas Monjalon         text-align: left;
3628a441eb9SThomas Monjalon      }
3638a441eb9SThomas Monjalon      table#idx tr:nth-child(2n-1) td {
3648a441eb9SThomas Monjalon         background-color: rgba(210, 210, 210, 0.2);
3658a441eb9SThomas Monjalon      }
3668a441eb9SThomas Monjalon      table#idx th:not(:first-child):hover,
3678a441eb9SThomas Monjalon      table#idx td:not(:first-child):hover {
3688a441eb9SThomas Monjalon         position: relative;
3698a441eb9SThomas Monjalon      }
3708a441eb9SThomas Monjalon      table#idx th:not(:first-child):hover::after,
3718a441eb9SThomas Monjalon      table#idx td:not(:first-child):hover::after {
3728a441eb9SThomas Monjalon         content: '';
3738a441eb9SThomas Monjalon         height: 6000px;
3748a441eb9SThomas Monjalon         top: -3000px;
3758a441eb9SThomas Monjalon         width: 100%;
3768a441eb9SThomas Monjalon         left: 0;
3778a441eb9SThomas Monjalon         position: absolute;
3788a441eb9SThomas Monjalon         z-index: -1;
3798a441eb9SThomas Monjalon         background-color: #ffb;
3808a441eb9SThomas Monjalon      }
3818a441eb9SThomas Monjalon      table#idx tr:hover td {
3828a441eb9SThomas Monjalon         background-color: #ffb;
3838a441eb9SThomas Monjalon      }
3848a441eb9SThomas Monjalon   </style>
3858a441eb9SThomas Monjalon"""
3868a441eb9SThomas Monjalon    print(template.replace("idx", "id%d" % (table_id)), file=outfile)
3878a441eb9SThomas Monjalon
3888a441eb9SThomas Monjalon
389536884d6SJohn McNamaradef setup(app):
390ed239ecdSJohn McNamara    table_file = dirname(__file__) + '/nics/overview_table.txt'
3918a441eb9SThomas Monjalon    generate_overview_table(table_file, 1,
392807418f2SPablo de Lara                            'Features',
393807418f2SPablo de Lara                            'Features availability in networking drivers',
394807418f2SPablo de Lara                            'Feature')
3950a91cdd4SThomas Monjalon    table_file = dirname(__file__) + '/nics/rte_flow_items_table.txt'
3960a91cdd4SThomas Monjalon    generate_overview_table(table_file, 2,
3970a91cdd4SThomas Monjalon                            'rte_flow items',
3980a91cdd4SThomas Monjalon                            'rte_flow items availability in networking drivers',
3990a91cdd4SThomas Monjalon                            'Item')
4000a91cdd4SThomas Monjalon    table_file = dirname(__file__) + '/nics/rte_flow_actions_table.txt'
4010a91cdd4SThomas Monjalon    generate_overview_table(table_file, 3,
4020a91cdd4SThomas Monjalon                            'rte_flow actions',
4030a91cdd4SThomas Monjalon                            'rte_flow actions availability in networking drivers',
4040a91cdd4SThomas Monjalon                            'Action')
405807418f2SPablo de Lara    table_file = dirname(__file__) + '/cryptodevs/overview_feature_table.txt'
4068a441eb9SThomas Monjalon    generate_overview_table(table_file, 1,
407807418f2SPablo de Lara                            'Features',
408807418f2SPablo de Lara                            'Features availability in crypto drivers',
409807418f2SPablo de Lara                            'Feature')
410807418f2SPablo de Lara    table_file = dirname(__file__) + '/cryptodevs/overview_cipher_table.txt'
4118a441eb9SThomas Monjalon    generate_overview_table(table_file, 2,
412807418f2SPablo de Lara                            'Cipher',
413807418f2SPablo de Lara                            'Cipher algorithms in crypto drivers',
414807418f2SPablo de Lara                            'Cipher algorithm')
415807418f2SPablo de Lara    table_file = dirname(__file__) + '/cryptodevs/overview_auth_table.txt'
4168a441eb9SThomas Monjalon    generate_overview_table(table_file, 3,
417807418f2SPablo de Lara                            'Auth',
418807418f2SPablo de Lara                            'Authentication algorithms in crypto drivers',
419807418f2SPablo de Lara                            'Authentication algorithm')
420807418f2SPablo de Lara    table_file = dirname(__file__) + '/cryptodevs/overview_aead_table.txt'
4218a441eb9SThomas Monjalon    generate_overview_table(table_file, 4,
422807418f2SPablo de Lara                            'AEAD',
423807418f2SPablo de Lara                            'AEAD algorithms in crypto drivers',
424807418f2SPablo de Lara                            'AEAD algorithm')
4257df9d02eSFiona Trahe    table_file = dirname(__file__) + '/cryptodevs/overview_asym_table.txt'
4267df9d02eSFiona Trahe    generate_overview_table(table_file, 5,
4277df9d02eSFiona Trahe                            'Asymmetric',
4287df9d02eSFiona Trahe                            'Asymmetric algorithms in crypto drivers',
4297df9d02eSFiona Trahe                            'Asymmetric algorithm')
43059e380f1STal Shnaiderman    table_file = dirname(__file__) + '/cryptodevs/overview_os_table.txt'
43159e380f1STal Shnaiderman    generate_overview_table(table_file, 6,
43259e380f1STal Shnaiderman                            'OS',
43359e380f1STal Shnaiderman                            'Operating systems support for crypto drivers',
43459e380f1STal Shnaiderman                            'Operating system')
4355a441543SLee Daly    table_file = dirname(__file__) + '/compressdevs/overview_feature_table.txt'
4365a441543SLee Daly    generate_overview_table(table_file, 1,
4375a441543SLee Daly                            'Features',
4385a441543SLee Daly                            'Features availability in compression drivers',
4395a441543SLee Daly                            'Feature')
440cf9b3c36SYuval Avnery    table_file = dirname(__file__) + '/regexdevs/overview_feature_table.txt'
441cf9b3c36SYuval Avnery    generate_overview_table(table_file, 1,
442cf9b3c36SYuval Avnery                            'Features',
443cf9b3c36SYuval Avnery                            'Features availability in regex drivers',
444cf9b3c36SYuval Avnery                            'Feature')
4456222035eSMatan Azrad    table_file = dirname(__file__) + '/vdpadevs/overview_feature_table.txt'
4466222035eSMatan Azrad    generate_overview_table(table_file, 1,
4476222035eSMatan Azrad                            'Features',
4486222035eSMatan Azrad                            'Features availability in vDPA drivers',
4496222035eSMatan Azrad                            'Feature')
45065f1eecaSNicolas Chautru    table_file = dirname(__file__) + '/bbdevs/overview_feature_table.txt'
45165f1eecaSNicolas Chautru    generate_overview_table(table_file, 1,
45265f1eecaSNicolas Chautru                            'Features',
45365f1eecaSNicolas Chautru                            'Features availability in bbdev drivers',
45465f1eecaSNicolas Chautru                            'Feature')
4558b8036a6SElena Agostini    table_file = dirname(__file__) + '/gpus/overview_feature_table.txt'
4568b8036a6SElena Agostini    generate_overview_table(table_file, 1,
4578b8036a6SElena Agostini                            'Features',
4588b8036a6SElena Agostini                            'Features availability in GPU drivers',
4598b8036a6SElena Agostini                            'Feature')
460f2577859SSunil Kumar Kori    table_file = dirname(__file__) + '/eventdevs/overview_feature_table.txt'
461f2577859SSunil Kumar Kori    generate_overview_table(table_file, 1,
462f2577859SSunil Kumar Kori                            'Scheduling Features',
463f2577859SSunil Kumar Kori                            'Features availability in eventdev drivers',
464f2577859SSunil Kumar Kori                            'Feature')
465f2577859SSunil Kumar Kori    table_file = dirname(__file__) + '/eventdevs/overview_rx_adptr_feature_table.txt'
466f2577859SSunil Kumar Kori    generate_overview_table(table_file, 2,
467f2577859SSunil Kumar Kori                            'Eth Rx adapter Features',
468f2577859SSunil Kumar Kori                            'Features availability for Ethdev Rx adapters',
469f2577859SSunil Kumar Kori                            'Feature')
470f2577859SSunil Kumar Kori    table_file = dirname(__file__) + '/eventdevs/overview_tx_adptr_feature_table.txt'
471f2577859SSunil Kumar Kori    generate_overview_table(table_file, 3,
472f2577859SSunil Kumar Kori                            'Eth Tx adapter Features',
473f2577859SSunil Kumar Kori                            'Features availability for Ethdev Tx adapters',
474f2577859SSunil Kumar Kori                            'Feature')
475f2577859SSunil Kumar Kori    table_file = dirname(__file__) + '/eventdevs/overview_crypto_adptr_feature_table.txt'
476f2577859SSunil Kumar Kori    generate_overview_table(table_file, 4,
477f2577859SSunil Kumar Kori                            'Crypto adapter Features',
478f2577859SSunil Kumar Kori                            'Features availability for Crypto adapters',
479f2577859SSunil Kumar Kori                            'Feature')
480f2577859SSunil Kumar Kori    table_file = dirname(__file__) + '/eventdevs/overview_timer_adptr_feature_table.txt'
481f2577859SSunil Kumar Kori    generate_overview_table(table_file, 5,
482f2577859SSunil Kumar Kori                            'Timer adapter Features',
483f2577859SSunil Kumar Kori                            'Features availability for Timer adapters',
484f2577859SSunil Kumar Kori                            'Feature')
4859db3f521SJohn McNamara
4862654ce5cSThomas Monjalon    if Version(sphinx_version) < Version('1.3.1'):
487536884d6SJohn McNamara        print('Upgrade sphinx to version >= 1.3.1 for '
488028c5740SThomas Monjalon              'improved Figure/Table number handling.',
489028c5740SThomas Monjalon              file=stderr)
490536884d6SJohn McNamara        # Add a role to handle :numref: references.
491536884d6SJohn McNamara        app.add_role('numref', numref_role)
492536884d6SJohn McNamara        # Process the numref references once the doctree has been created.
493536884d6SJohn McNamara        app.connect('doctree-resolved', process_numref)
494f41989c8SThomas Monjalon
49510d34aa3SThomas Monjalon    try:
49610d34aa3SThomas Monjalon        # New function in sphinx 1.8
49710d34aa3SThomas Monjalon        app.add_css_file('css/custom.css')
49810d34aa3SThomas Monjalon    except:
499f41989c8SThomas Monjalon        app.add_stylesheet('css/custom.css')
500