[PATCH 11/21] drivers/event: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- drivers/event/dlb2/dlb2_log.h | 8 drivers/event/dlb2/pf/base/dlb2_osdep.h | 12 ++-- drivers/event/dpaa/dpaa_eventdev.h| 16 drivers/event/dpaa2/dpaa2_eventdev_logs.h | 12 ++-- drivers/event/dsw/dsw_evdev.h | 8 drivers/event/sw/sw_evdev_log.h | 12 ++-- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/event/dlb2/dlb2_log.h b/drivers/event/dlb2/dlb2_log.h index c9ce87681c..321ecdfd05 100644 --- a/drivers/event/dlb2/dlb2_log.h +++ b/drivers/event/dlb2/dlb2_log.h @@ -12,11 +12,11 @@ extern int eventdev_dlb2_log_level; #define DLB2_LOG_IMPL(level, ...) \ RTE_LOG_LINE_PREFIX(level, EVENTDEV_DLB2, "%s", __func__, __VA_ARGS__) -#define DLB2_LOG_INFO(fmt, args...) \ - DLB2_LOG_IMPL(INFO, fmt, ## args) +#define DLB2_LOG_INFO(fmt, ...) \ + DLB2_LOG_IMPL(INFO, fmt, ## __VA_ARGS__) -#define DLB2_LOG_ERR(fmt, args...) \ - DLB2_LOG_IMPL(ERR, fmt, ## args) +#define DLB2_LOG_ERR(fmt, ...) \ + DLB2_LOG_IMPL(ERR, fmt, ## __VA_ARGS__) /* remove debug logs at compile time unless actually debugging */ #define DLB2_LOG_LINE_DBG(...) \ diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h index 16c5e3b797..382a49090a 100644 --- a/drivers/event/dlb2/pf/base/dlb2_osdep.h +++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h @@ -40,14 +40,14 @@ DLB2_PCI_REG_WRITE(DLB2_FUNC_REG_ADDR((hw), (reg)), (value)) /* Map to PMDs logging interface */ -#define DLB2_ERR(dev, fmt, args...) \ - RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## args) +#define DLB2_ERR(dev, fmt, ...) \ + RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## __VA_ARGS__) -#define DLB2_INFO(dev, fmt, args...) \ - RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## args) +#define DLB2_INFO(dev, fmt, ...) \ + RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## __VA_ARGS__) -#define DLB2_DEBUG(dev, fmt, args...) \ - RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args) +#define DLB2_DEBUG(dev, fmt, ...) \ + RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## __VA_ARGS__) /** * os_udelay() - busy-wait for a number of microseconds diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h index 5831ccb4e8..047c9781bd 100644 --- a/drivers/event/dpaa/dpaa_eventdev.h +++ b/drivers/event/dpaa/dpaa_eventdev.h @@ -82,13 +82,13 @@ struct dpaa_eventdev { #define EVENTDEV_INIT_FUNC_TRACE() DPAA_EVENTDEV_LOG(DEBUG, " >>") -#define DPAA_EVENTDEV_DEBUG(fmt, args...) \ - DPAA_EVENTDEV_LOG(DEBUG, fmt, ## args) -#define DPAA_EVENTDEV_ERR(fmt, args...) \ - DPAA_EVENTDEV_LOG(ERR, fmt, ## args) -#define DPAA_EVENTDEV_INFO(fmt, args...) \ - DPAA_EVENTDEV_LOG(INFO, fmt, ## args) -#define DPAA_EVENTDEV_WARN(fmt, args...) \ - DPAA_EVENTDEV_LOG(WARNING, fmt, ## args) +#define DPAA_EVENTDEV_DEBUG(fmt, ...) \ + DPAA_EVENTDEV_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA_EVENTDEV_ERR(fmt, ...) \ + DPAA_EVENTDEV_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA_EVENTDEV_INFO(fmt, ...) \ + DPAA_EVENTDEV_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA_EVENTDEV_WARN(fmt, ...) \ + DPAA_EVENTDEV_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* __DPAA_EVENTDEV_H__ */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev_logs.h b/drivers/event/dpaa2/dpaa2_eventdev_logs.h index 12317ae39f..7145ac30b9 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev_logs.h +++ b/drivers/event/dpaa2/dpaa2_eventdev_logs.h @@ -16,12 +16,12 @@ extern int dpaa2_logtype_event; #define EVENTDEV_INIT_FUNC_TRACE() DPAA2_EVENTDEV_DEBUG(" >>") -#define DPAA2_EVENTDEV_INFO(fmt, args...) \ - DPAA2_EVENTDEV_LOG(INFO, fmt, ## args) -#define DPAA2_EVENTDEV_ERR(fmt, args...) \ - DPAA2_EVENTDEV_LOG(ERR, fmt, ## args) -#define DPAA2_EVENTDEV_WARN(fmt, args...) \ - DPAA2_EVENTDEV_LOG(WARNING, fmt, ## args) +#define DPAA2_EVENTDEV_INFO(fmt, ...) \ + DPAA2_EVENTDEV_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_EVENTDEV_ERR(fmt, ...) \ + DPAA2_EVENTDEV_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA2_EVENTDEV_WARN(fmt, ...) \ + DPAA2_EVENTDEV_LOG(WARNING, fmt, ## __VA_ARGS__) #define dpaa2_evdev_info(fmt, ...) DPAA2_EVENTDEV_LOG(INFO, fmt, ##__VA_ARGS__) #define dpaa2_evdev_dbg(fmt, ...) DPAA2_EVENTDEV_LOG(DEBUG, fmt, ##__VA_ARGS__) diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index c
[PATCH 14/21] drivers/raw: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h| 24 +-- drivers/raw/ifpga/base/opae_debug.h | 4 ++-- drivers/raw/ifpga/base/opae_osdep.h | 20 .../raw/ifpga/base/osdep_rte/osdep_generic.h | 4 ++-- drivers/raw/ifpga/ifpga_rawdev.h | 16 ++--- drivers/raw/skeleton/skeleton_rawdev.h| 16 ++--- drivers/raw/skeleton/skeleton_rawdev_test.c | 8 +++ 7 files changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h index 66108e0667..d223895e1c 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -20,23 +20,23 @@ extern int dpaa2_cmdif_logtype; #define DPAA2_CMDIF_FUNC_TRACE() DPAA2_CMDIF_DEBUG(">>") -#define DPAA2_CMDIF_INFO(fmt, args...) \ - DPAA2_CMDIF_LOG(INFO, fmt, ## args) -#define DPAA2_CMDIF_ERR(fmt, args...) \ - DPAA2_CMDIF_LOG(ERR, fmt, ## args) -#define DPAA2_CMDIF_WARN(fmt, args...) \ - DPAA2_CMDIF_LOG(WARNING, fmt, ## args) +#define DPAA2_CMDIF_INFO(fmt, ...) \ + DPAA2_CMDIF_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_CMDIF_ERR(fmt, ...) \ + DPAA2_CMDIF_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA2_CMDIF_WARN(fmt, ...) \ + DPAA2_CMDIF_LOG(WARNING, fmt, ## __VA_ARGS__) /* DP Logs, toggled out at compile time if level lower than current level */ #define DPAA2_CMDIF_DP_LOG(level, ...) \ RTE_LOG_DP_LINE(level, DPAA2_CMDIF, __VA_ARGS__) -#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \ - DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args) -#define DPAA2_CMDIF_DP_INFO(fmt, args...) \ - DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args) -#define DPAA2_CMDIF_DP_WARN(fmt, args...) \ - DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args) +#define DPAA2_CMDIF_DP_DEBUG(fmt, ...) \ + DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA2_CMDIF_DP_INFO(fmt, ...) \ + DPAA2_CMDIF_DP_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_CMDIF_DP_WARN(fmt, ...) \ + DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## __VA_ARGS__) #ifdef __cplusplus } diff --git a/drivers/raw/ifpga/base/opae_debug.h b/drivers/raw/ifpga/base/opae_debug.h index a03dff926a..a802897fea 100644 --- a/drivers/raw/ifpga/base/opae_debug.h +++ b/drivers/raw/ifpga/base/opae_debug.h @@ -6,9 +6,9 @@ #define _OPAE_DEBUG_H_ #ifdef OPAE_HW_DEBUG -#define opae_log(fmt, args...) printf(fmt, ## args) +#define opae_log(fmt, ...) printf(fmt, ## __VA_ARGS__) #else -#define opae_log(fme, args...) do {} while (0) +#define opae_log(fme, ...) do {} while (0) #endif void opae_manager_dump(struct opae_manager *mgr); diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h index cb780b1fed..10329ecf18 100644 --- a/drivers/raw/ifpga/base/opae_osdep.h +++ b/drivers/raw/ifpga/base/opae_osdep.h @@ -54,14 +54,14 @@ struct uuid { #define SET_FIELD(m, v) (((v) << (__builtin_ffsll(m) - 1)) & (m)) #define GET_FIELD(m, v) (((v) & (m)) >> (__builtin_ffsll(m) - 1)) -#define dev_err(x, args...) dev_printf(ERR, args) -#define dev_info(x, args...) dev_printf(INFO, args) -#define dev_warn(x, args...) dev_printf(WARNING, args) -#define dev_debug(x, args...) dev_printf(DEBUG, args) +#define dev_err(x, ...) dev_printf(ERR, __VA_ARGS__) +#define dev_info(x, ...) dev_printf(INFO, __VA_ARGS__) +#define dev_warn(x, ...) dev_printf(WARNING, __VA_ARGS__) +#define dev_debug(x, ...) dev_printf(DEBUG, __VA_ARGS__) -#define pr_err(y, args...) dev_err(0, y, ##args) -#define pr_warn(y, args...) dev_warn(0, y, ##args) -#define pr_info(y, args...) dev_info(0, y, ##args) +#define pr_err(y, ...) dev_err(0, y, ##__VA_ARGS__) +#define pr_warn(y, ...) dev_warn(0, y, ##__VA_ARGS__) +#define pr_info(y, ...) dev_info(0, y, ##__VA_ARGS__) #ifndef WARN_ON #define WARN_ON(x) do { \ @@ -80,13 +80,13 @@ struct uuid { #define time_before(a, b) time_after(b, a) #define opae_memset(a, b, c)memset((a), (b), (c)) -#define readx_poll_timeout(op, val, cond, invl, timeout, args...) \ -__extension__ ({ \ +#define readx_poll_timeout(op, val, cond, invl, timeout, ...) \ +__extension__ ({ \ unsigned long __wait = 0; \ unsigned long __invl = (invl);\ unsigned long __timeout = (timeout);
[PATCH v1 1/2] dts: add new testpmd shell functions
Add support for setting Mac address, set flow control, VF mode in the testpmd shell. Signed-off-by: Thomas Wilks Reviewed-by: Paul Szczepanek --- dts/framework/remote_session/testpmd_shell.py | 120 ++ 1 file changed, 120 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index d187eaea94..14a7fae281 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -1932,6 +1932,78 @@ def set_vlan_filter(self, port: int, enable: bool, verify: bool = True) -> None: filter on port {port}""" ) +def set_mac_address(self, port: int, mac_address: str): +"""Sets Mac Address + +Args: +port (int): Port Id +mac_address (str): MAC Address to be set +""" +self.send_command(f"mac_addr set {port} {mac_address}") + +def set_flow_control( +self, +port: int, +rx: bool = True, +tx: bool = True, +high_water: int = 0, +low_water: int = 0, +pause_time: int = 0, +send_xon: bool = False, +mac_ctrl_frame_fwd: bool = False, +autoneg: bool = False, +): +"""Set Flow Control. + +Args: +rx (bool): Enable Reactive Extensions +tx (bool): Enable Transmit +high_water (int): High threshold value to trigger XOFF, +low_water (int): Low threshold value to trigger XON. +pause_time (int): Pause quota in the Pause frame. +send_xon (bool): Send XON frame. +mac_ctrl_frame_fwd (bool): Enable receiving MAC control frames. +autoneg (bool): _description_ +port (int): Change the auto-negotiation parameter. +""" + +self.send_command( +f"set flow_ctrl rx {'on' if rx else 'off'} tx {'on' if tx else 'off'} {high_water} {low_water} {pause_time} {1 if send_xon else 0} mac_ctrl_frame_fwd {'on' if mac_ctrl_frame_fwd else 'off'} autoneg {'on' if autoneg else 'off'} {port}" +) + +def show_port_flow_info(self, port: int): +"""Show port info flow + +Args: +port (int): port id + +Returns: +str: port flow control config +""" +output = self.send_command(f"show port {port} flow_ctrl") +output = TestPmdPortFlowCtrl.parse(output) +return output + +def set_port_VF_mode(self, port: int, vf_id: int, rxmode: str, enable: bool): +"""Set VF receive mode of a port + +Args: +port (int): Port id +vf_id (int): Virtual Function id +rxmode (str): AUPE Accepts untagged VLAN. + ROPE Accepts unicast hash. + BAM Accepts broadcast packets. + MPE Accepts all multicast packets. +enable (bool): Enables vf mode +""" +rxmode_valid = ["AUPE", "ROPE", "BAM", "MPE"] +if rxmode in rxmode_valid: +self.send_command( +f"set port {port} vf {vf_id} rxmode {rxmode} {'on' if enable else 'off'}" +) +else: +raise InteractiveCommandExecutionError(f"{rxmode} is an invlaid rxmode") + def rx_vlan(self, vlan: int, port: int, add: bool, verify: bool = True) -> None: """Add specified vlan tag to the filter list on a port. Requires vlan filter to be on. @@ -2315,6 +2387,50 @@ def get_capabilities_mcast_filtering( command = str.replace(command, "add", "remove", 1) self.send_command(command) +def get_capabilities_flow_ctrl( +self, +supported_capabilities: MutableSet["NicCapability"], +unsupported_capabilities: MutableSet["NicCapability"], +) -> None: +"""Get Flow control capability from `show port flow_ctrl` and check for a testpmd error code + +Args: +supported_capabilities: Supported capabilities will be added to this set. +unsupported_capabilities: Unsupported capabilities will be added to this set. +""" +self._logger.debug("Getting flow ctrl capabilities.") +command = f"show port {self.ports[0].id} flow_ctrl" +output = self.send_command(command) +if "Flow control infos" in output: +supported_capabilities.add(NicCapability.FLOW_CTRL) +else: +unsupported_capabilities.add(NicCapability.FLOW_CTRL) + + +@dataclass +class TestPmdPortFlowCtrl(TextParser): +"""Dataclass representation of the common parts of the testpmd `show port flow_ctrl` command.""" + +flow_ctrl_rx: bool = field(metadata=TextParser.find(r"Rx pause: on")) +#: +flow_ctrl_tx: bool = field(metadata=TextParser.find(r"Tx pause: on")) +#: +flow_ctrl_high_water: int = field( +metadata=TextParser.find_int(r"High waterline: (0x[a-fA-F\d]+)"
[PATCH v1 2/2] dts: add port restart configuration persistency test
Added test that sets various port settings and verifies that they persist after a port restart. Signed-off-by: Thomas Wilks Reviewed-by: Paul Szczepanek --- ...stSuite_port_restart_config_persistency.py | 117 ++ 1 file changed, 117 insertions(+) create mode 100644 dts/tests/TestSuite_port_restart_config_persistency.py diff --git a/dts/tests/TestSuite_port_restart_config_persistency.py b/dts/tests/TestSuite_port_restart_config_persistency.py new file mode 100644 index 00..969b96d422 --- /dev/null +++ b/dts/tests/TestSuite_port_restart_config_persistency.py @@ -0,0 +1,117 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Arm Limited + +"""Port config persistency Test suite. + +Changes configuration of ports and verifies that the configuration persists after a +port is restarted. +""" + +from framework.remote_session.testpmd_shell import TestPmdShell +from framework.test_suite import TestSuite, func_test +from framework.testbed_model.capability import NicCapability, requires + +ALTERNATIVE_MTU: int = 800 +STANDARD_MTU: int = 1500 +ALTERNATITVE_MAC_ADDRESS: str = "40:A6:B7:9E:B4:81" + + +class TestPortRestartConfigPersistency(TestSuite): +"""Port config persistency Test suite.""" + +def restart_port_and_verify(self, id, testpmd, changed_value) -> None: +"""Fetches all of the port configs, restarts all of the ports, fetches all the port +configs again and then compares the two the configs and varifies that they are the same. +""" + +testpmd.start_all_ports() +testpmd.wait_link_status_up(port_id=id, timeout=10) + +port_info_before = testpmd.show_port_info(id) +all_info_before = port_info_before.__dict__ +try: +flow_info_before = testpmd.show_port_flow_info(id) +all_info_before.update(flow_info_before.__dict__) +except: +pass + +testpmd.stop_all_ports() +testpmd.start_all_ports() +testpmd.wait_link_status_up(port_id=id, timeout=10) + +port_info_after = testpmd.show_port_info(id) +all_info_after = port_info_after.__dict__ +try: +flow_info_after = testpmd.show_port_flow_info(id) +all_info_after.update(flow_info_after.__dict__) +except: +pass + +self.verify( +all_info_before == all_info_after, +f"Port configuration for {changed_value} was not retained through port restart", +) +testpmd.stop_all_ports() + +@func_test +def port_configuration_persistence(self) -> None: +"""Port restart configuration Persistency Test. + +Steps: +For each port set the port MTU, VLAN Filter, Mac Address, VF mode, and Promiscuous Mode. + +Verify: +Check that the configuration persists after the port is restarted. +""" + +with TestPmdShell(self.sut_node) as testpmd: +testpmd.stop_all_ports() +all_ports = [port.id for port in testpmd.show_port_info_all()] +for port_id in all_ports: +testpmd.set_port_mtu(port_id=port_id, mtu=STANDARD_MTU, verify=True) + +self.restart_port_and_verify(port_id, testpmd, "mtu") + +testpmd.set_port_mtu(port_id=port_id, mtu=ALTERNATIVE_MTU, verify=True) + +self.restart_port_and_verify(port_id, testpmd, "mtu") + +testpmd.set_vlan_filter(port=port_id, enable=True, verify=True) + +self.restart_port_and_verify(port_id, testpmd, "VLAN_filter") + +testpmd.set_mac_address(port=port_id, mac_address=ALTERNATITVE_MAC_ADDRESS) + +self.restart_port_and_verify(port_id, testpmd, "mac_address") + +testpmd.set_port_VF_mode(port=port_id, vf_id=port_id, rxmode="AUPE", enable=True) + +self.restart_port_and_verify(port_id, testpmd, "VF_mode") + +testpmd.set_promisc(port=port_id, enable=True, verify=False) + +self.restart_port_and_verify(port_id, testpmd, "Promiscuous_Mode") + +@requires(NicCapability.FLOW_CTRL) +@func_test +def flow_ctrl_port_configuration_persistence(self) -> None: +"""Flow Control port restart configuration Persistency Test. + +Steps: +For each port enable flow control for RX and TX individualy. +Verify: +Check that the configuration persists after the port is restarted. +""" + +with TestPmdShell(self.sut_node) as testpmd: +testpmd.stop_all_ports() +all_ports = [port.id for port in testpmd.show_port_info_all()] +for port_id in all_ports: + +testpmd.set_flow_control(port=port_id, rx=True, tx=False) + +self.restart_port_and_verify(port_id, testpmd, "flow_ctrl") + +testpmd.set_flow_control(port=port_id, rx=False, tx=True) + +self.restart_port_an
[RFC 2/8] net/ioring: implement link state
Add hooks to set kernel link up/down and report state. Signed-off-by: Stephen Hemminger --- doc/guides/nics/features/ioring.ini | 1 + drivers/net/ioring/rte_eth_ioring.c | 84 + 2 files changed, 85 insertions(+) diff --git a/doc/guides/nics/features/ioring.ini b/doc/guides/nics/features/ioring.ini index c4c57caaa4..d4bf70cb4f 100644 --- a/doc/guides/nics/features/ioring.ini +++ b/doc/guides/nics/features/ioring.ini @@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y Linux = Y x86-64 = Y Usage doc= Y diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index 7b62c47f54..fa3e748cda 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -47,6 +47,53 @@ struct pmd_internals { struct rte_ether_addr eth_addr; /* address assigned by kernel */ }; +static int +eth_dev_change_flags(struct rte_eth_dev *dev, uint16_t flags, uint16_t mask) +{ + struct pmd_internals *pmd = dev->data->dev_private; + + int sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) + return -errno; + + struct ifreq ifr = { }; + strlcpy(ifr.ifr_name, pmd->ifname, IFNAMSIZ); + + int ret = ioctl(sock, SIOCGIFFLAGS, &ifr); + if (ret < 0) + goto error; + + /* NB: ifr.ifr_flags is type short */ + ifr.ifr_flags &= mask; + ifr.ifr_flags |= flags; + + ret = ioctl(sock, SIOCSIFFLAGS, &ifr); +error: + close(sock); + return (ret < 0) ? -errno : 0; +} + +static int +eth_dev_get_flags(struct rte_eth_dev *dev, short *flags) +{ + struct pmd_internals *pmd = dev->data->dev_private; + + int sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) + return -errno; + + struct ifreq ifr = { }; + strlcpy(ifr.ifr_name, pmd->ifname, IFNAMSIZ); + + int ret = ioctl(sock, SIOCGIFFLAGS, &ifr); + if (ret == 0) + *flags = ifr.ifr_flags; + + close(sock); + return (ret < 0) ? -errno : 0; +} + + /* Creates a new tap device, name returned in ifr */ static int tap_open(const char *name, struct ifreq *ifr, uint8_t persist) @@ -103,6 +150,39 @@ tap_open(const char *name, struct ifreq *ifr, uint8_t persist) return -1; } + +static int +eth_dev_set_link_up(struct rte_eth_dev *dev) +{ + return eth_dev_change_flags(dev, IFF_UP, 0); +} + +static int +eth_dev_set_link_down(struct rte_eth_dev *dev) +{ + return eth_dev_change_flags(dev, 0, ~IFF_UP); +} + +static int +eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) +{ + struct rte_eth_link *eth_link = &dev->data->dev_link; + short flags = 0; + + if (eth_dev_get_flags(dev, &flags) < 0) { + PMD_LOG(ERR, "ioctl(SIOCGIFFLAGS): %s", strerror(errno)); + return -1; + } + + *eth_link = (struct rte_eth_link) { + .link_speed = RTE_ETH_SPEED_NUM_UNKNOWN, + .link_duplex = RTE_ETH_LINK_FULL_DUPLEX, + .link_status = (flags & IFF_UP) ? RTE_ETH_LINK_UP : RTE_ETH_LINK_DOWN, + .link_autoneg = RTE_ETH_LINK_FIXED, + }; + return 0; +}; + static int eth_dev_close(struct rte_eth_dev *dev) { @@ -126,8 +206,12 @@ eth_dev_close(struct rte_eth_dev *dev) static const struct eth_dev_ops ops = { .dev_close = eth_dev_close, + .link_update= eth_link_update, + .dev_set_link_up= eth_dev_set_link_up, + .dev_set_link_down = eth_dev_set_link_down, }; + static int ioring_create(struct rte_eth_dev *dev, const char *tap_name, uint8_t persist) { -- 2.45.2
Re: [PATCH 16/21] lib/log: ensure code structure does not change
On Tue, 10 Dec 2024 18:05:46 -0800 Andre Muezerie wrote: > Add "do { } while (0)" to macros used to remove logging calls, to > ensure there's no code structure change when enabling/disabling > logging. > > Signed-off-by: Andre Muezerie > --- > lib/log/rte_log.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h > index 3735137150..6b00caab88 100644 > --- a/lib/log/rte_log.h > +++ b/lib/log/rte_log.h > @@ -364,7 +364,7 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char > *format, va_list ap) > static_assert(!__builtin_strchr(fmt, '\n'), \ > "This log format string contains a \\n") > #else > -#define RTE_LOG_CHECK_NO_NEWLINE(...) > +#define RTE_LOG_CHECK_NO_NEWLINE(...) do { } while (0) > #endif > > /** NAK this is a change since static_assert() can be put anywhere like outside of code blocks. This patch is not needed.
[DPDK/meson Bug 1594] [dpdk-21.11.9-rc1] unit_tests_eal/link_bonding: link_bonding_autotest test failed
https://bugs.dpdk.org/show_bug.cgi?id=1594 Bug ID: 1594 Summary: [dpdk-21.11.9-rc1] unit_tests_eal/link_bonding: link_bonding_autotest test failed Product: DPDK Version: 21.11 Hardware: x86 OS: All Status: UNCONFIRMED Severity: normal Priority: Normal Component: meson Assignee: dev@dpdk.org Reporter: linglix.c...@intel.com Target Milestone: --- Environment === DPDK version: f197f1e13c (version: 21.11.9-rc1) OS: Red Hat Enterprise Linux 8.4 (Ootpa)/4.18.0-305.19.1.el8_4.x86_64 Compiler: gcc version 8.4.1 20200928 Hardware platform: Intel(R) Xeon(R) Gold 6139 CPU @ 2.30GHz NIC hardware: Ethernet Controller XXV710 for 25GbE SFP28 158b NIC firmware: FW: 8.30 0x8000a485 1.2926.0 Driver: i40e-2.17.4 Test Setup Steps to reproduce == 1. Bind ports to vfio-pci ./usertools/dpdk-devbind.py -b vfio-pci :af:00.0 :af:00.1 2. Launch dpdk-test x86_64-native-linuxapp-gcc/app/test/dpdk-test -l 1-4 -n 4 -a :af:00.0 -a :af:00.1 3. Start link_bonding_autotest test RTE>>link_bonding_autotest Show the output from the previous commands. === + --- + + Test Suite Summary : Link Bonding Unit Test Suite + --- + + Tests Total : 65 + Tests Skipped : 0 + Tests Executed :65 + Tests Unsupported: 0 + Tests Passed : 27 + Tests Failed : 38 + --- + Test Failed Expected Result === + --- + + Test Suite Summary : Link Bonding Unit Test Suite + --- + + Tests Total : 65 + Tests Skipped : 0 + Tests Executed :65 + Tests Unsupported: 0 + Tests Passed : 65 + Tests Failed : 0 + --- + Test OK bad commit ** commit e1a999e7ff4cf08e5393ce7c1a7873bc8f7233ff Author: Stephen Hemminger Date: Thu Nov 21 10:23:22 2024 -0800 test/bonding: fix loop on members [ upstream commit 112ce3917674b7e316776305d7e27778d17eb1b7 ] Do not use same variable for outer and inner loop in bonding test. Since the loop is just freeing the resulting burst use bulk free. Link: https://pvs-studio.com/en/blog/posts/cpp/1179/ Fixes: 92073ef961ee ("bond: unit tests") Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Chengwen Feng -- You are receiving this mail because: You are the assignee for the bug.
[DPDK/ethdev Bug 1592] AF_PACKET PMD loops back packets on veth with tc
https://bugs.dpdk.org/show_bug.cgi?id=1592 Stephen Hemminger (step...@networkplumber.org) changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED CC||step...@networkplumber.org --- Comment #1 from Stephen Hemminger (step...@networkplumber.org) --- This is not a DPDK bug. The Linux kernel will interpret the packets it receives. By default Linux has a weak host model, and it will look at the L3 header. If you want to forward you need to either use hardware DPDK network devices (not packet, tun, ...); or put each eth device into a different network or namespace. The DPDK part of forwarding has nothing wrong here. -- You are receiving this mail because: You are the assignee for the bug.
Re: [PATCH v3 5/6] net/macb: fix tab errors in meson.build file
On Tue, 10 Dec 2024 07:08:35 + Wencheng Li wrote: > Replace tabs with spaces to resolve indentation > issues in meson.build file. > > Fixes: 97fd6a929cf8 ("net/macb: add new driver") > Cc: liwench...@phytium.com.cn > > Signed-off-by: Wencheng Li Since this is a new driver, please fix this in the earlier patch that adds it rather than including a fixup patch. You can do this with git rebase and squashing the patches. Each patch in a new driver should be clean of basic stuff like whitespace, bad flags, etc. And after each patch the build should be clean.
Re: [RFC 5/6] build: install indirect headers to a dedicated directory
On Wed, Nov 27, 2024 at 12:43 PM Bruce Richardson wrote: > > diff --git a/buildtools/pkg-config/meson.build > > b/buildtools/pkg-config/meson.build > > index b36add17e3..809706fe3e 100644 > > --- a/buildtools/pkg-config/meson.build > > +++ b/buildtools/pkg-config/meson.build > > @@ -27,12 +27,18 @@ endif > > # are skipped in the case of static linkage thanks to the flag --as-needed. > > > > > > +subdirs = [ '.', 'internal' ] > > +if get_option('include_subdir_arch') != '' > > +subdirs = [ subdirs, get_option('include_subdir_arch') ] > > +subdirs = [ subdirs, join_paths(get_option('include_subdir_arch'), > > 'internal')] > > minor nit, I tend to prefer using "+=" rather than relying on flattening to > extend the arrays. Hum, yes, I also prefer +=. I think I mixed this with a different warning I hit when playing with other meson objects... I'll update in next revision. -- David Marchand
23.11.3 patches review and test
Hi all, Here is a list of patches targeted for stable release 23.11.3. The planned date for the final release is 17th December. Please help with testing and validation of your use cases and report any issues/results with reply-all to this mail. For the final release the fixes and reported validations will be added to the release notes. A release candidate tarball can be found at: https://dpdk.org/browse/dpdk-stable/tag/?id=v23.11.3-rc1 These patches are located at branch 23.11 of dpdk-stable repo: https://dpdk.org/browse/dpdk-stable/ Thanks. Xueming Li --- Ajit Khaparde (1): net/bnxt: fix TCP and UDP checksum flags Alan Elder (1): net/netvsc: fix using Tx queue higher than Rx queues Aleksandr Loktionov (1): net/i40e/base: fix misleading debug logs and comments Alexander Kozyrev (3): common/mlx5: fix error CQE handling for 128 bytes CQE net/mlx5: fix shared queue port number in vector Rx net/mlx5: fix miniCQEs number calculation Anatoly Burakov (2): net/i40e/base: fix setting flags in init function net/i40e/base: add missing X710TL device check Andre Muezerie (1): rcu: fix implicit conversion in bit shift Arkadiusz Kusztal (2): crypto/qat: fix modexp/inv length crypto/qat: fix ECDSA session handling Artur Tyminski (1): net/i40e/base: fix DDP loading with reserved track ID Barbara Skobiej (3): net/ixgbe/base: fix unchecked return value net/i40e/base: fix unchecked return value net/i40e/base: fix loop bounds Bill Xiang (2): vhost: fix offset while mapping log base address vdpa: update used flags in used ring relay Bing Zhao (5): net/mlx5: workaround list management of Rx queue control net/mlx5: fix Rx queue control management net/mlx5: fix default RSS flows creation order net/mlx5: fix Rx queue reference count in flushing flows net/mlx5: fix shared Rx queue control release Brian Dooley (1): test/crypto: fix synchronous API calls Bruce Richardson (11): eal/x86: fix 32-bit write combining store net/iavf: delay VF reset command net/i40e: fix AVX-512 pointer copy on 32-bit net/ice: fix AVX-512 pointer copy on 32-bit net/iavf: fix AVX-512 pointer copy on 32-bit common/idpf: fix AVX-512 pointer copy on 32-bit build: remove version check on compiler links function net/ice: detect stopping a flow director queue twice app/dumpcap: remove unused struct array eventdev: fix possible array underflow/overflow net/iavf: add segment-length check to Tx prep Chaoyong He (2): net/nfp: fix link change return value net/nfp: fix pause frame setting check Chengwen Feng (7): examples/eventdev: fix queue crash with generic pipeline ethdev: verify queue ID in Tx done cleanup net/hns3: verify reset type from firmware dmadev: fix potential null pointer access net/hns3: restrict tunnel flow rule to one header net/hns3: register VLAN flow match mode parameter net/mvneta: fix possible out-of-bounds write Danylo Vodopianov (1): app/testpmd: fix aged flow destroy Dariusz Sosnowski (1): net/mlx5: fix counter query loop getting stuck Dave Ertman (1): net/ice/base: fix VLAN replay after reset David Marchand (4): drivers: remove redundant newline from logs net/iavf: preserve MAC address with i40e PF Linux driver crypto/openssl: fix 3DES-CTR with big endian CPUs eal/unix: optimize thread creation Dengdui Huang (3): net/hns3: remove ROH devices net/hns3: fix error code for repeatedly create counter net/hns3: fix fully use hardware flow director table Erez Shitrit (1): net/mlx5/hws: fix allocation of STCs Eryk Rybak (1): net/i40e/base: fix blinking X722 with X557 PHY Fabio Pricoco (2): net/ice/base: fix iteration of TLVs in Preserved Fields Area net/ice/base: add bounds check Farah Smith (1): net/bnxt/tf_core: fix Thor TF EM key size check Fidaullah Noonari (1): app/procinfo: fix leak on exit Gagandeep Singh (3): crypto/dpaa2_sec: fix memory leak bus/dpaa: fix PFDRs leaks due to FQRNIs net/dpaa2: fix memory corruption in TM Gregory Etelson (6): net/mlx5: fix GRE flow item translation for root table net/mlx5/hws: fix range definer error recovery net/mlx5: fix SQ flow item size net/mlx5: fix non-template flow action validation net/mlx5: fix SWS meter state initialization net/mlx5: fix indirect list flow action callback invocation Hanumanth Pothula (1): event/octeontx: fix possible integer overflow Harman Kalra (1): common/cnxk: fix double free of flow aging resources Hemant Agrawal (4): bus/dpaa: fix VSP for 1G fm1-mac9 and 10 bus/dpaa: fix the fman details status examples/l2fwd-event: fix spinlock handling bus/dpaa: fix lock condition during error handling Hernan Var
[PATCH 1/3] lib/eal: add rte_atomic128_cmp_exchange compatible with MSVC
MSVC does not support inline assembly, which is used by the implementation of rte_atomic128_cmp_exchange and is needed by lib/stack. Error printed by MSVC: stack_rte_stack_lf.c.obj : error LNK2019: unresolved external symbol rte_atomic128_cmp_exchange referenced in function __rte_stack_lf_push_elems Fix is to provide an implementation for rte_atomic128_cmp_exchange which uses an intrinsic function, which is used when compiling with MSVC. For other compilers the existing implementation continues to be used. Signed-off-by: Andre Muezerie --- lib/eal/x86/include/rte_atomic.h| 4 ++-- lib/eal/x86/include/rte_atomic_64.h | 18 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h index c72c47c83e..e8e0e4c33c 100644 --- a/lib/eal/x86/include/rte_atomic.h +++ b/lib/eal/x86/include/rte_atomic.h @@ -288,12 +288,12 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v) #endif +#endif /* RTE_TOOLCHAIN_MSVC */ + #ifdef RTE_ARCH_I686 #include "rte_atomic_32.h" #else #include "rte_atomic_64.h" #endif -#endif - #endif /* _RTE_ATOMIC_X86_H_ */ diff --git a/lib/eal/x86/include/rte_atomic_64.h b/lib/eal/x86/include/rte_atomic_64.h index 0a7a2131e0..26c87a2da6 100644 --- a/lib/eal/x86/include/rte_atomic_64.h +++ b/lib/eal/x86/include/rte_atomic_64.h @@ -182,6 +182,23 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) /* 128 bit atomic operations -*/ +#ifdef RTE_TOOLCHAIN_MSVC +static inline int +rte_atomic128_cmp_exchange(rte_int128_t *dst, + rte_int128_t *exp, + const rte_int128_t *src, + unsigned int weak, + int success, + int failure) +{ + return (int)_InterlockedCompareExchange128( + (int64_t volatile *) dst, + src->val[1], /* exchange high */ + src->val[0], /* exchange low */ + (int64_t *) exp /* comparand result */ + ); +} +#else static inline int rte_atomic128_cmp_exchange(rte_int128_t *dst, rte_int128_t *exp, @@ -212,5 +229,6 @@ rte_atomic128_cmp_exchange(rte_int128_t *dst, return res; } +#endif /* RTE_TOOLCHAIN_MSVC */ #endif /* _RTE_ATOMIC_X86_64_H_ */ -- 2.47.0.vfs.0.3
Re: [PATCH 0/3] Defer lcore variables allocation
On Fri, 06 Dec 2024 16:55:30 +0100 Thomas Monjalon wrote: > 06/12/2024 12:01, Mattias Rönnblom: > > On 2024-12-05 18:57, David Marchand wrote: > > In retrospect, maybe the offset between lcore variable instances could > > have been encoded into the handle, and thus one could use > > different-sized offset for different variables. > > Yes it would allow to allocate a minimum size, > instead of having a default which is also a maximum limit size of an object. > > It is not too late to change the behavior as the API is experimental. > > > > The general question on whether lcore variables in constructor should > > > be forbidden, is left to a later discussion. > > > > That discussion could be extended to cover the question if RTE_INIT() > > type constructors should be used at all. Intuitively, it seems better if > > all DPDK initialization, or at least all EAL init, happens at the time > > of rte_eal_init(), in some ordered/organized fashion. > > Yes we may avoid constructors and instead have callbacks called in > rte_eal_init(). > In order to not break the RTE_INIT API, we could define some new macros > for registering such rte_eal_init callbacks. > > My intuition is that the OVS problem with using mlockall() is caused because when malloc is used, the malloc code will pre-allocate a new arena (memory area) for use. If the malloc takes before the mlockall() it will then be pinned even if not used. If the malloc takes place later, perhaps that arena is coming from unpinned area. Many more details on glibc malloc here: https://sourceware.org/glibc/wiki/MallocInternals Using blunt tool like mlockall() will have unintended side effects. The issue with constructors, is they look good when they are simple, statless, and only a few of them. But they get to be a undebuggable mess when the constructor does complex stuff; has dependencies; and there are lots of them. As a refinement, maybe having a way to register callback to be called in parallel after EAL has started threads. But some things like random() need to be available early in startup.
[PATCH 3/3] lib/stack: enable build with MSVC
Now that the issues preventing the code needed to build lib/stack have been addressed, it can be enabled so that it also gets built when using the MSVC compiler. Signed-off-by: Andre Muezerie --- lib/stack/meson.build | 6 -- 1 file changed, 6 deletions(-) diff --git a/lib/stack/meson.build b/lib/stack/meson.build index 7631a14784..18177a742f 100644 --- a/lib/stack/meson.build +++ b/lib/stack/meson.build @@ -1,12 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel Corporation -if is_ms_compiler -build = false -reason = 'not supported building with Visual Studio Toolset' -subdir_done() -endif - sources = files('rte_stack.c', 'rte_stack_std.c', 'rte_stack_lf.c') headers = files('rte_stack.h') # subheaders, not for direct inclusion by apps -- 2.47.0.vfs.0.3
[PATCH 2/3] app/test: add basic test for rte_atomic128_cmp_exchange
A basic test for rte_atomic128_cmp_exchange that can also be compiled with MSVC and run on Windows is being added. This is relevant as rte_atomic128_cmp_exchange uses a different implementation when compiled with MSVC and the existing tests for this function are not compatible with MSVC. Signed-off-by: Andre Muezerie --- app/test/test_atomic.c | 59 ++ 1 file changed, 59 insertions(+) diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c index db07159e81..d3d9de0a41 100644 --- a/app/test/test_atomic.c +++ b/app/test/test_atomic.c @@ -20,6 +20,7 @@ #include "test.h" +#ifndef RTE_TOOLCHAIN_MSVC /* * Atomic Variables * @@ -441,9 +442,41 @@ test_atomic_exchange(__rte_unused void *arg) return 0; } +#endif /* RTE_TOOLCHAIN_MSVC */ + +#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_ARM64) +static rte_int128_t big_int; + +/* + * This function atomically performs: + * big_int.val[1] += big_int.val[0] + * big_int.val[0] += 1 + */ +static void +test_atomic_128_bit_compare_and_swap_basic_test(void) +{ + rte_int128_t comparand = big_int; + + rte_int128_t src; + src.val[0] = big_int.val[0] + 1; + src.val[1] = big_int.val[0] + big_int.val[1]; + + do { + ; /* nothing */ + } while (rte_atomic128_cmp_exchange(&big_int, + &comparand, + &src, + 1, + 0, + 0 + )); +} +#endif + static int test_atomic(void) { +#ifndef RTE_TOOLCHAIN_MSVC rte_atomic16_init(&a16); rte_atomic32_init(&a32); rte_atomic64_init(&a64); @@ -628,6 +661,32 @@ test_atomic(void) printf("Atomic exchange test failed\n"); return -1; } +#endif /* RTE_TOOLCHAIN_MSVC */ + +#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_ARM64) + /* +* This is a basic test case for rte_atomic128_cmp_exchange. +* On MSVC this test provides the confirmation that +* rte_atomic128_cmp_exchange passes the parameters correctly +* to the underlying intrinsic function responsible for the +* operation. +* +* The test atomically performs: +* big_int.val[1] += big_int.val[0] +* big_int.val[0] += 1 +*/ + printf("128-bit compare and swap basic test\n"); + + big_int.val[1] = 23; /* should become 34 */ + big_int.val[0] = 11; /* should become 12 */ + + test_atomic_128_bit_compare_and_swap_basic_test(); + + if (big_int.val[1] != 34 || big_int.val[0] != 12) { + printf("128-bit compare and swap basic test failed\n"); + return -1; + } +#endif return 0; } -- 2.47.0.vfs.0.3
[PATCH 0/3] enable build of lib/stack when using MSVC
MSVC does not support inline assembly, which is used by the implementation of rte_atomic128_cmp_exchange and is needed by lib/stack. An implementation for rte_atomic128_cmp_exchange compatible with MSVC using an intrinsic function is added. For other compilers the existing implementation continues to be used. A basic test is added to provide coverage for this special rte_atomic128_cmp_exchange implementation for MSVC. This same test can be run when using other compilers as well, in which case the old implementation for rte_atomic128_cmp_exchange is used. Andre Muezerie (3): lib/eal: add rte_atomic128_cmp_exchange compatible with MSVC app/test: add basic test for rte_atomic128_cmp_exchange lib/stack: enable build with MSVC app/test/test_atomic.c | 59 + lib/eal/x86/include/rte_atomic.h| 4 +- lib/eal/x86/include/rte_atomic_64.h | 18 + lib/stack/meson.build | 6 --- 4 files changed, 79 insertions(+), 8 deletions(-) -- 2.47.0.vfs.0.3
Re: [RFC] eventdev: add atomic queue to test-eventdev app
On 2024-12-05 14:29, Luka Jankovic wrote: From 753273ab9af49e16d7f7b577d6263e3db51257d7 Mon Sep 17 00:00:00 2001 From: Luka Jankovic Date: Thu, 5 Dec 2024 13:05:35 + Subject: [RFC] eventdev: add atomic queue to test-eventdev app Add an atomic queue test based on the order queue test but use exclusively atomic queues. This makes it compatible with event devices such as the distributed software eventdev. The other tests are incompatible due to the use of "ALL_TYPES" type queues, or some other reason? The test detects whether port maintenance is required. To verify atomicity, a spinlock is set up for each combination of port, queue, and flow. Hmm. Atomicity doesn't depend on ports? It is taken whenever an event enters a new flow and released when all events from a flow are processed. The test will fail if a port attempts to take the lock for a given flow which is already taken by another port. In the end, it is verified that an equal amount of locks and unlocks occured, and that all events have been processed. Signed-off-by: Luka Jankovic --- app/test-eventdev/evt_common.h| 10 + app/test-eventdev/meson.build | 1 + app/test-eventdev/test_atomic_queue.c | 569 ++ app/test-eventdev/test_order_common.h | 1 + 4 files changed, 581 insertions(+) create mode 100644 app/test-eventdev/test_atomic_queue.c diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h index 901b8ba55d..f0036fb620 100644 --- a/app/test-eventdev/evt_common.h +++ b/app/test-eventdev/evt_common.h @@ -138,6 +138,16 @@ evt_has_flow_id(uint8_t dev_id) true : false; } +static inline bool +evt_has_maintenance_free(uint8_t dev_id) I would use "is" instead of "has". +{ + struct rte_event_dev_info dev_info; + + rte_event_dev_info_get(dev_id, &dev_info); + return (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_MAINTENANCE_FREE) ? + true : false; return dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_MAINTENANCE_FREE; will work fine. +} + static inline int evt_service_setup(uint32_t service_id) { diff --git a/app/test-eventdev/meson.build b/app/test-eventdev/meson.build index ab8769c755..db5add39eb 100644 --- a/app/test-eventdev/meson.build +++ b/app/test-eventdev/meson.build @@ -15,6 +15,7 @@ sources = files( 'test_order_atq.c', 'test_order_common.c', 'test_order_queue.c', +'test_atomic_queue.c', 'test_perf_atq.c', 'test_perf_common.c', 'test_perf_queue.c', diff --git a/app/test-eventdev/test_atomic_queue.c b/app/test-eventdev/test_atomic_queue.c new file mode 100644 index 00..02aec95d59 --- /dev/null +++ b/app/test-eventdev/test_atomic_queue.c @@ -0,0 +1,569 @@ +#include +#include +#include + +#include "test_order_common.h" + +#define NB_QUEUES 2 + +rte_spinlock_t *atomic_locks; Should be static. + +struct port_stat_counters { + uint32_t num_locked[NB_QUEUES]; + uint32_t num_unlocked[NB_QUEUES]; + uint64_t *num_pkts; +}; + +static RTE_LCORE_VAR_HANDLE(struct port_stat_counters, port_counters); + +static inline int +get_num_pkts_index(int queue, uint32_t flow, uint32_t nb_flows) +{ + return (queue * nb_flows) + flow; +} + +static inline uint32_t +get_lock_idx(int queue, uint32_t nb_ports, uint32_t nb_flows, uint32_t port, flow_id_t flow) +{ + return (queue * nb_ports * nb_flows) + (port * nb_flows) + flow; +} + +static inline int +atomic_producer(void *arg) +{ + struct prod_data *p = arg; + struct test_order *t = p->t; + struct evt_options *opt = t->opt; + const uint8_t dev_id = p->dev_id; + const uint8_t port = p->port_id; + struct rte_mempool *pool = t->pool; + const uint64_t nb_pkts = t->nb_pkts; + uint32_t *producer_flow_seq = t->producer_flow_seq; + const uint32_t nb_flows = t->nb_flows; + uint64_t count = 0; + struct rte_mbuf *m; + struct rte_event ev; + + if (opt->verbose_level > 1) + printf("%s(): lcore %d dev_id %d port=%d queue=%d\n", __func__, rte_lcore_id(), + dev_id, port, p->queue_id); + + ev.event = 0; + ev.op = RTE_EVENT_OP_NEW; + ev.queue_id = p->queue_id; + ev.sched_type = RTE_SCHED_TYPE_ORDERED; + ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL; + ev.event_type = RTE_EVENT_TYPE_CPU; + ev.sub_event_type = 0; /* stage 0 */ A detail, but ev = (struct rte_event) { .event = 0, /../ }; looks better imo. + + while (count < nb_pkts && t->err == false) { + m = rte_pktmbuf_alloc(pool); + if (m == NULL) + continue; Isn't the pool sized to be able to satisfy all allocations (for all in-flight events [+mbuf caches] in the test)? So an allocation failure is an error. + + const flow_id_t flow = (uintptr_t)
[PATCH 0/3] dts: enable types of Scapy
Hi there, sending in a could of patches which update our current dependencies, therefore enabling typed Scapy. Updated mypy also suggested to add missing stubs, which were add appropriately. Depends-on: series-34127 ("dts: add Ruff and docstring linting") Best regards, Luca Luca Vizzarro (3): dts: update dependencies dts: add missing type stubs dts: resolve mypy type errors .../interactive_remote_session.py |4 +- .../single_active_interactive_shell.py|2 +- dts/framework/remote_session/ssh_session.py |4 +- dts/framework/test_suite.py | 20 +- dts/framework/testbed_model/capability.py |4 +- dts/framework/testbed_model/tg_node.py|2 +- .../capturing_traffic_generator.py|4 +- .../testbed_model/traffic_generator/scapy.py |6 +- .../traffic_generator/traffic_generator.py|2 +- dts/framework/utils.py|6 +- dts/poetry.lock | 1283 + dts/pyproject.toml|8 +- dts/tests/TestSuite_checksum_offload.py | 24 +- dts/tests/TestSuite_dynamic_queue_conf.py | 15 +- dts/tests/TestSuite_mac_filter.py |6 +- dts/tests/TestSuite_pmd_buffer_scatter.py | 17 +- dts/tests/TestSuite_vlan.py |6 +- 17 files changed, 752 insertions(+), 661 deletions(-) -- 2.43.0
[DPDK/DTS Bug 1389] Investigate automatically building config schema documentation
https://bugs.dpdk.org/show_bug.cgi?id=1389 Luca Vizzarro (luca.vizza...@arm.com) changed: What|Removed |Added CC||luca.vizza...@arm.com Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #2 from Luca Vizzarro (luca.vizza...@arm.com) --- This is no longer needed. JSON schema is no longer used, and docs are generated from the Pydantic models representing the configuration -- You are receiving this mail because: You are the assignee for the bug.
[PATCH 2/3] dts: add missing type stubs
The invoke and paramiko libraries were missing the type stubs. These are added under the dev dependencies as the only scope in which they are used is through mypy static checking. For the same reason, move the PyYAML subs under the dev dependencies. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/poetry.lock| 27 ++- dts/pyproject.toml | 4 +++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index 1eae7ea2fb..29f9a18cd6 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -1228,6 +1228,31 @@ files = [ {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] +[[package]] +name = "types-invoke" +version = "2.0.0.10" +description = "Typing stubs for invoke" +optional = false +python-versions = ">=3.7" +files = [ +{file = "types-invoke-2.0.0.10.tar.gz", hash = "sha256:a54d7ecdc19e0c22cd2786ef2e64c2631715c78eba8a1bf40b511d0608f33a88"}, +{file = "types_invoke-2.0.0.10-py3-none-any.whl", hash = "sha256:2404e4279601fa96e14ef68321fd10a660a828677aabdcaeef6a5189778084ef"}, +] + +[[package]] +name = "types-paramiko" +version = "3.5.0.20240928" +description = "Typing stubs for paramiko" +optional = false +python-versions = ">=3.8" +files = [ +{file = "types-paramiko-3.5.0.20240928.tar.gz", hash = "sha256:79dd9b2ee510b76a3b60d8ac1f3f348c45fcecf01347ca79e14db726bbfc442d"}, +{file = "types_paramiko-3.5.0.20240928-py3-none-any.whl", hash = "sha256:cda0aff4905fe8efe4b5448331a80e943d42a796bd4beb77a3eed3485bc96a85"}, +] + +[package.dependencies] +cryptography = ">=37.0.0" + [[package]] name = "types-pyyaml" version = "6.0.12.20240917" @@ -1270,4 +1295,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "416cab6effbb2848e872e2ced35bbfb4862722f1e96351ab0694f6fa2d919535" +content-hash = "ef76008e3c2578b03a4360ca1b7bbf394c4fc7abbbef46ac1d52a6de0ff9ba88" diff --git a/dts/pyproject.toml b/dts/pyproject.toml index 778586028e..c425e8c445 100644 --- a/dts/pyproject.toml +++ b/dts/pyproject.toml @@ -21,7 +21,6 @@ documentation = "https://doc.dpdk.org/guides/tools/dts.html"; [tool.poetry.dependencies] python = "^3.10" PyYAML = "^6.0" -types-PyYAML = "^6.0.8" fabric = "^2.7.1" scapy = "^2.6.1" typing-extensions = "^4.11.0" @@ -32,6 +31,9 @@ pydantic = "^2.9.2" mypy = "^1.13.0" toml = "^0.10.2" ruff = "^0.8.1" +types-paramiko = "^3.5.0.20240928" +types-invoke = "^2.0.0.10" +types-pyyaml = "^6.0.12.20240917" [tool.poetry.group.docs] optional = true -- 2.43.0
[PATCH 3/3] dts: resolve mypy type errors
The addition of scapy types yielded new errors in mypy, which could not previously be checked. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- .../interactive_remote_session.py | 4 ++-- .../single_active_interactive_shell.py| 2 +- dts/framework/remote_session/ssh_session.py | 4 ++-- dts/framework/test_suite.py | 20 +--- dts/framework/testbed_model/capability.py | 4 ++-- dts/framework/testbed_model/tg_node.py| 2 +- .../capturing_traffic_generator.py| 4 ++-- .../testbed_model/traffic_generator/scapy.py | 6 ++--- .../traffic_generator/traffic_generator.py| 2 +- dts/framework/utils.py| 6 ++--- dts/tests/TestSuite_checksum_offload.py | 24 +-- dts/tests/TestSuite_dynamic_queue_conf.py | 15 dts/tests/TestSuite_mac_filter.py | 6 ++--- dts/tests/TestSuite_pmd_buffer_scatter.py | 17 - dts/tests/TestSuite_vlan.py | 6 ++--- 15 files changed, 68 insertions(+), 54 deletions(-) diff --git a/dts/framework/remote_session/interactive_remote_session.py b/dts/framework/remote_session/interactive_remote_session.py index 4605ee14b4..509a284aaf 100644 --- a/dts/framework/remote_session/interactive_remote_session.py +++ b/dts/framework/remote_session/interactive_remote_session.py @@ -7,8 +7,8 @@ import traceback from typing import Union -from paramiko import AutoAddPolicy, SSHClient, Transport # type: ignore[import-untyped] -from paramiko.ssh_exception import ( # type: ignore[import-untyped] +from paramiko import AutoAddPolicy, SSHClient, Transport +from paramiko.ssh_exception import ( AuthenticationException, BadHostKeyException, NoValidConnectionsError, diff --git a/dts/framework/remote_session/single_active_interactive_shell.py b/dts/framework/remote_session/single_active_interactive_shell.py index 3539f634f9..c43c54e457 100644 --- a/dts/framework/remote_session/single_active_interactive_shell.py +++ b/dts/framework/remote_session/single_active_interactive_shell.py @@ -24,7 +24,7 @@ from pathlib import PurePath from typing import ClassVar -from paramiko import Channel, channel # type: ignore[import-untyped] +from paramiko import Channel, channel from typing_extensions import Self from framework.exception import ( diff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py index 329121913f..e6e4704bc2 100644 --- a/dts/framework/remote_session/ssh_session.py +++ b/dts/framework/remote_session/ssh_session.py @@ -8,12 +8,12 @@ from pathlib import Path, PurePath from fabric import Connection # type: ignore[import-untyped] -from invoke.exceptions import ( # type: ignore[import-untyped] +from invoke.exceptions import ( CommandTimedOut, ThreadException, UnexpectedExit, ) -from paramiko.ssh_exception import ( # type: ignore[import-untyped] +from paramiko.ssh_exception import ( AuthenticationException, BadHostKeyException, NoValidConnectionsError, diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 161bb10066..16012bfc79 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -26,9 +26,9 @@ from types import ModuleType from typing import ClassVar, Protocol, TypeVar, Union, cast -from scapy.layers.inet import IP # type: ignore[import-untyped] -from scapy.layers.l2 import Ether # type: ignore[import-untyped] -from scapy.packet import Packet, Padding, raw # type: ignore[import-untyped] +from scapy.layers.inet import IP +from scapy.layers.l2 import Ether +from scapy.packet import Packet, Padding, raw from typing_extensions import Self from framework.testbed_model.capability import TestProtocol @@ -322,7 +322,7 @@ def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> li """ ret_packets = [] for original_packet in packets: -packet = original_packet.copy() +packet: Packet = original_packet.copy() # update l2 addresses # If `expected` is :data:`True`, the packet enters the TG from SUT, otherwise the @@ -351,12 +351,13 @@ def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> li # Update the last IP layer if there are multiple (the framework should be modifying # the packet address instead of the tunnel address if there is one). l3_to_use = packet.getlayer(IP, num_ip_layers) +assert l3_to_use is not None if "src" not in l3_to_use.fields: l3_to_use.src = self._tg_ip_address_egress.ip.exploded if "dst" not in l3_to_use.fields: l3_to_use.dst = self._tg_ip_address_ingress.ip.exploded -ret_packets.append(Ether(packet.build())) +ret_packets.append(packet)
[PATCH v2 0/3] dts: enable types of Scapy
From: Luca Vizzarro Hi there, made a small mistake earlier... v2: - fixed typo in Paul's email Depends-on: series-34127 ("dts: add Ruff and docstring linting") Best regards, Luca Luca Vizzarro (3): dts: update dependencies dts: add missing type stubs dts: resolve mypy type errors .../interactive_remote_session.py |4 +- .../single_active_interactive_shell.py|2 +- dts/framework/remote_session/ssh_session.py |4 +- dts/framework/test_suite.py | 20 +- dts/framework/testbed_model/capability.py |4 +- dts/framework/testbed_model/tg_node.py|2 +- .../capturing_traffic_generator.py|4 +- .../testbed_model/traffic_generator/scapy.py |6 +- .../traffic_generator/traffic_generator.py|2 +- dts/framework/utils.py|6 +- dts/poetry.lock | 1283 + dts/pyproject.toml|8 +- dts/tests/TestSuite_checksum_offload.py | 24 +- dts/tests/TestSuite_dynamic_queue_conf.py | 15 +- dts/tests/TestSuite_mac_filter.py |6 +- dts/tests/TestSuite_pmd_buffer_scatter.py | 17 +- dts/tests/TestSuite_vlan.py |6 +- 17 files changed, 752 insertions(+), 661 deletions(-) -- 2.43.0
[PATCH v2 3/3] dts: resolve mypy type errors
From: Luca Vizzarro The addition of scapy types yielded new errors in mypy, which could not previously be checked. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- .../interactive_remote_session.py | 4 ++-- .../single_active_interactive_shell.py| 2 +- dts/framework/remote_session/ssh_session.py | 4 ++-- dts/framework/test_suite.py | 20 +--- dts/framework/testbed_model/capability.py | 4 ++-- dts/framework/testbed_model/tg_node.py| 2 +- .../capturing_traffic_generator.py| 4 ++-- .../testbed_model/traffic_generator/scapy.py | 6 ++--- .../traffic_generator/traffic_generator.py| 2 +- dts/framework/utils.py| 6 ++--- dts/tests/TestSuite_checksum_offload.py | 24 +-- dts/tests/TestSuite_dynamic_queue_conf.py | 15 dts/tests/TestSuite_mac_filter.py | 6 ++--- dts/tests/TestSuite_pmd_buffer_scatter.py | 17 - dts/tests/TestSuite_vlan.py | 6 ++--- 15 files changed, 68 insertions(+), 54 deletions(-) diff --git a/dts/framework/remote_session/interactive_remote_session.py b/dts/framework/remote_session/interactive_remote_session.py index 4605ee14b4..509a284aaf 100644 --- a/dts/framework/remote_session/interactive_remote_session.py +++ b/dts/framework/remote_session/interactive_remote_session.py @@ -7,8 +7,8 @@ import traceback from typing import Union -from paramiko import AutoAddPolicy, SSHClient, Transport # type: ignore[import-untyped] -from paramiko.ssh_exception import ( # type: ignore[import-untyped] +from paramiko import AutoAddPolicy, SSHClient, Transport +from paramiko.ssh_exception import ( AuthenticationException, BadHostKeyException, NoValidConnectionsError, diff --git a/dts/framework/remote_session/single_active_interactive_shell.py b/dts/framework/remote_session/single_active_interactive_shell.py index 3539f634f9..c43c54e457 100644 --- a/dts/framework/remote_session/single_active_interactive_shell.py +++ b/dts/framework/remote_session/single_active_interactive_shell.py @@ -24,7 +24,7 @@ from pathlib import PurePath from typing import ClassVar -from paramiko import Channel, channel # type: ignore[import-untyped] +from paramiko import Channel, channel from typing_extensions import Self from framework.exception import ( diff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py index 329121913f..e6e4704bc2 100644 --- a/dts/framework/remote_session/ssh_session.py +++ b/dts/framework/remote_session/ssh_session.py @@ -8,12 +8,12 @@ from pathlib import Path, PurePath from fabric import Connection # type: ignore[import-untyped] -from invoke.exceptions import ( # type: ignore[import-untyped] +from invoke.exceptions import ( CommandTimedOut, ThreadException, UnexpectedExit, ) -from paramiko.ssh_exception import ( # type: ignore[import-untyped] +from paramiko.ssh_exception import ( AuthenticationException, BadHostKeyException, NoValidConnectionsError, diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 161bb10066..16012bfc79 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -26,9 +26,9 @@ from types import ModuleType from typing import ClassVar, Protocol, TypeVar, Union, cast -from scapy.layers.inet import IP # type: ignore[import-untyped] -from scapy.layers.l2 import Ether # type: ignore[import-untyped] -from scapy.packet import Packet, Padding, raw # type: ignore[import-untyped] +from scapy.layers.inet import IP +from scapy.layers.l2 import Ether +from scapy.packet import Packet, Padding, raw from typing_extensions import Self from framework.testbed_model.capability import TestProtocol @@ -322,7 +322,7 @@ def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> li """ ret_packets = [] for original_packet in packets: -packet = original_packet.copy() +packet: Packet = original_packet.copy() # update l2 addresses # If `expected` is :data:`True`, the packet enters the TG from SUT, otherwise the @@ -351,12 +351,13 @@ def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> li # Update the last IP layer if there are multiple (the framework should be modifying # the packet address instead of the tunnel address if there is one). l3_to_use = packet.getlayer(IP, num_ip_layers) +assert l3_to_use is not None if "src" not in l3_to_use.fields: l3_to_use.src = self._tg_ip_address_egress.ip.exploded if "dst" not in l3_to_use.fields: l3_to_use.dst = self._tg_ip_address_ingress.ip.exploded -ret_packets.append(Ether(packet.build())) +ret_pa
[PATCH v2 2/3] dts: add missing type stubs
From: Luca Vizzarro The invoke and paramiko libraries were missing the type stubs. These are added under the dev dependencies as the only scope in which they are used is through mypy static checking. For the same reason, move the PyYAML subs under the dev dependencies. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/poetry.lock| 27 ++- dts/pyproject.toml | 4 +++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index 1eae7ea2fb..29f9a18cd6 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -1228,6 +1228,31 @@ files = [ {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] +[[package]] +name = "types-invoke" +version = "2.0.0.10" +description = "Typing stubs for invoke" +optional = false +python-versions = ">=3.7" +files = [ +{file = "types-invoke-2.0.0.10.tar.gz", hash = "sha256:a54d7ecdc19e0c22cd2786ef2e64c2631715c78eba8a1bf40b511d0608f33a88"}, +{file = "types_invoke-2.0.0.10-py3-none-any.whl", hash = "sha256:2404e4279601fa96e14ef68321fd10a660a828677aabdcaeef6a5189778084ef"}, +] + +[[package]] +name = "types-paramiko" +version = "3.5.0.20240928" +description = "Typing stubs for paramiko" +optional = false +python-versions = ">=3.8" +files = [ +{file = "types-paramiko-3.5.0.20240928.tar.gz", hash = "sha256:79dd9b2ee510b76a3b60d8ac1f3f348c45fcecf01347ca79e14db726bbfc442d"}, +{file = "types_paramiko-3.5.0.20240928-py3-none-any.whl", hash = "sha256:cda0aff4905fe8efe4b5448331a80e943d42a796bd4beb77a3eed3485bc96a85"}, +] + +[package.dependencies] +cryptography = ">=37.0.0" + [[package]] name = "types-pyyaml" version = "6.0.12.20240917" @@ -1270,4 +1295,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "416cab6effbb2848e872e2ced35bbfb4862722f1e96351ab0694f6fa2d919535" +content-hash = "ef76008e3c2578b03a4360ca1b7bbf394c4fc7abbbef46ac1d52a6de0ff9ba88" diff --git a/dts/pyproject.toml b/dts/pyproject.toml index 778586028e..c425e8c445 100644 --- a/dts/pyproject.toml +++ b/dts/pyproject.toml @@ -21,7 +21,6 @@ documentation = "https://doc.dpdk.org/guides/tools/dts.html"; [tool.poetry.dependencies] python = "^3.10" PyYAML = "^6.0" -types-PyYAML = "^6.0.8" fabric = "^2.7.1" scapy = "^2.6.1" typing-extensions = "^4.11.0" @@ -32,6 +31,9 @@ pydantic = "^2.9.2" mypy = "^1.13.0" toml = "^0.10.2" ruff = "^0.8.1" +types-paramiko = "^3.5.0.20240928" +types-invoke = "^2.0.0.10" +types-pyyaml = "^6.0.12.20240917" [tool.poetry.group.docs] optional = true -- 2.43.0
Re: [PATCH v8 17/47] net/bnxt: tf_ulp: support for Thor2 ulp layer
Hello, On Thu, Nov 7, 2024 at 3:09 PM Sriharsha Basavapatna wrote: > > From: Shuanglin Wang > > This patch includes the support for following features that enable > Thor2 support in the ULP layer: > > 1. Added support for ulp initialization on Thor2 platform. This involved > breaking the functionality that is common and not common between Thor and > Thor2 platforms. > 2. MPC support for Thor2. This feature enables the access of the DRAM > memory location in the HOST CPU for Exact match flows and Action records > for those flows. > 3. Added support for VF's on Thor2 platform. > 4. Added support to offload traffic between two VF's on the system. > 5. Renamed all BNXT_TF_DBG macros to BNXT_DRV_DBG. > 6. Added logic to get error conditions in the flow create path. > 7. Added support for Geneve header and set TTL action parsing. > 8. Add mpc batching to ulp flow create for Thor2. > > This patch also updates the template files for the changes > that are being added in this patch. > > Signed-off-by: Shuanglin Wang > Signed-off-by: Mike Baucom > Signed-off-by: Kishore Padmanabha > Signed-off-by: Manish Kurup > Signed-off-by: Sriharsha Basavapatna > Reviewed-by: Shahaji Bhosle > Reviewed-by: Randy Schacher > Reviewed-by: Ajit Khaparde It looks like the symbol ulp_class_sig_tbl was left behind. $ git grep ulp_class_sig_tbl dd0191d5e70d0e65a7f041a88af480fc673160e1 dd0191d5e70d0e65a7f041a88af480fc673160e1:drivers/net/bnxt/tf_ulp/ulp_template_struct.h:extern uint16_t ulp_class_sig_tbl[]; $ git grep ulp_class_sig_tbl dd0191d5e70d0e65a7f041a88af480fc673160e1^ dd0191d5e70d0e65a7f041a88af480fc673160e1^:drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c:uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = { dd0191d5e70d0e65a7f041a88af480fc673160e1^:drivers/net/bnxt/tf_ulp/ulp_matcher.c: tmpl_id = ulp_class_sig_tbl[class_hid]; dd0191d5e70d0e65a7f041a88af480fc673160e1^:drivers/net/bnxt/tf_ulp/ulp_template_struct.h:extern uint16_t ulp_class_sig_tbl[]; -- David Marchand
[PATCH 3/6] dts: fix docstring linter errors
The addition of Ruff pydocstyle and pydoclint rules has raised new problems in the docstrings which require to be fixed. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- .../single_active_interactive_shell.py| 11 +++- dts/framework/runner.py | 48 ++ dts/framework/settings.py | 6 +- dts/framework/test_suite.py | 43 ++--- dts/framework/testbed_model/capability.py | 33 -- dts/framework/testbed_model/cpu.py| 33 -- dts/framework/testbed_model/linux_session.py | 42 +--- dts/framework/testbed_model/node.py | 7 +- dts/framework/testbed_model/os_session.py | 14 ++-- dts/framework/testbed_model/posix_session.py | 64 ++- dts/framework/testbed_model/sut_node.py | 49 ++ dts/framework/testbed_model/topology.py | 10 ++- .../traffic_generator/__init__.py | 11 +++- .../testbed_model/traffic_generator/scapy.py | 10 ++- .../traffic_generator/traffic_generator.py| 3 +- dts/framework/utils.py| 38 --- dts/tests/TestSuite_vlan.py | 30 ++--- 17 files changed, 347 insertions(+), 105 deletions(-) diff --git a/dts/framework/remote_session/single_active_interactive_shell.py b/dts/framework/remote_session/single_active_interactive_shell.py index e3f6424e97..a53e8fc6e1 100644 --- a/dts/framework/remote_session/single_active_interactive_shell.py +++ b/dts/framework/remote_session/single_active_interactive_shell.py @@ -110,6 +110,7 @@ def __init__( app_params: The command line parameters to be passed to the application on startup. name: Name for the interactive shell to use for logging. This name will be appended to the name of the underlying node which it is running on. +**kwargs: Any additional arguments if any. """ self._node = node if name is None: @@ -120,10 +121,12 @@ def __init__( self._timeout = timeout # Ensure path is properly formatted for the host self._update_real_path(self.path) -super().__init__(node, **kwargs) +super().__init__() def _setup_ssh_channel(self): -self._ssh_channel = self._node.main_session.interactive_session.session.invoke_shell() +self._ssh_channel = ( +self._node.main_session.interactive_session.session.invoke_shell() +) self._stdin = self._ssh_channel.makefile_stdin("w") self._stdout = self._ssh_channel.makefile("r") self._ssh_channel.settimeout(self._timeout) @@ -133,7 +136,9 @@ def _make_start_command(self) -> str: """Makes the command that starts the interactive shell.""" start_command = f"{self._real_path} {self._app_params or ''}" if self._privileged: -start_command = self._node.main_session._get_privileged_command(start_command) +start_command = self._node.main_session._get_privileged_command( +start_command +) return start_command def _start_application(self) -> None: diff --git a/dts/framework/runner.py b/dts/framework/runner.py index f91c462ce5..d228ed1b18 100644 --- a/dts/framework/runner.py +++ b/dts/framework/runner.py @@ -136,17 +136,25 @@ def run(self) -> None: # for all test run sections for test_run_with_nodes_config in self._configuration.test_runs_with_nodes: -test_run_config, sut_node_config, tg_node_config = test_run_with_nodes_config +test_run_config, sut_node_config, tg_node_config = ( +test_run_with_nodes_config +) self._logger.set_stage(DtsStage.test_run_setup) -self._logger.info(f"Running test run with SUT '{sut_node_config.name}'.") +self._logger.info( +f"Running test run with SUT '{sut_node_config.name}'." +) self._init_random_seed(test_run_config) test_run_result = self._result.add_test_run(test_run_config) # we don't want to modify the original config, so create a copy test_run_test_suites = list( -SETTINGS.test_suites if SETTINGS.test_suites else test_run_config.test_suites +SETTINGS.test_suites +if SETTINGS.test_suites +else test_run_config.test_suites ) if not test_run_config.skip_smoke_tests: -test_run_test_suites[:0] = [TestSuiteConfig(test_suite="smoke_tests")] +test_run_test_suites[:0] = [ +TestSuiteConfig(test_suite="smoke_tests") +] try: test_suites_with_cases = self._get_test_suites_with_cases(
[PATCH 2/6] dts: enable Ruff preview pydoclint rules
DTS requires a linter for docstrings but the current selection is limited. The most promising docstring linter is pydoclint. On the other hand, Ruff is currently in the process of implementing pydoclint rules. This would spare the project from supporting yet another linter, without any loss of benefit. This commit enables a selection of pydoclint rules in Ruff, which while still in preview they are already capable of aiding the process. DOC201 was omitted because it currently does not support one-line docstrings, trying to enforce full ones even when not needed. DOC502 was omitted because it complains for exceptions that were reported but not present in the body of the function. While treating documented exceptions when they appear to not be raised as an error is a sound argument, it currently doesn't work well with inherited class methods, which parent does raise exceptions. Bugzilla ID: 1455 Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/pyproject.toml | 4 1 file changed, 4 insertions(+) diff --git a/dts/pyproject.toml b/dts/pyproject.toml index 3436d82116..2658a3d22c 100644 --- a/dts/pyproject.toml +++ b/dts/pyproject.toml @@ -65,7 +65,11 @@ select = [ "D", # pydocstyle "C90",# mccabe "I", # isort +# pydoclint +"DOC202", "DOC402", "DOC403", "DOC501" ] +preview = true # enable to get early access to pydoclint rules +explicit-preview-rules = true # enable ONLY the explicitly selected preview rules [tool.ruff.lint.pydocstyle] convention = "google" -- 2.43.0
[PATCH 0/6] dts: add Ruff and docstring linting
Hi there, sending a new patchset to cover the replacement of all the current linters with Ruff. The configuration of Ruff was attempted to be 1:1, but there are slight differences meaning that Ruff did not purposely implement all the rules. Either way, at the moment it should be a near perfect match and satisfy our requirements. I've also took the chance to enable some new docstring linting rules which mimic the new pydoclint project. Best, Luca Luca Vizzarro (6): dts: add Ruff as linter and formatter dts: enable Ruff preview pydoclint rules dts: fix docstring linter errors dts: apply Ruff formatting dts: update dts-check-format to use Ruff dts: remove old linters and formatters devtools/dts-check-format.sh | 30 +-- dts/framework/params/eal.py | 5 +- dts/framework/remote_session/dpdk_shell.py| 1 - dts/framework/remote_session/python_shell.py | 1 + .../single_active_interactive_shell.py| 3 +- dts/framework/runner.py | 14 +- dts/framework/settings.py | 3 + dts/framework/test_suite.py | 6 +- dts/framework/testbed_model/capability.py | 13 +- dts/framework/testbed_model/cpu.py| 21 +- dts/framework/testbed_model/linux_session.py | 6 +- dts/framework/testbed_model/node.py | 3 + dts/framework/testbed_model/os_session.py | 3 +- dts/framework/testbed_model/port.py | 1 - dts/framework/testbed_model/posix_session.py | 16 +- dts/framework/testbed_model/sut_node.py | 2 +- dts/framework/testbed_model/topology.py | 6 + .../traffic_generator/__init__.py | 3 + .../testbed_model/traffic_generator/scapy.py | 7 +- .../traffic_generator/traffic_generator.py| 3 +- dts/framework/utils.py| 6 +- dts/poetry.lock | 197 +++--- dts/pyproject.toml| 40 ++-- dts/tests/TestSuite_vlan.py | 22 +- 24 files changed, 172 insertions(+), 240 deletions(-) -- 2.43.0
[PATCH 1/6] dts: add Ruff as linter and formatter
To improve and streamline the development process, Ruff presents itself as a very fast all-in-one linter that is able to apply fixes and formatter compatible with Black. Ruff implements all the rules that DTS currently use and expands on them, leaving space to easily enable more checks in the future. Bugzilla ID: 1358 Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/poetry.lock| 29 - dts/pyproject.toml | 20 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index ee564676b4..aa821f0101 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -1073,6 +1073,33 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "ruff" +version = "0.8.1" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ +{file = "ruff-0.8.1-py3-none-linux_armv6l.whl", hash = "sha256:fae0805bd514066f20309f6742f6ee7904a773eb9e6c17c45d6b1600ca65c9b5"}, +{file = "ruff-0.8.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b8a4f7385c2285c30f34b200ca5511fcc865f17578383db154e098150ce0a087"}, +{file = "ruff-0.8.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:cd054486da0c53e41e0086e1730eb77d1f698154f910e0cd9e0d64274979a209"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2029b8c22da147c50ae577e621a5bfbc5d1fed75d86af53643d7a7aee1d23871"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2666520828dee7dfc7e47ee4ea0d928f40de72056d929a7c5292d95071d881d1"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:333c57013ef8c97a53892aa56042831c372e0bb1785ab7026187b7abd0135ad5"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:288326162804f34088ac007139488dcb43de590a5ccfec3166396530b58fb89d"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b12c39b9448632284561cbf4191aa1b005882acbc81900ffa9f9f471c8ff7e26"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:364e6674450cbac8e998f7b30639040c99d81dfb5bbc6dfad69bc7a8f916b3d1"}, +{file = "ruff-0.8.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b22346f845fec132aa39cd29acb94451d030c10874408dbf776af3aaeb53284c"}, +{file = "ruff-0.8.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b2f2f7a7e7648a2bfe6ead4e0a16745db956da0e3a231ad443d2a66a105c04fa"}, +{file = "ruff-0.8.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:adf314fc458374c25c5c4a4a9270c3e8a6a807b1bec018cfa2813d6546215540"}, +{file = "ruff-0.8.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a885d68342a231b5ba4d30b8c6e1b1ee3a65cf37e3d29b3c74069cdf1ee1e3c9"}, +{file = "ruff-0.8.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d2c16e3508c8cc73e96aa5127d0df8913d2290098f776416a4b157657bee44c5"}, +{file = "ruff-0.8.1-py3-none-win32.whl", hash = "sha256:93335cd7c0eaedb44882d75a7acb7df4b77cd7cd0d2255c93b28791716e81790"}, +{file = "ruff-0.8.1-py3-none-win_amd64.whl", hash = "sha256:2954cdbe8dfd8ab359d4a30cd971b589d335a44d444b6ca2cb3d1da21b75e4b6"}, +{file = "ruff-0.8.1-py3-none-win_arm64.whl", hash = "sha256:55873cc1a473e5ac129d15eccb3c008c096b94809d693fc7053f588b67822737"}, +{file = "ruff-0.8.1.tar.gz", hash = "sha256:3583db9a6450364ed5ca3f3b4225958b24f78178908d5c4bc0f46251ccca898f"}, +] + [[package]] name = "scapy" version = "2.5.0" @@ -1361,4 +1388,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "fe9a9fdf7b43e8dce2fb5ee600921d4047fef2f4037a78bbd150f71df202493e" +content-hash = "5f9b61492d95b09c717325396e981bb526fac9b0c16869f1aebc3a57b7b80e49" diff --git a/dts/pyproject.toml b/dts/pyproject.toml index f69c70877a..3436d82116 100644 --- a/dts/pyproject.toml +++ b/dts/pyproject.toml @@ -36,6 +36,7 @@ isort = "^5.10.1" pylama = "^8.4.1" pyflakes = "^2.5.0" toml = "^0.10.2" +ruff = "^0.8.1" [tool.poetry.group.docs] optional = true @@ -50,6 +51,25 @@ autodoc-pydantic = "^2.2.0" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" +[tool.ruff] +target-version = "py310" +line-length = 100 + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +select = [ +"F", # pyflakes +"E", "W", # pycodestyle +"D", # pydocstyle +"C90",# mccabe +"I", # isort +] + +[tool.ruff.lint.pydocstyle] +convention = "google" + [tool.pylama] linters = "mccabe,pycodestyle,pydocstyle,pyflakes" format = "pylint" -- 2.43.0
[PATCH] devtools: enhance the license check
Reformat the license/exceptions.txt file to make it easier to build a list of exempted files. Display all files committed in DPDK that are non compliant with BSD-3 license. Signed-off-by: David Marchand --- devtools/check-spdx-tag.sh | 59 +++--- license/exceptions.txt | 11 --- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh index b983268b1e..f893003af6 100755 --- a/devtools/check-spdx-tag.sh +++ b/devtools/check-spdx-tag.sh @@ -4,7 +4,8 @@ # # Produce a list of files with incorrect license tags -errors=0 +missing_spdx=0 +wrong_license=0 warnings=0 quiet=false verbose=false @@ -14,23 +15,44 @@ print_usage () { exit 1 } +no_license_list=\ +':^.git* :^.mailmap :^.ci/* :^README :^MAINTAINERS :^VERSION :^ABI_VERSION :^*/Kbuild '\ +':^*/README* :^license/ :^config/ :^buildtools/ :^*/poetry.lock '\ +':^kernel/linux/uapi/.gitignore :^kernel/linux/uapi/version :^*.cocci :^*.abignore '\ +':^*.map :^*.ini :^*.data :^*.json :^*.cfg :^*.txt :^*.svg :^*.png' + check_spdx() { -if $verbose; then +if $verbose ; then echo "Files without SPDX License" echo "--" fi -git grep -L SPDX-License-Identifier -- \ - ':^.git*' ':^.mailmap' ':^.ci/*' \ - ':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \ - ':^*/Kbuild' ':^*/README*' \ - ':^license/' ':^config/' ':^buildtools/' ':^*/poetry.lock' \ - ':^kernel/linux/uapi/.gitignore' ':^kernel/linux/uapi/version' \ - ':^*.cocci' ':^*.abignore' \ - ':^*.map' ':^*.ini' ':^*.data' ':^*.json' ':^*.cfg' ':^*.txt' \ - ':^*.svg' ':^*.png' \ - > $tmpfile - -errors=$(wc -l < $tmpfile) +git grep -L SPDX-License-Identifier -- $no_license_list > $tmpfile + +missing_spdx=$(wc -l < $tmpfile) +$quiet || cat $tmpfile +} + +build_exceptions_list() { +grep '.*|.*|.*|.*' license/exceptions.txt | grep -v 'TB Approval Date' | +while IFS='|' read license tb_date gb_date pattern ; do +unset IFS +license=${license## *} +license=${license%% *} +git grep -l "SPDX-License-Identifier:[[:space:]]*$license" $pattern | +sed -e 's/^/:^/' +done +} + +check_licenses() { +if $verbose ; then + echo "Files with wrong license and no exception" + echo "-" +fi +exceptions=$(build_exceptions_list) +git grep -l SPDX-License-Identifier: -- $no_license_list $exceptions | +xargs grep -L -E 'SPDX-License-Identifier:[[:space:]]*\(?BSD-3-Clause' > $tmpfile + +wrong_license=$(wc -l < $tmpfile) $quiet || cat $tmpfile } @@ -64,8 +86,11 @@ trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT check_spdx $quiet || echo -check_boilerplate +check_licenses +$quiet || echo +check_boilerplate $quiet || echo -echo "total: $errors errors, $warnings warnings" -exit $errors + +echo "total: $missing_spdx missing SPDX errors, $wrong_license license errors, $warnings warnings" +exit $((missing_spdx + wrong_license)) diff --git a/license/exceptions.txt b/license/exceptions.txt index 1ded290eee..d12fac2034 100644 --- a/license/exceptions.txt +++ b/license/exceptions.txt @@ -10,11 +10,10 @@ Note that following licenses are not exceptions:- - GPL-2.0 (*Only for kernel code*) --- -SPDX Identifier TB Approval Date GB Approval Date File name +SPDX Identifier | TB Approval Date | GB Approval Date | File name --- -1.MIT 10/23/201902/10/2020 lib/eal/windows/include/dirent.h -2.BSD-2-Clause 10/23/201912/18/2019 lib/eal/windows/include/getopt.h -3.ISC AND - BSD-2-Clause 10/23/201912/18/2019 lib/eal/windows/getopt.c -4. MIT 10/19/202210/18/2022drivers/net/gve/base/* +MIT | 10/23/2019 | 02/10/2020 | lib/eal/windows/include/dirent.h +BSD-2-Clause | 10/23/2019 | 12/18/2019 | lib/eal/windows/include/getopt.h +ISC AND BSD-2-Clause | 10/23/2019 | 12/18/2019 | lib/eal/windows/getopt.c +MIT | 10/19/2022 | 10/18/2022 | drivers/net/gve/base/* --- -- 2.47.0
[PATCH 4/6] dts: apply Ruff formatting
While Ruff formatting is Black-compatible and is near-identical, it still requires formatting for a small set of elements. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/framework/params/eal.py | 5 +- dts/framework/remote_session/dpdk_shell.py| 1 - dts/framework/remote_session/python_shell.py | 1 + .../single_active_interactive_shell.py| 8 +-- dts/framework/runner.py | 36 -- dts/framework/settings.py | 5 +- dts/framework/test_suite.py | 37 -- dts/framework/testbed_model/capability.py | 20 ++-- dts/framework/testbed_model/cpu.py| 28 --- dts/framework/testbed_model/linux_session.py | 36 -- dts/framework/testbed_model/node.py | 4 +- dts/framework/testbed_model/os_session.py | 13 ++--- dts/framework/testbed_model/port.py | 1 - dts/framework/testbed_model/posix_session.py | 48 +- dts/framework/testbed_model/sut_node.py | 49 +-- dts/framework/testbed_model/topology.py | 4 +- .../traffic_generator/__init__.py | 8 +-- .../testbed_model/traffic_generator/scapy.py | 5 +- dts/framework/utils.py| 32 +++- dts/tests/TestSuite_vlan.py | 8 +-- 20 files changed, 90 insertions(+), 259 deletions(-) diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py index 71bc781eab..b90ff33dcf 100644 --- a/dts/framework/params/eal.py +++ b/dts/framework/params/eal.py @@ -27,10 +27,7 @@ class EalParams(Params): no_pci: Switch to disable PCI bus, e.g.: ``no_pci=True``. vdevs: Virtual devices, e.g.:: -vdevs=[ -VirtualDevice('net_ring0'), -VirtualDevice('net_ring1') -] +vdevs = [VirtualDevice("net_ring0"), VirtualDevice("net_ring1")] ports: The list of ports to allow. other_eal_param: user defined DPDK EAL parameters, e.g.:: diff --git a/dts/framework/remote_session/dpdk_shell.py b/dts/framework/remote_session/dpdk_shell.py index 82fa4755f0..c11d9ab81c 100644 --- a/dts/framework/remote_session/dpdk_shell.py +++ b/dts/framework/remote_session/dpdk_shell.py @@ -6,7 +6,6 @@ Provides a base class to create interactive shells based on DPDK. """ - from abc import ABC from pathlib import PurePath diff --git a/dts/framework/remote_session/python_shell.py b/dts/framework/remote_session/python_shell.py index 953ed100df..9d4abab12c 100644 --- a/dts/framework/remote_session/python_shell.py +++ b/dts/framework/remote_session/python_shell.py @@ -6,6 +6,7 @@ Typical usage example in a TestSuite:: from framework.remote_session import PythonShell + python_shell = PythonShell(self.tg_node, timeout=5, privileged=True) python_shell.send_command("print('Hello World')") python_shell.close() diff --git a/dts/framework/remote_session/single_active_interactive_shell.py b/dts/framework/remote_session/single_active_interactive_shell.py index a53e8fc6e1..3539f634f9 100644 --- a/dts/framework/remote_session/single_active_interactive_shell.py +++ b/dts/framework/remote_session/single_active_interactive_shell.py @@ -124,9 +124,7 @@ def __init__( super().__init__() def _setup_ssh_channel(self): -self._ssh_channel = ( -self._node.main_session.interactive_session.session.invoke_shell() -) +self._ssh_channel = self._node.main_session.interactive_session.session.invoke_shell() self._stdin = self._ssh_channel.makefile_stdin("w") self._stdout = self._ssh_channel.makefile("r") self._ssh_channel.settimeout(self._timeout) @@ -136,9 +134,7 @@ def _make_start_command(self) -> str: """Makes the command that starts the interactive shell.""" start_command = f"{self._real_path} {self._app_params or ''}" if self._privileged: -start_command = self._node.main_session._get_privileged_command( -start_command -) +start_command = self._node.main_session._get_privileged_command(start_command) return start_command def _start_application(self) -> None: diff --git a/dts/framework/runner.py b/dts/framework/runner.py index d228ed1b18..510be1a870 100644 --- a/dts/framework/runner.py +++ b/dts/framework/runner.py @@ -136,25 +136,17 @@ def run(self) -> None: # for all test run sections for test_run_with_nodes_config in self._configuration.test_runs_with_nodes: -test_run_config, sut_node_config, tg_node_config = ( -test_run_with_nodes_config -) +test_run_config, sut_node_config, tg_node_config = test_run_with_nodes_config self._logger.set_stage(DtsStage.test_run_setup) -self._logger.info( -f"
[PATCH 6/6] dts: remove old linters and formatters
Since the addition of Ruff, all the previously used linters and formatters are no longer used, therefore remove. Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/poetry.lock| 170 + dts/pyproject.toml | 24 --- 2 files changed, 1 insertion(+), 193 deletions(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index aa821f0101..a53bbe03b8 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -108,40 +108,6 @@ files = [ tests = ["pytest (>=3.2.1,!=3.3.0)"] typecheck = ["mypy"] -[[package]] -name = "black" -version = "22.12.0" -description = "The uncompromising code formatter." -optional = false -python-versions = ">=3.7" -files = [ -{file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, -{file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, -{file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, -{file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, -{file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, -{file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, -{file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, -{file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, -{file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, -{file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, -{file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, -{file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, -] - -[package.dependencies] -click = ">=8.0.0" -mypy-extensions = ">=0.4.3" -pathspec = ">=0.9.0" -platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - [[package]] name = "certifi" version = "2023.7.22" @@ -328,20 +294,6 @@ files = [ {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, ] -[[package]] -name = "click" -version = "8.1.6" -description = "Composable command line interface toolkit" -optional = false -python-versions = ">=3.7" -files = [ -{file = "click-8.1.6-py3-none-any.whl", hash = "sha256:fa244bb30b3b5ee2cae3da8f55c9e5e0c0e86093306301fb418eb9dc40fbded5"}, -{file = "click-8.1.6.tar.gz", hash = "sha256:48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - [[package]] name = "colorama" version = "0.4.6" @@ -462,23 +414,6 @@ files = [ {file = "invoke-1.7.3.tar.gz", hash = "sha256:41b428342d466a82135d5ab37119685a989713742be46e42a3a399d685579314"}, ] -[[package]] -name = "isort" -version = "5.12.0" -description = "A Python utility / library to sort Python imports." -optional = false -python-versions = ">=3.8.0" -files = [ -{file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, -{file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, -] - -[package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] - [[package]] name = "jinja2" version = "3.1.2" @@ -565,17 +500,6 @@ files = [ {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] -[[package]] -name = "mccabe" -version = "0.7.0" -description = "McCabe checker, plugin for flake8" -optional = false -python-versions = ">=3.6" -files = [ -{file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6
[PATCH 5/6] dts: update dts-check-format to use Ruff
Replace the current linters and formatter in favour of Ruff in the dts-check-format tool. Bugzilla ID: 1358 Bugzilla ID: 1455 Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- devtools/dts-check-format.sh | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh index 3f43e17e88..44501f6d3b 100755 --- a/devtools/dts-check-format.sh +++ b/devtools/dts-check-format.sh @@ -52,18 +52,11 @@ if $format; then if command -v git > /dev/null; then if git rev-parse --is-inside-work-tree >&-; then heading "Formatting in $directory/" - if command -v black > /dev/null; then - echo "Formatting code with black:" - black . + if command -v ruff > /dev/null; then + echo "Formatting code with ruff:" + ruff format else - echo "black is not installed, not formatting" - errors=$((errors + 1)) - fi - if command -v isort > /dev/null; then - echo "Sorting imports with isort:" - isort . - else - echo "isort is not installed, not sorting imports" + echo "ruff is not installed, not formatting" errors=$((errors + 1)) fi @@ -89,11 +82,18 @@ if $lint; then echo fi heading "Linting in $directory/" - if command -v pylama > /dev/null; then - pylama . - errors=$((errors + $?)) + if command -v ruff > /dev/null; then + ruff check --fix + + git update-index --refresh + retval=$? + if [ $retval -ne 0 ]; then + echo 'The "needs update" files have been fixed by the linter.' + echo 'Please update your commit.' + fi + errors=$((errors + retval)) else - echo "pylama not found, unable to run linter" + echo "ruff not found, unable to run linter" errors=$((errors + 1)) fi fi -- 2.43.0
Re: [PATCH 0/3] Defer lcore variables allocation
On 2024-12-09 18:40, David Marchand wrote: On Mon, Dec 9, 2024 at 4:39 PM Mattias Rönnblom wrote: On 2024-12-09 12:03, David Marchand wrote: On Fri, Dec 6, 2024 at 12:02 PM Mattias Rönnblom wrote: On 2024-12-05 18:57, David Marchand wrote: As I had reported in rc2, the lcore variables allocation have a noticeable impact on applications consuming DPDK, even when such applications does not use DPDK, or use features associated to some lcore variables. While the amount has been reduced in a rush before rc2, there are still cases when the increased memory footprint is noticed like in scaling tests. See https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/2090931 What this bug report fails to mention is that it only affects applications using locked memory. - By locked memory, are you referring to mlock() and friends? No ovsdb binary calls them, only the datapath cares about mlocking. - At a minimum, I understand the lcore var change introduced an increase in memory of 4kB * 128 (getpagesize() * RTE_MAX_LCORES), since lcore_var_alloc() calls memset() of the lcore var size, for every lcore. Yes, that is my understanding. It's also consistent with the measurements I've posted on this list. In this unit test where 1000 processes are kept alive in parallel, this means memory consumption increased by 512k * 1000, so ~500M at least. This amount of memory is probably significant in a resource-restrained env like a (Ubuntu) CI. I wouldn't expect thousands of concurrent processes in a resource-constrained system. Sounds wasteful indeed. But sure, there may well be scenarios where this make sense. - I went and traced this unit tests on my laptop by monitoring kmem:mm_page_alloc, though there may be a better metrics when it comes to memory consumption. # dir=build; perf stat -e kmem:mm_page_alloc -- tests/testsuite -C $dir/tests AUTOTEST_PATH=$dir/utilities:$dir/vswitchd:$dir/ovsdb:$dir/vtep:$dir/tests:$dir/ipsec:: 2154 Which gives: - 1 635 489 kmem:mm_page_alloc for v23.11 - 5 777 043 kmem:mm_page_alloc for v24.11 Interesting. What is vm.overcommit_memory set to? # cat /proc/sys/vm/overcommit_memory 0 And I am not sure what is being used in Ubuntu CI. But the problem is, in the end, simpler. [snip] There is a 4M difference, where I would expect 128k. So something more happens, than a simple page allocation per lcore, though I fail to understand what. Isolating the perf events for one process of this huge test, I counted 4878 page alloc calls. From them, 4108 had rte_lcore_var_alloc in their calling stack which is unexpected. After spending some time reading glibc, I noticed alloc_perturb(). *bingo*, I remembered that OVS unit tests are run with MALLOC_PERTURB_ (=165 after double checking OVS sources). """ Tunable: glibc.malloc.perturb This tunable supersedes the MALLOC_PERTURB_ environment variable and is identical in features. If set to a non-zero value, memory blocks are initialized with values depending on some low order bits of this tunable when they are allocated (except when allocated by calloc) and freed. This can be used to debug the use of uninitialized or freed heap memory. Note that this option does not guarantee that the freed block will have any specific values. It only guarantees that the content the block had before it was freed will be overwritten. The default value of this tunable is ‘0’. """ OK, excellent work, detective. :) Do have a workaround for this issue, so that this test suite will work with vanilla DPDK 24.11? I guess OVS wants to keep the PERTURB settings. The fix you've suggested will solve this issue for the no-DPDK-usage case. I'm guessing allocating the first lcore var block off of the BSS (e.g., via a static variable) would as well, in addition to solving similar cases but where there is "light" DPDK usage (i.e., rte_eal_init() is called, but with no real app). Now, reproducing this out of the test: $ perf stat -e kmem:mm_page_alloc -- ./build/ovsdb/ovsdb-client --help /dev/null Performance counter stats for './build/ovsdb/ovsdb-client --help': 810 kmem:mm_page_alloc 0,003277941 seconds time elapsed 0,00326 seconds user 0,0 seconds sys $ MALLOC_PERTURB_=165 perf stat -e kmem:mm_page_alloc -- ./build/ovsdb/ovsdb-client --help >/dev/null Performance counter stats for './build/ovsdb/ovsdb-client --help': 4 789 kmem:mm_page_alloc 0,008766171 seconds time elapsed 0,000976000 seconds user 0,007794000 seconds sys So the issue is not triggered by mlock'd memory, but by the whole buffer of 16M for lcore variables being touched by a glibc debugging feature. > And in Ubuntu CI, it translated to requesting 16G. Btw, just focusing on lcore var, I did two more tests: - 1 606 998 kmem:mm_page_alloc for v24.11 + revert all lcore var changes. - 1 634 606 kmem:mm_page_alloc for v24.11 + current series with postpone
[PATCH v2] MAINTAINERS: change maintainer for next-net
Change of maintainers for next-net tree. Signed-off-by: Stephen Hemminger Acked-by: Ferruh Yigit --- MAINTAINERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 60bdcce543..0f940ad713 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -28,8 +28,7 @@ M: David Marchand T: git://dpdk.org/dpdk Next-net Tree -M: Ferruh Yigit -M: Andrew Rybchenko +M: Stephen Hemminger T: git://dpdk.org/next/dpdk-next-net Next-net-brcm Tree -- 2.45.2
[RFC 0/8] ioring: network driver
This is first draft of new simplified TAP device that uses the Linux kernel ioring API to provide a read/write ring with kernel. This is split from tap device because there are so many unnecessary things in existing tap, and supporting ioring is better without ifdefs etc. The default name of the tap device is different that other uses in DPDK but the driver tries to keep the same relevant devargs as before. This driver will only provide features that match what kernel does, so no flow support etc. The next version will add checksum and multi-segment packets. Some of the doc files may need update as well. Stephen Hemminger (8): net/ioring: introduce new driver net/ioring: implement link state net/ioring: implement control functions net/ioring: implement management functions net/ioring: implement primary secondary fd passing net/ioring: implement receive and transmit net/ioring: add VLAN support net/ioring: implement statistics doc/guides/nics/features/ioring.ini | 14 + doc/guides/nics/index.rst |1 + doc/guides/nics/ioring.rst | 66 ++ drivers/net/ioring/meson.build | 12 + drivers/net/ioring/rte_eth_ioring.c | 1067 +++ drivers/net/meson.build |1 + 6 files changed, 1161 insertions(+) create mode 100644 doc/guides/nics/features/ioring.ini create mode 100644 doc/guides/nics/ioring.rst create mode 100644 drivers/net/ioring/meson.build create mode 100644 drivers/net/ioring/rte_eth_ioring.c -- 2.45.2
[RFC 1/8] net/ioring: introduce new driver
Add basic driver initialization, documentation, and device creation and basic documentation. Signed-off-by: Stephen Hemminger --- doc/guides/nics/features/ioring.ini | 9 + doc/guides/nics/index.rst | 1 + doc/guides/nics/ioring.rst | 66 +++ drivers/net/ioring/meson.build | 12 ++ drivers/net/ioring/rte_eth_ioring.c | 262 drivers/net/meson.build | 1 + 6 files changed, 351 insertions(+) create mode 100644 doc/guides/nics/features/ioring.ini create mode 100644 doc/guides/nics/ioring.rst create mode 100644 drivers/net/ioring/meson.build create mode 100644 drivers/net/ioring/rte_eth_ioring.c diff --git a/doc/guides/nics/features/ioring.ini b/doc/guides/nics/features/ioring.ini new file mode 100644 index 00..c4c57caaa4 --- /dev/null +++ b/doc/guides/nics/features/ioring.ini @@ -0,0 +1,9 @@ +; +; Supported features of the 'ioring' driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux = Y +x86-64 = Y +Usage doc= Y diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst index 50688d9f64..e4d243622e 100644 --- a/doc/guides/nics/index.rst +++ b/doc/guides/nics/index.rst @@ -41,6 +41,7 @@ Network Interface Controller Drivers igc intel_vf ionic +ioring ipn3ke ixgbe mana diff --git a/doc/guides/nics/ioring.rst b/doc/guides/nics/ioring.rst new file mode 100644 index 00..7d37a6bb37 --- /dev/null +++ b/doc/guides/nics/ioring.rst @@ -0,0 +1,66 @@ +.. SPDX-License-Identifier: BSD-3-Clause + +IORING Poll Mode Driver +=== + +The IORING Poll Mode Driver (PMD) is a simplified and improved version of the TAP PMD. It is a +virtual device that uses Linux ioring to inject packets into the Linux kernel. +It is useful when writing DPDK applications, that need to support interaction +with the Linux TCP/IP stack for control plane or tunneling. + +The IORING PMD creates a kernel network device that can be +managed by standard tools such as ``ip`` and ``ethtool`` commands. + +From a DPDK application, the IORING device looks like a DPDK ethdev. +It supports the standard DPDK API's to query for information, statistics, +and send/receive packets. + +Requirements + + +The IORING requires the io_uring library (liburing) which provides the helper +functions to manage io_uring with the kernel. + +For more info on io_uring, please see: + +https://kernel.dk/io_uring.pdf + + +Arguments +- + +IORING devices are created with the command line ``--vdev=net_ioring0`` option. +This option may be specified more than once by repeating with a different ``net_ioringX`` device. + +By default, the Linux interfaces are named ``enio0``, ``enio1``, etc. +The interface name can be specified by adding the ``iface=foo0``, for example:: + + --vdev=net_ioring0,iface=io0 --vdev=net_ioring1,iface=io1, ... + +The PMD inherits the MAC address assigned by the kernel which will be +a locally assigned random Ethernet address. + +Normally, when the DPDK application exits, the IORING device is removed. +But this behavior can be overridden by the use of the persist flag, example:: + + --vdev=net_ioring0,iface=io0,persist ... + + +Multi-process sharing +- + +The IORING device does not support secondary process (yet). + + +Limitations +--- + +- IO uring requires io_uring support. This was add in Linux kernl version 5.1 + Also, IO uring maybe disabled in some environments or by security policies. + +- Since IORING device uses a file descriptor to talk to the kernel, + the same number of queues must be specified for receive and transmit. + +- No flow support. Receive queue selection for incoming packets is determined + by the Linux kernel. See kernel documentation for more info: + https://www.kernel.org/doc/html/latest/networking/scaling.html diff --git a/drivers/net/ioring/meson.build b/drivers/net/ioring/meson.build new file mode 100644 index 00..198063e51f --- /dev/null +++ b/drivers/net/ioring/meson.build @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Stephen Hemminger + +if not is_linux +build = false +reason = 'only supported on Linux' +endif + +ext_deps += dependency('liburing', required:true) + +sources = files('rte_eth_ioring.c') +require_iova_in_mbuf = false diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c new file mode 100644 index 00..7b62c47f54 --- /dev/null +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -0,0 +1,262 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) Stephen Hemminger + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IORING_DEFAULT
[RFC 6/8] net/ioring: implement receive and transmit
Use io_uring to read and write from TAP device. Signed-off-by: Stephen Hemminger --- drivers/net/ioring/rte_eth_ioring.c | 364 +++- 1 file changed, 363 insertions(+), 1 deletion(-) diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index ddef57adfb..fa79bc5667 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -2,6 +2,7 @@ * Copyright (c) Stephen Hemminger */ +#include #include #include #include @@ -9,8 +10,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -27,6 +30,13 @@ #include #include +#define IORING_DEFAULT_BURST 64 +#define IORING_NUM_BUFFERS 1024 +#define IORING_MAX_QUEUES 128 + + +static_assert(IORING_MAX_QUEUES <= RTE_MP_MAX_FD_NUM, "Max queues exceeds MP fd limit"); + #define IORING_DEFAULT_IFNAME "enio%d" #define IORING_MP_KEY "ioring_mp_send_fds" @@ -34,6 +44,20 @@ RTE_LOG_REGISTER_DEFAULT(ioring_logtype, NOTICE); #define RTE_LOGTYPE_IORING ioring_logtype #define PMD_LOG(level, ...) RTE_LOG_LINE_PREFIX(level, IORING, "%s(): ", __func__, __VA_ARGS__) +#ifdef RTE_ETHDEV_DEBUG_RX +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IORING, "%s() rx: ", __func__, __VA_ARGS__) +#else +#define PMD_RX_LOG(...) do { } while (0) +#endif + +#ifdef RTE_ETHDEV_DEBUG_TX +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IORING, "%s() tx: ", __func__, __VA_ARGS__) +#else +#define PMD_TX_LOG(...) do { } while (0) +#endif + #define IORING_IFACE_ARG "iface" #define IORING_PERSIST_ARG "persist" @@ -43,6 +67,30 @@ static const char * const valid_arguments[] = { NULL }; +struct rx_queue { + struct rte_mempool *mb_pool;/* rx buffer pool */ + struct io_uring io_ring;/* queue of posted read's */ + uint16_t port_id; + uint16_t queue_id; + + uint64_t rx_packets; + uint64_t rx_bytes; + uint64_t rx_nombuf; + uint64_t rx_errors; +}; + +struct tx_queue { + struct io_uring io_ring; + + uint16_t port_id; + uint16_t queue_id; + uint16_t free_thresh; + + uint64_t tx_packets; + uint64_t tx_bytes; + uint64_t tx_errors; +}; + struct pmd_internals { int keep_fd;/* keep alive file descriptor */ char ifname[IFNAMSIZ]; /* name assigned by kernel */ @@ -300,6 +348,15 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->if_index = if_nametoindex(pmd->ifname); dev_info->max_mac_addrs = 1; dev_info->max_rx_pktlen = RTE_ETHER_MAX_LEN; + dev_info->max_rx_queues = IORING_MAX_QUEUES; + dev_info->max_tx_queues = IORING_MAX_QUEUES; + dev_info->min_rx_bufsize = 0; + + dev_info->default_rxportconf = (struct rte_eth_dev_portconf) { + .burst_size = IORING_DEFAULT_BURST, + .ring_size = IORING_NUM_BUFFERS, + .nb_queues = 1, + }; return 0; } @@ -311,6 +368,14 @@ eth_dev_close(struct rte_eth_dev *dev) PMD_LOG(INFO, "Closing %s", pmd->ifname); + int *fds = dev->process_private; + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + if (fds[i] == -1) + continue; + close(fds[i]); + fds[i] = -1; + } + if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -324,6 +389,296 @@ eth_dev_close(struct rte_eth_dev *dev) return 0; } +/* Setup another fd to TAP device for the queue */ +static int +eth_queue_setup(struct rte_eth_dev *dev, const char *name, uint16_t queue_id) +{ + int *fds = dev->process_private; + + if (fds[queue_id] != -1) + return 0; /* already setup */ + + struct ifreq ifr = { }; + int tap_fd = tap_open(name, &ifr, 0); + if (tap_fd < 0) { + PMD_LOG(ERR, "tap_open failed"); + return -1; + } + + PMD_LOG(DEBUG, "opened %d for queue %u", tap_fd, queue_id); + fds[queue_id] = tap_fd; + return 0; +} + +static int +eth_queue_fd(uint16_t port_id, uint16_t queue_id) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + int *fds = dev->process_private; + + return fds[queue_id]; +} + +/* setup an submit queue to read mbuf */ +static inline void +eth_rx_submit(struct rx_queue *rxq, int fd, struct rte_mbuf *mb) +{ + struct io_uring_sqe *sqe = io_uring_get_sqe(&rxq->io_ring); + + if (unlikely(sqe == NULL)) { + PMD_LOG(DEBUG, "io_uring no rx sqe"); + rxq->rx_errors++; + } else { + void *base = rte_pktmbuf_mtod(mb, void *); + size_t len = mb->buf_len; + + io_uring_prep_read(sqe, fd, base, len, 0); + io_uring_sqe_set_data(sqe, mb); +
[RFC 5/8] net/ioring: implement primary secondary fd passing
Add support for communicating fd's from primary to secondary. Signed-off-by: Stephen Hemminger --- doc/guides/nics/features/ioring.ini | 1 + drivers/net/ioring/rte_eth_ioring.c | 136 +++- 2 files changed, 135 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/ioring.ini b/doc/guides/nics/features/ioring.ini index 199c7cd31c..da47062adb 100644 --- a/doc/guides/nics/features/ioring.ini +++ b/doc/guides/nics/features/ioring.ini @@ -8,6 +8,7 @@ Link status = Y MTU update = Y Promiscuous mode = Y Allmulticast mode= Y +Multiprocess aware = Y Linux = Y x86-64 = Y Usage doc= Y diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index b5d9c12bdf..ddef57adfb 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -28,6 +28,7 @@ #include #define IORING_DEFAULT_IFNAME "enio%d" +#define IORING_MP_KEY "ioring_mp_send_fds" RTE_LOG_REGISTER_DEFAULT(ioring_logtype, NOTICE); #define RTE_LOGTYPE_IORING ioring_logtype @@ -400,6 +401,84 @@ parse_iface_arg(const char *key __rte_unused, const char *value, void *extra_arg return 0; } +/* Secondary process requests rxq fds from primary. */ +static int +ioring_request_fds(const char *name, struct rte_eth_dev *dev) +{ + struct rte_mp_msg request = { }; + + strlcpy(request.name, IORING_MP_KEY, sizeof(request.name)); + strlcpy((char *)request.param, name, RTE_MP_MAX_PARAM_LEN); + request.len_param = strlen(name); + + /* Send the request and receive the reply */ + PMD_LOG(DEBUG, "Sending multi-process IPC request for %s", name); + + struct timespec timeout = {.tv_sec = 1, .tv_nsec = 0}; + struct rte_mp_reply replies; + int ret = rte_mp_request_sync(&request, &replies, &timeout); + if (ret < 0 || replies.nb_received != 1) { + PMD_LOG(ERR, "Failed to request fds from primary: %s", + rte_strerror(rte_errno)); + return -1; + } + + struct rte_mp_msg *reply = replies.msgs; + PMD_LOG(DEBUG, "Received multi-process IPC reply for %s", name); + if (dev->data->nb_rx_queues != reply->num_fds) { + PMD_LOG(ERR, "Incorrect number of fds received: %d != %d", + reply->num_fds, dev->data->nb_rx_queues); + return -EINVAL; + } + + int *fds = dev->process_private; + for (int i = 0; i < reply->num_fds; i++) + fds[i] = reply->fds[i]; + + free(reply); + return 0; +} + +/* Primary process sends rxq fds to secondary. */ +static int +ioring_mp_send_fds(const struct rte_mp_msg *request, const void *peer) +{ + const char *request_name = (const char *)request->param; + + PMD_LOG(DEBUG, "Received multi-process IPC request for %s", request_name); + + /* Find the requested port */ + struct rte_eth_dev *dev = rte_eth_dev_get_by_name(request_name); + if (!dev) { + PMD_LOG(ERR, "Failed to get port id for %s", request_name); + return -1; + } + + /* Populate the reply with the xsk fd for each queue */ + struct rte_mp_msg reply = { }; + if (dev->data->nb_rx_queues > RTE_MP_MAX_FD_NUM) { + PMD_LOG(ERR, "Number of rx queues (%d) exceeds max number of fds (%d)", + dev->data->nb_rx_queues, RTE_MP_MAX_FD_NUM); + return -EINVAL; + } + + int *fds = dev->process_private; + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) + reply.fds[reply.num_fds++] = fds[i]; + + /* Send the reply */ + strlcpy(reply.name, request->name, sizeof(reply.name)); + strlcpy((char *)reply.param, request_name, RTE_MP_MAX_PARAM_LEN); + reply.len_param = strlen(request_name); + + PMD_LOG(DEBUG, "Sending multi-process IPC reply for %s", request_name); + if (rte_mp_reply(&reply, peer) < 0) { + PMD_LOG(ERR, "Failed to reply to multi-process IPC request"); + return -1; + } + return 0; +} + static int ioring_probe(struct rte_vdev_device *vdev) { @@ -407,14 +486,43 @@ ioring_probe(struct rte_vdev_device *vdev) const char *params = rte_vdev_device_args(vdev); struct rte_kvargs *kvlist = NULL; struct rte_eth_dev *eth_dev = NULL; + int *fds = NULL; char tap_name[IFNAMSIZ] = IORING_DEFAULT_IFNAME; uint8_t persist = 0; int ret; PMD_LOG(INFO, "Initializing %s", name); - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - return -1; /* TODO */ + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + struct rte_eth_dev *eth_dev; + + eth_dev = rte_eth_dev_attach_secondary(name); + if (!eth_dev) { + PMD_LOG(ERR, "Failed to p
[RFC 4/8] net/ioring: implement management functions
Add start, stop, configure and info functions. Signed-off-by: Stephen Hemminger --- drivers/net/ioring/rte_eth_ioring.c | 72 ++--- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index de10a4d83f..b5d9c12bdf 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -212,12 +212,16 @@ static int eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct pmd_internals *pmd = dev->data->dev_private; + + int sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) + return -errno; + struct ifreq ifr = { .ifr_mtu = mtu }; - int ret; strlcpy(ifr.ifr_name, pmd->ifname, IFNAMSIZ); - ret = ioctl(pmd->ctl_sock, SIOCSIFMTU, &ifr); + int ret = ioctl(sock, SIOCSIFMTU, &ifr); if (ret < 0) { PMD_LOG(ERR, "ioctl(SIOCSIFMTU) failed: %s", strerror(errno)); ret = -errno; @@ -230,14 +234,17 @@ static int eth_dev_macaddr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct pmd_internals *pmd = dev->data->dev_private; - struct ifreq ifr = { }; - int ret; + int sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) + return -errno; + + struct ifreq ifr = { }; strlcpy(ifr.ifr_name, pmd->ifname, IFNAMSIZ); ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; memcpy(ifr.ifr_hwaddr.sa_data, addr, sizeof(*addr)); - ret = ioctl(pmd->ctl_sock, SIOCSIFHWADDR, &ifr); + int ret = ioctl(sock, SIOCSIFHWADDR, &ifr); if (ret < 0) { PMD_LOG(ERR, "ioctl(SIOCSIFHWADDR) failed: %s", strerror(errno)); ret = -errno; @@ -246,6 +253,56 @@ eth_dev_macaddr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) return ret; } +static int +eth_dev_start(struct rte_eth_dev *dev) +{ + dev->data->dev_link.link_status = RTE_ETH_LINK_UP; + eth_dev_set_link_up(dev); + + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + } + + return 0; +} + +static int +eth_dev_stop(struct rte_eth_dev *dev) +{ + dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; + eth_dev_set_link_down(dev); + + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + } + + return 0; +} + +static int +eth_dev_configure(struct rte_eth_dev *dev) +{ + /* rx/tx must be paired */ + if (dev->data->nb_rx_queues != dev->data->nb_tx_queues) + return -EINVAL; + + return 0; +} + +static int +eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) +{ + struct pmd_internals *pmd = dev->data->dev_private; + + dev_info->if_index = if_nametoindex(pmd->ifname); + dev_info->max_mac_addrs = 1; + dev_info->max_rx_pktlen = RTE_ETHER_MAX_LEN; + + return 0; +} + static int eth_dev_close(struct rte_eth_dev *dev) { @@ -263,11 +320,14 @@ eth_dev_close(struct rte_eth_dev *dev) close(pmd->keep_fd); pmd->keep_fd = -1; } - return 0; } static const struct eth_dev_ops ops = { + .dev_start = eth_dev_start, + .dev_stop = eth_dev_stop, + .dev_configure = eth_dev_configure, + .dev_infos_get = eth_dev_info, .dev_close = eth_dev_close, .link_update= eth_link_update, .dev_set_link_up= eth_dev_set_link_up, -- 2.45.2
[RFC 3/8] net/ioring: implement control functions
These internal ops, just force changes to kernel visible net device. Signed-off-by: Stephen Hemminger --- doc/guides/nics/features/ioring.ini | 3 ++ drivers/net/ioring/rte_eth_ioring.c | 69 + 2 files changed, 72 insertions(+) diff --git a/doc/guides/nics/features/ioring.ini b/doc/guides/nics/features/ioring.ini index d4bf70cb4f..199c7cd31c 100644 --- a/doc/guides/nics/features/ioring.ini +++ b/doc/guides/nics/features/ioring.ini @@ -5,6 +5,9 @@ ; [Features] Link status = Y +MTU update = Y +Promiscuous mode = Y +Allmulticast mode= Y Linux = Y x86-64 = Y Usage doc= Y diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index fa3e748cda..de10a4d83f 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -163,6 +164,30 @@ eth_dev_set_link_down(struct rte_eth_dev *dev) return eth_dev_change_flags(dev, 0, ~IFF_UP); } +static int +eth_dev_promiscuous_enable(struct rte_eth_dev *dev) +{ + return eth_dev_change_flags(dev, IFF_PROMISC, ~0); +} + +static int +eth_dev_promiscuous_disable(struct rte_eth_dev *dev) +{ + return eth_dev_change_flags(dev, 0, ~IFF_PROMISC); +} + +static int +eth_dev_allmulticast_enable(struct rte_eth_dev *dev) +{ + return eth_dev_change_flags(dev, IFF_ALLMULTI, ~0); +} + +static int +eth_dev_allmulticast_disable(struct rte_eth_dev *dev) +{ + return eth_dev_change_flags(dev, 0, ~IFF_ALLMULTI); +} + static int eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) { @@ -183,6 +208,44 @@ eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) return 0; }; +static int +eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) +{ + struct pmd_internals *pmd = dev->data->dev_private; + struct ifreq ifr = { .ifr_mtu = mtu }; + int ret; + + strlcpy(ifr.ifr_name, pmd->ifname, IFNAMSIZ); + + ret = ioctl(pmd->ctl_sock, SIOCSIFMTU, &ifr); + if (ret < 0) { + PMD_LOG(ERR, "ioctl(SIOCSIFMTU) failed: %s", strerror(errno)); + ret = -errno; + } + + return ret; +} + +static int +eth_dev_macaddr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) +{ + struct pmd_internals *pmd = dev->data->dev_private; + struct ifreq ifr = { }; + int ret; + + strlcpy(ifr.ifr_name, pmd->ifname, IFNAMSIZ); + ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; + memcpy(ifr.ifr_hwaddr.sa_data, addr, sizeof(*addr)); + + ret = ioctl(pmd->ctl_sock, SIOCSIFHWADDR, &ifr); + if (ret < 0) { + PMD_LOG(ERR, "ioctl(SIOCSIFHWADDR) failed: %s", strerror(errno)); + ret = -errno; + } + + return ret; +} + static int eth_dev_close(struct rte_eth_dev *dev) { @@ -209,6 +272,12 @@ static const struct eth_dev_ops ops = { .link_update= eth_link_update, .dev_set_link_up= eth_dev_set_link_up, .dev_set_link_down = eth_dev_set_link_down, + .mac_addr_set = eth_dev_macaddr_set, + .mtu_set= eth_dev_mtu_set, + .promiscuous_enable = eth_dev_promiscuous_enable, + .promiscuous_disable= eth_dev_promiscuous_disable, + .allmulticast_enable= eth_dev_allmulticast_enable, + .allmulticast_disable = eth_dev_allmulticast_disable, }; -- 2.45.2
[RFC 7/8] net/ioring: add VLAN support
Add support for VLAN insert and stripping. Signed-off-by: Stephen Hemminger --- drivers/net/ioring/rte_eth_ioring.c | 45 +++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index fa79bc5667..a2bfefec45 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -34,6 +34,8 @@ #define IORING_NUM_BUFFERS 1024 #define IORING_MAX_QUEUES 128 +#define IORING_TX_OFFLOAD RTE_ETH_TX_OFFLOAD_VLAN_INSERT +#define IORING_RX_OFFLOAD RTE_ETH_RX_OFFLOAD_VLAN_STRIP static_assert(IORING_MAX_QUEUES <= RTE_MP_MAX_FD_NUM, "Max queues exceeds MP fd limit"); @@ -70,6 +72,7 @@ static const char * const valid_arguments[] = { struct rx_queue { struct rte_mempool *mb_pool;/* rx buffer pool */ struct io_uring io_ring;/* queue of posted read's */ + uint64_t offloads; uint16_t port_id; uint16_t queue_id; @@ -81,6 +84,7 @@ struct rx_queue { struct tx_queue { struct io_uring io_ring; + uint64_t offloads; uint16_t port_id; uint16_t queue_id; @@ -471,6 +475,9 @@ eth_ioring_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) goto resubmit; } + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) + rte_vlan_strip(mb); + mb->pkt_len = len; mb->data_len = len; mb->port = rxq->port_id; @@ -495,8 +502,7 @@ eth_ioring_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) static int eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, uint16_t nb_rx_desc, - unsigned int socket_id, - const struct rte_eth_rxconf *rx_conf __rte_unused, + unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool) { struct pmd_internals *pmd = dev->data->dev_private; @@ -515,6 +521,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, uint16_t nb_rx_de return -1; } + rxq->offloads = rx_conf->offloads; rxq->mb_pool = mb_pool; rxq->port_id = dev->data->port_id; rxq->queue_id = queue_id; @@ -582,6 +589,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, txq->port_id = dev->data->port_id; txq->queue_id = queue_id; + txq->offloads = tx_conf->offloads; txq->free_thresh = tx_conf->tx_free_thresh; dev->data->tx_queues[queue_id] = txq; @@ -636,6 +644,38 @@ eth_ioring_tx_cleanup(struct tx_queue *txq) txq->tx_bytes += tx_bytes; } +static uint16_t +eth_ioring_tx_prepare(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +{ + uint16_t nb_tx; + int error; + + for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) { + struct rte_mbuf *m = tx_pkts[nb_tx]; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + error = rte_validate_tx_offload(m); + if (unlikely(error)) { + rte_errno = -error; + break; + } +#endif + /* Do VLAN tag insertion */ + if (unlikely(m->ol_flags & RTE_MBUF_F_TX_VLAN)) { + error = rte_vlan_insert(&m); + /* rte_vlan_insert() may change pointer */ + tx_pkts[nb_tx] = m; + + if (unlikely(error)) { + rte_errno = -error; + break; + } + } + } + + return nb_tx; +} + static uint16_t eth_ioring_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { @@ -739,6 +779,7 @@ ioring_create(struct rte_eth_dev *dev, const char *tap_name, uint8_t persist) PMD_LOG(DEBUG, "%s setup", ifr.ifr_name); dev->rx_pkt_burst = eth_ioring_rx; + dev->tx_pkt_prepare = eth_ioring_tx_prepare; dev->tx_pkt_burst = eth_ioring_tx; return 0; -- 2.45.2
[RFC 8/8] net/ioring: implement statistics
Add support for basic statistics Signed-off-by: Stephen Hemminger --- drivers/net/ioring/rte_eth_ioring.c | 57 + 1 file changed, 57 insertions(+) diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index a2bfefec45..f58740197d 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -365,6 +365,61 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) return 0; } +static int +eth_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + const struct rx_queue *rxq = dev->data->rx_queues[i]; + + stats->ipackets += rxq->rx_packets; + stats->ibytes += rxq->rx_bytes; + stats->ierrors += rxq->rx_errors; + stats->rx_nombuf += rxq->rx_nombuf; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_ipackets[i] = rxq->rx_packets; + stats->q_ibytes[i] = rxq->rx_bytes; + } + } + + for (uint16_t i = 0; i < dev->data->nb_tx_queues; i++) { + const struct tx_queue *txq = dev->data->tx_queues[i]; + + stats->opackets += txq->tx_packets; + stats->obytes += txq->tx_bytes; + stats->oerrors += txq->tx_errors; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_opackets[i] = txq->tx_packets; + stats->q_obytes[i] = txq->tx_bytes; + } + } + + return 0; +} + +static int +eth_dev_stats_reset(struct rte_eth_dev *dev) +{ + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + struct rx_queue *rxq = dev->data->rx_queues[i]; + + rxq->rx_packets = 0; + rxq->rx_bytes = 0; + rxq->rx_nombuf = 0; + rxq->rx_errors = 0; + } + + for (uint16_t i = 0; i < dev->data->nb_tx_queues; i++) { + struct tx_queue *txq = dev->data->tx_queues[i]; + + txq->tx_packets = 0; + txq->tx_bytes = 0; + txq->tx_errors = 0; + } + return 0; +} + static int eth_dev_close(struct rte_eth_dev *dev) { @@ -734,6 +789,8 @@ static const struct eth_dev_ops ops = { .promiscuous_disable= eth_dev_promiscuous_disable, .allmulticast_enable= eth_dev_allmulticast_enable, .allmulticast_disable = eth_dev_allmulticast_disable, + .stats_get = eth_dev_stats_get, + .stats_reset= eth_dev_stats_reset, .rx_queue_setup = eth_rx_queue_setup, .rx_queue_release = eth_rx_queue_release, .tx_queue_setup = eth_tx_queue_setup, -- 2.45.2
[PATCH 03/21] app/test-mldev: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- app/test-mldev/ml_common.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/test-mldev/ml_common.h b/app/test-mldev/ml_common.h index 8d7cc9eeb7..45faed352c 100644 --- a/app/test-mldev/ml_common.h +++ b/app/test-mldev/ml_common.h @@ -14,11 +14,12 @@ #define ML_STR_FMT 20 -#define ml_err(fmt, args...) fprintf(stderr, CLRED "error: %s() " fmt CLNRM "\n", __func__, ##args) +#define ml_err(fmt, ...) \ + fprintf(stderr, CLRED "error: %s() " fmt CLNRM "\n", __func__, ##__VA_ARGS__) -#define ml_info(fmt, args...) fprintf(stdout, CLYEL "" fmt CLNRM "\n", ##args) +#define ml_info(fmt, ...) fprintf(stdout, CLYEL "" fmt CLNRM "\n", ##__VA_ARGS__) -#define ml_dump(str, fmt, val...) printf("\t%-*s : " fmt "\n", ML_STR_FMT, str, ##val) +#define ml_dump(str, fmt, ...) printf("\t%-*s : " fmt "\n", ML_STR_FMT, str, ##__VA_ARGS__) #define ml_dump_begin(str) printf("\t%-*s :\n\t{\n", ML_STR_FMT, str) -- 2.47.0.vfs.0.3
[PATCH 00/21] use portable variadic macros
1) Use portable variadic macros Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. 2) Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Andre Muezerie (21): app/test-acl: use portable variadic macros app/test-eventdev: use portable variadic macros app/test-mldev: use portable variadic macros app/test-pmd: use portable variadic macros drivers/baseband: ensure code structure does not change drivers/bus: use portable variadic macros drivers/common: use portable variadic macros drivers/compress: use portable variadic macros drivers/crypto: use portable variadic macros drivers/dma: use portable variadic macros drivers/event: use portable variadic macros drivers/mempool: use portable variadic macros drivers/net: use portable variadic macros drivers/raw: use portable variadic macros drivers/vdpa: use portable variadic macros lib/log: ensure code structure does not change lib/pipeline: ensure code structure does not change lib/port: ensure code structure does not change lib/power: ensure code structure does not change lib/rcu: ensure code structure does not change lib/vhost: ensure code structure does not change app/test-acl/main.c | 4 +- app/test-eventdev/evt_common.h| 12 ++-- app/test-mldev/ml_common.h| 7 ++- app/test-pmd/testpmd.h| 4 +- drivers/baseband/acc/acc100_pmd.h | 2 +- drivers/baseband/acc/vrb_pmd.h| 2 +- drivers/bus/cdx/cdx_logs.h| 12 ++-- drivers/bus/dpaa/include/fman.h | 4 +- drivers/bus/dpaa/rte_dpaa_logs.h | 18 +++--- drivers/bus/fslmc/fslmc_logs.h| 12 ++-- drivers/bus/fslmc/qbman/include/compat.h | 18 +++--- drivers/bus/ifpga/ifpga_logs.h| 16 ++--- drivers/bus/uacce/uacce.c | 8 +-- drivers/common/dpaax/compat.h | 16 ++--- drivers/common/dpaax/dpaax_logs.h | 18 +++--- drivers/common/idpf/base/idpf_osdep.h | 8 ++- drivers/compress/octeontx/otx_zip.h | 8 +-- drivers/compress/zlib/zlib_pmd_private.h | 12 ++-- drivers/crypto/caam_jr/caam_jr_log.h | 28 - drivers/crypto/ccp/ccp_pmd_private.h | 4 +- drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 28 - drivers/crypto/dpaa_sec/dpaa_sec_log.h| 28 - drivers/crypto/virtio/virtio_logs.h | 60 +-- drivers/dma/dpaa/dpaa_qdma_logs.h | 24 drivers/dma/dpaa2/dpaa2_qdma_logs.h | 24 drivers/dma/idxd/idxd_internal.h | 8 +-- drivers/dma/ioat/ioat_internal.h | 8 +-- drivers/event/dlb2/dlb2_log.h | 8 +-- drivers/event/dlb2/pf/base/dlb2_osdep.h | 12 ++-- drivers/event/dpaa/dpaa_eventdev.h| 16 ++--- drivers/event/dpaa2/dpaa2_eventdev_logs.h | 12 ++-- drivers/event/dsw/dsw_evdev.h | 8 +-- drivers/event/sw/sw_evdev_log.h | 12 ++-- drivers/mempool/dpaa/dpaa_mempool.h | 20 +++ drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 30 +- drivers/net/ark/ark_logs.h| 4 +- .../net/bnxt/hcapi/cfa_v3/include/cfa_trace.h | 12 ++-- drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 12 ++-- drivers/net/bnxt/tf_core/tfp.h| 8 +-- drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 4 +- drivers/net/dpaa/dpaa_ethdev.h| 16 ++--- drivers/net/dpaa/fmlib/fm_ext.h | 4 +- drivers/net/dpaa2/dpaa2_pmd_logs.h| 28 - drivers/net/e1000/base/e1000_osdep.h | 10 ++-- drivers/net/ena/base/ena_plat_dpdk.h | 16 ++--- drivers/net/enetc/enetc_logs.h| 32 +- drivers/net/enetfec/enet_pmd_logs.h | 18 +++--- drivers/net/enic/enic_compat.h| 16 ++--- drivers/net/fm10k/base/fm10k_osdep.h | 10 ++-- drivers/net/hns3/hns3_logs.h | 20 +++ drivers/net/ice/base/ice_osdep.h | 4 +- drivers/net/igc/base/igc_osdep.h | 10 ++-- drivers/net/ipn3ke/ipn3ke_logs.h | 16 ++--- drivers/net/ixgbe/base/ixgbe_osdep.h | 30 +- drivers/net/ngbe/base/ngbe_osdep.h| 2 +- drivers/net/ngbe/ngbe_logs.h | 2 +- drivers/net/pfe/pfe_logs.h| 18 +++--- drivers/net/qede/qede_ethd
[PATCH 07/21] drivers/common: use portable variadic macros
1) Use portable variadic macros Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. 2) Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- drivers/common/dpaax/compat.h | 16 drivers/common/dpaax/dpaax_logs.h | 18 +- drivers/common/idpf/base/idpf_osdep.h | 8 +--- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h index 7c8d82c2b2..1b80ba6cef 100644 --- a/drivers/common/dpaax/compat.h +++ b/drivers/common/dpaax/compat.h @@ -70,28 +70,28 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) /* Debugging */ -#define prflush(fmt, args...) \ +#define prflush(fmt, ...) \ do { \ - printf(fmt, ##args); \ + printf(fmt, ##__VA_ARGS__); \ fflush(stdout); \ } while (0) #ifndef pr_crit -#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args) +#define pr_crit(fmt, ...) prflush("CRIT:" fmt, ##__VA_ARGS__) #endif #ifndef pr_err -#define pr_err(fmt, args...)prflush("ERR:" fmt, ##args) +#define pr_err(fmt, ...)prflush("ERR:" fmt, ##__VA_ARGS__) #endif #ifndef pr_warn -#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args) +#define pr_warn(fmt, ...) prflush("WARN:" fmt, ##__VA_ARGS__) #endif #ifndef pr_info -#define pr_info(fmt, args...) prflush(fmt, ##args) +#define pr_info(fmt, ...) prflush(fmt, ##__VA_ARGS__) #endif #ifndef pr_debug #ifdef RTE_LIBRTE_DPAA_DEBUG_BUS -#define pr_debug(fmt, args...) printf(fmt, ##args) +#define pr_debug(fmt, ...) printf(fmt, ##__VA_ARGS__) #else -#define pr_debug(fmt, args...) {} +#define pr_debug(fmt, ...) do { } while (0) #endif #endif diff --git a/drivers/common/dpaax/dpaax_logs.h b/drivers/common/dpaax/dpaax_logs.h index 6ed29fb2ea..90f0c98863 100644 --- a/drivers/common/dpaax/dpaax_logs.h +++ b/drivers/common/dpaax/dpaax_logs.h @@ -11,13 +11,13 @@ extern int dpaax_logger; #define RTE_LOGTYPE_DPAAX_LOGGER dpaax_logger #ifdef RTE_LIBRTE_DPAAX_DEBUG -#define DPAAX_HWWARN(cond, fmt, args...) \ +#define DPAAX_HWWARN(cond, fmt, ...) \ do {\ if (cond) \ - DPAAX_LOG(DEBUG, "WARN: " fmt, ##args); \ + DPAAX_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \ } while (0) #else -#define DPAAX_HWWARN(cond, fmt, args...) do { } while (0) +#define DPAAX_HWWARN(cond, fmt, ...) do { } while (0) #endif #define DPAAX_LOG(level, ...) \ @@ -27,11 +27,11 @@ extern int dpaax_logger; #define DPAAX_DEBUG(...) \ RTE_LOG_LINE_PREFIX(DEBUG, DPAAX_LOGGER, "%s(): ", __func__, __VA_ARGS__) -#define DPAAX_INFO(fmt, args...) \ - DPAAX_LOG(INFO, fmt, ## args) -#define DPAAX_ERR(fmt, args...) \ - DPAAX_LOG(ERR, fmt, ## args) -#define DPAAX_WARN(fmt, args...) \ - DPAAX_LOG(WARNING, fmt, ## args) +#define DPAAX_INFO(fmt, ...) \ + DPAAX_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAAX_ERR(fmt, ...) \ + DPAAX_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAAX_WARN(fmt, ...) \ + DPAAX_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* _DPAAX_LOGS_H_ */ diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h index cf9e553906..250f0ec500 100644 --- a/drivers/common/idpf/base/idpf_osdep.h +++ b/drivers/common/idpf/base/idpf_osdep.h @@ -42,7 +42,7 @@ typedef uint64_t s64; typedef struct idpf_lock idpf_lock; #define __iomem -#define hw_dbg(hw, S, A...)do {} while (0) +#define hw_dbg(hw, S, ...) do {} while (0) #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) #define lower_32_bits(n) ((u32)(n)) #define low_16_bits(x) ((x) & 0x) @@ -122,8 +122,10 @@ typedef struct idpf_lock idpf_lock; ##__VA_ARGS__); \ } while (0) -#define idpf_info(hw, fmt, args...) idpf_debug(hw, IDPF_DBG_ALL, fmt, ##args) -#define idpf_warn(hw, fmt, args...) idpf_debug(hw, IDPF_DBG_ALL, fmt, ##args) +#define idpf_info(hw, fmt, ...) \ + idpf_debug(hw, IDPF_DBG_ALL, fmt, ##__VA_ARGS__) +#define idpf_warn(hw, fmt, ...) \ + idpf_debug(hw, IDPF_DBG_ALL, fmt, ##__VA_ARGS__) #define idpf_debug_array(hw, type, rowsize, groupsize, buf, len) \ do {\ struct idpf_hw *hw_l = hw; \ -- 2.47.0.vfs.0.3
[PATCH 05/21] drivers/baseband: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- drivers/baseband/acc/acc100_pmd.h | 2 +- drivers/baseband/acc/vrb_pmd.h| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/baseband/acc/acc100_pmd.h b/drivers/baseband/acc/acc100_pmd.h index 976593698e..ae66b1246c 100644 --- a/drivers/baseband/acc/acc100_pmd.h +++ b/drivers/baseband/acc/acc100_pmd.h @@ -18,7 +18,7 @@ #define rte_bbdev_log_debug(...) \ rte_bbdev_log(DEBUG, __VA_ARGS__) #else -#define rte_bbdev_log_debug(...) +#define rte_bbdev_log_debug(...) do { } while (0) #endif /* ACC100 PF and VF driver names */ diff --git a/drivers/baseband/acc/vrb_pmd.h b/drivers/baseband/acc/vrb_pmd.h index a4b81640e8..fb342d77fe 100644 --- a/drivers/baseband/acc/vrb_pmd.h +++ b/drivers/baseband/acc/vrb_pmd.h @@ -20,7 +20,7 @@ #define rte_bbdev_log_debug(...) \ rte_bbdev_log(DEBUG, __VA_ARGS__) #else -#define rte_bbdev_log_debug(...) +#define rte_bbdev_log_debug(...) do { } while (0) #endif /* VRB1 PF and VF driver names */ -- 2.47.0.vfs.0.3
[PATCH 08/21] drivers/compress: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- drivers/compress/octeontx/otx_zip.h | 8 drivers/compress/zlib/zlib_pmd_private.h | 12 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h index bf09e2f58c..6265664ead 100644 --- a/drivers/compress/octeontx/otx_zip.h +++ b/drivers/compress/octeontx/otx_zip.h @@ -80,10 +80,10 @@ extern int octtx_zip_logtype_driver; #define ZIP_PMD_LOG(level, ...) \ RTE_LOG_LINE_PREFIX(level, OCTTX_ZIP_DRIVER, "%s(): ", __func__, __VA_ARGS__) -#define ZIP_PMD_INFO(fmt, args...) \ - ZIP_PMD_LOG(INFO, fmt, ## args) -#define ZIP_PMD_ERR(fmt, args...) \ - ZIP_PMD_LOG(ERR, fmt, ## args) +#define ZIP_PMD_INFO(fmt, ...) \ + ZIP_PMD_LOG(INFO, fmt, ## __VA_ARGS__) +#define ZIP_PMD_ERR(fmt, ...) \ + ZIP_PMD_LOG(ERR, fmt, ## __VA_ARGS__) /* resources required to process stream */ enum NUM_BUFS_PER_STREAM { diff --git a/drivers/compress/zlib/zlib_pmd_private.h b/drivers/compress/zlib/zlib_pmd_private.h index 7f6a57c6c5..fd8c4c55a4 100644 --- a/drivers/compress/zlib/zlib_pmd_private.h +++ b/drivers/compress/zlib/zlib_pmd_private.h @@ -19,12 +19,12 @@ extern int zlib_logtype_driver; #define ZLIB_PMD_LOG(level, ...) \ RTE_LOG_LINE_PREFIX(level, ZLIB_DRIVER, "%s(): ", __func__, __VA_ARGS__) -#define ZLIB_PMD_INFO(fmt, args...) \ - ZLIB_PMD_LOG(INFO, fmt, ## args) -#define ZLIB_PMD_ERR(fmt, args...) \ - ZLIB_PMD_LOG(ERR, fmt, ## args) -#define ZLIB_PMD_WARN(fmt, args...) \ - ZLIB_PMD_LOG(WARNING, fmt, ## args) +#define ZLIB_PMD_INFO(fmt, ...) \ + ZLIB_PMD_LOG(INFO, fmt, ## __VA_ARGS__) +#define ZLIB_PMD_ERR(fmt, ...) \ + ZLIB_PMD_LOG(ERR, fmt, ## __VA_ARGS__) +#define ZLIB_PMD_WARN(fmt, ...) \ + ZLIB_PMD_LOG(WARNING, fmt, ## __VA_ARGS__) struct zlib_private { struct rte_mempool *mp; -- 2.47.0.vfs.0.3
[PATCH 06/21] drivers/bus: use portable variadic macros
1) Use portable variadic macros Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. 2) Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- drivers/bus/cdx/cdx_logs.h | 12 ++-- drivers/bus/dpaa/include/fman.h | 4 ++-- drivers/bus/dpaa/rte_dpaa_logs.h | 18 +- drivers/bus/fslmc/fslmc_logs.h | 12 ++-- drivers/bus/fslmc/qbman/include/compat.h | 18 +- drivers/bus/ifpga/ifpga_logs.h | 16 drivers/bus/uacce/uacce.c| 8 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/drivers/bus/cdx/cdx_logs.h b/drivers/bus/cdx/cdx_logs.h index 18b4010746..2d5c213417 100644 --- a/drivers/bus/cdx/cdx_logs.h +++ b/drivers/bus/cdx/cdx_logs.h @@ -15,11 +15,11 @@ extern int cdx_logtype_bus; #define CDX_BUS_DEBUG(...) \ RTE_LOG_LINE_PREFIX(DEBUG, CDX_BUS, "%s(): ", __func__, __VA_ARGS__) -#define CDX_BUS_INFO(fmt, args...) \ - CDX_BUS_LOG(INFO, fmt, ## args) -#define CDX_BUS_ERR(fmt, args...) \ - CDX_BUS_LOG(ERR, fmt, ## args) -#define CDX_BUS_WARN(fmt, args...) \ - CDX_BUS_LOG(WARNING, fmt, ## args) +#define CDX_BUS_INFO(fmt, ...) \ + CDX_BUS_LOG(INFO, fmt, ## __VA_ARGS__) +#define CDX_BUS_ERR(fmt, ...) \ + CDX_BUS_LOG(ERR, fmt, ## __VA_ARGS__) +#define CDX_BUS_WARN(fmt, ...) \ + CDX_BUS_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* CDX_LOGS_H */ diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 01ef503117..134f0dc8ff 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -477,10 +477,10 @@ extern int fman_ccsr_map_fd; #define fman_if_for_each_bpool(bp, __if) \ list_for_each_entry(bp, &(__if)->bpool_list, node) -#define FMAN_ERR(rc, fmt, args...) \ +#define FMAN_ERR(rc, fmt, ...) \ do { \ _errno = (rc); \ - RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##args, errno); \ + RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##__VA_ARGS__, errno); \ } while (0) #define FMAN_IP_REV_1 0xC30C4 diff --git a/drivers/bus/dpaa/rte_dpaa_logs.h b/drivers/bus/dpaa/rte_dpaa_logs.h index 1e61b4e76b..235c617edd 100644 --- a/drivers/bus/dpaa/rte_dpaa_logs.h +++ b/drivers/bus/dpaa/rte_dpaa_logs.h @@ -16,13 +16,13 @@ extern int dpaa_logtype_bus; RTE_LOG_LINE(level, DPAA_BUS, __VA_ARGS__) #ifdef RTE_LIBRTE_DPAA_DEBUG_BUS -#define DPAA_BUS_HWWARN(cond, fmt, args...) \ +#define DPAA_BUS_HWWARN(cond, fmt, ...) \ do {\ if (cond) \ - DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##args); \ + DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \ } while (0) #else -#define DPAA_BUS_HWWARN(cond, fmt, args...) do { } while (0) +#define DPAA_BUS_HWWARN(cond, fmt, ...) do { } while (0) #endif #define DPAA_BUS_DEBUG(...) \ @@ -30,11 +30,11 @@ extern int dpaa_logtype_bus; #define BUS_INIT_FUNC_TRACE() DPAA_BUS_DEBUG(" >>") -#define DPAA_BUS_INFO(fmt, args...) \ - DPAA_BUS_LOG(INFO, fmt, ## args) -#define DPAA_BUS_ERR(fmt, args...) \ - DPAA_BUS_LOG(ERR, fmt, ## args) -#define DPAA_BUS_WARN(fmt, args...) \ - DPAA_BUS_LOG(WARNING, fmt, ## args) +#define DPAA_BUS_INFO(fmt, ...) \ + DPAA_BUS_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA_BUS_ERR(fmt, ...) \ + DPAA_BUS_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA_BUS_WARN(fmt, ...) \ + DPAA_BUS_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* _DPAA_LOGS_H_ */ diff --git a/drivers/bus/fslmc/fslmc_logs.h b/drivers/bus/fslmc/fslmc_logs.h index ac0cd3dc29..412d160d11 100644 --- a/drivers/bus/fslmc/fslmc_logs.h +++ b/drivers/bus/fslmc/fslmc_logs.h @@ -17,11 +17,11 @@ extern int dpaa2_logtype_bus; #define DPAA2_BUS_DEBUG(...) \ RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_BUS, "%s(): ", __func__, __VA_ARGS__) -#define DPAA2_BUS_INFO(fmt, args...) \ - DPAA2_BUS_LOG(INFO, fmt, ## args) -#define DPAA2_BUS_ERR(fmt, args...) \ - DPAA2_BUS_LOG(ERR, fmt, ## args) -#define DPAA2_BUS_WARN(fmt, args...) \ - DPAA2_BUS_LOG(WARNING, fmt, ## args) +#define DPAA2_BUS_INFO(fmt, ...) \ + DPAA2_BUS_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_BUS_ERR(fmt, ...) \ + DPAA2_BUS_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA2_BUS_WARN(fmt, ...) \ + DPAA2_BUS_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* _FSLMC_LOGS_H_ */ diff --git a/drivers/bus/fsl
[PATCH 02/21] app/test-eventdev: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- app/test-eventdev/evt_common.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h index 901b8ba55d..63b782f11a 100644 --- a/app/test-eventdev/evt_common.h +++ b/app/test-eventdev/evt_common.h @@ -18,16 +18,16 @@ #define CLGRN "\x1b[32m" #define CLYEL "\x1b[33m" -#define evt_err(fmt, args...) \ - fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## args) +#define evt_err(fmt, ...) \ + fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## __VA_ARGS__) -#define evt_info(fmt, args...) \ - fprintf(stdout, CLYEL""fmt CLNRM "\n", ## args) +#define evt_info(fmt, ...) \ + fprintf(stdout, CLYEL""fmt CLNRM "\n", ## __VA_ARGS__) #define EVT_STR_FMT 20 -#define evt_dump(str, fmt, val...) \ - printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## val) +#define evt_dump(str, fmt, ...) \ + printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## __VA_ARGS__) #define evt_dump_begin(str) printf("\t%-*s : {", EVT_STR_FMT, str) -- 2.47.0.vfs.0.3
[PATCH 01/21] app/test-acl: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- app/test-acl/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-acl/main.c b/app/test-acl/main.c index 41ce83db08..3a791b3ccf 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -423,9 +423,9 @@ static const char cb_port_delim[] = ":"; static char line[LINE_MAX]; -#definedump_verbose(lvl, fh, fmt, args...) do { \ +#definedump_verbose(lvl, fh, fmt, ...) do { \ if ((lvl) <= (int32_t)config.verbose)\ - fprintf(fh, fmt, ##args);\ + fprintf(fh, fmt, ##__VA_ARGS__); \ } while (0) -- 2.47.0.vfs.0.3
[PATCH 12/21] drivers/mempool: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- drivers/mempool/dpaa/dpaa_mempool.h | 20 ++--- drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 30 +-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h index 135520922f..0877068fdd 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.h +++ b/drivers/mempool/dpaa/dpaa_mempool.h @@ -65,15 +65,15 @@ extern struct dpaa_bp_info *rte_dpaa_bpid_info; #define MEMPOOL_INIT_FUNC_TRACE() DPAA_MEMPOOL_LOG(DEBUG, " >>") -#define DPAA_MEMPOOL_DPDEBUG(fmt, args...) \ - RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## args) -#define DPAA_MEMPOOL_DEBUG(fmt, args...) \ - DPAA_MEMPOOL_LOG(DEBUG, fmt, ## args) -#define DPAA_MEMPOOL_ERR(fmt, args...) \ - DPAA_MEMPOOL_LOG(ERR, fmt, ## args) -#define DPAA_MEMPOOL_INFO(fmt, args...) \ - DPAA_MEMPOOL_LOG(INFO, fmt, ## args) -#define DPAA_MEMPOOL_WARN(fmt, args...) \ - DPAA_MEMPOOL_LOG(WARNING, fmt, ## args) +#define DPAA_MEMPOOL_DPDEBUG(fmt, ...) \ + RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## __VA_ARGS__) +#define DPAA_MEMPOOL_DEBUG(fmt, ...) \ + DPAA_MEMPOOL_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA_MEMPOOL_ERR(fmt, ...) \ + DPAA_MEMPOOL_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA_MEMPOOL_INFO(fmt, ...) \ + DPAA_MEMPOOL_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA_MEMPOOL_WARN(fmt, ...) \ + DPAA_MEMPOOL_LOG(WARNING, fmt, ## __VA_ARGS__) #endif diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h index d69ef17a04..1ba7983206 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h @@ -15,22 +15,22 @@ extern int dpaa2_logtype_mempool; #define DPAA2_MEMPOOL_DEBUG(...) \ RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_MEMPOOL, "%s(): ", __func__, __VA_ARGS__) -#define DPAA2_MEMPOOL_INFO(fmt, args...) \ - DPAA2_MEMPOOL_LOG(INFO, fmt, ## args) -#define DPAA2_MEMPOOL_ERR(fmt, args...) \ - DPAA2_MEMPOOL_LOG(ERR, fmt, ## args) -#define DPAA2_MEMPOOL_WARN(fmt, args...) \ - DPAA2_MEMPOOL_LOG(WARNING, fmt, ## args) +#define DPAA2_MEMPOOL_INFO(fmt, ...) \ + DPAA2_MEMPOOL_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_MEMPOOL_ERR(fmt, ...) \ + DPAA2_MEMPOOL_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA2_MEMPOOL_WARN(fmt, ...) \ + DPAA2_MEMPOOL_LOG(WARNING, fmt, ## __VA_ARGS__) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA2_MEMPOOL_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA2_MEMPOOL, fmt, ## args) - -#define DPAA2_MEMPOOL_DP_DEBUG(fmt, args...) \ - DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## args) -#define DPAA2_MEMPOOL_DP_INFO(fmt, args...) \ - DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## args) -#define DPAA2_MEMPOOL_DP_WARN(fmt, args...) \ - DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## args) +#define DPAA2_MEMPOOL_DP_LOG(level, fmt, ...) \ + RTE_LOG_DP(level, DPAA2_MEMPOOL, fmt, ## __VA_ARGS__) + +#define DPAA2_MEMPOOL_DP_DEBUG(fmt, ...) \ + DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA2_MEMPOOL_DP_INFO(fmt, ...) \ + DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_MEMPOOL_DP_WARN(fmt, ...) \ + DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* _DPAA2_HW_MEMPOOL_LOGS_H_ */ -- 2.47.0.vfs.0.3
[PATCH 04/21] app/test-pmd: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- app/test-pmd/testpmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 314482e69c..260e4761bd 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1311,7 +1311,7 @@ RTE_INIT(__##c) \ #endif #endif /* __GCC__ */ -#define TESTPMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## args) +#define TESTPMD_LOG(level, fmt, ...) \ + rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## __VA_ARGS__) #endif /* _TESTPMD_H_ */ -- 2.47.0.vfs.0.3
[PATCH 13/21] drivers/net: use portable variadic macros
1) Use portable variadic macros Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. 2) Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- drivers/net/ark/ark_logs.h| 4 +-- .../net/bnxt/hcapi/cfa_v3/include/cfa_trace.h | 12 +++ drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 12 +++ drivers/net/bnxt/tf_core/tfp.h| 8 ++--- drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 4 +-- drivers/net/dpaa/dpaa_ethdev.h| 16 +- drivers/net/dpaa/fmlib/fm_ext.h | 4 +-- drivers/net/dpaa2/dpaa2_pmd_logs.h| 28 drivers/net/e1000/base/e1000_osdep.h | 10 +++--- drivers/net/ena/base/ena_plat_dpdk.h | 16 +- drivers/net/enetc/enetc_logs.h| 32 +-- drivers/net/enetfec/enet_pmd_logs.h | 18 +-- drivers/net/enic/enic_compat.h| 16 +- drivers/net/fm10k/base/fm10k_osdep.h | 10 +++--- drivers/net/hns3/hns3_logs.h | 20 ++-- drivers/net/ice/base/ice_osdep.h | 4 +-- drivers/net/igc/base/igc_osdep.h | 10 +++--- drivers/net/ipn3ke/ipn3ke_logs.h | 16 +- drivers/net/ixgbe/base/ixgbe_osdep.h | 30 - drivers/net/ngbe/base/ngbe_osdep.h| 2 +- drivers/net/ngbe/ngbe_logs.h | 2 +- drivers/net/pfe/pfe_logs.h| 18 +-- drivers/net/qede/qede_ethdev.h| 4 +-- drivers/net/qede/qede_logs.h | 16 +- drivers/net/sfc/sfc_debug.h | 4 +-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/net/txgbe/txgbe_logs.h| 2 +- 27 files changed, 160 insertions(+), 160 deletions(-) diff --git a/drivers/net/ark/ark_logs.h b/drivers/net/ark/ark_logs.h index ca46d86c99..fb0f3eee5f 100644 --- a/drivers/net/ark/ark_logs.h +++ b/drivers/net/ark/ark_logs.h @@ -20,8 +20,8 @@ extern int ark_logtype; -#define ARK_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## args) +#define ARK_PMD_LOG(level, fmt, ...) \ + rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## __VA_ARGS__) /* Debug macro to enable core debug code */ diff --git a/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h b/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h index f9e051f046..a177c616a3 100644 --- a/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h +++ b/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h @@ -91,8 +91,8 @@ #define CFA_TRACE_DBG_FL(function, line, format, ...) \ CFA_LOG_FL(function, line, CFA_DEBUG_LEVEL_DBG, format, ##__VA_ARGS__) #else -#define CFA_TRACE_DBG(format, ...) -#define CFA_TRACE_DBG_FL(format, ...) +#define CFA_TRACE_DBG(format, ...) do { } while (0) +#define CFA_TRACE_DBG_FL(format, ...) do { } while (0) #endif #if CFA_COMP_DBG_LEVEL(COMP_ID) <= CFA_DEBUG_LEVEL_INFO #define CFA_TRACE_INFO(format, ...) \ @@ -100,8 +100,8 @@ #define CFA_TRACE_INFO_FL(function, line, format, ...) \ CFA_LOG_FL(function, line, CFA_DEBUG_LEVEL_INFO, format, ##__VA_ARGS__) #else -#define CFA_TRACE_INFO(format, ...) -#define CFA_TRACE_INFO_FL(function, line, format, ...) +#define CFA_TRACE_INFO(format, ...)do { } while (0) +#define CFA_TRACE_INFO_FL(function, line, format, ...) do { } while (0) #endif #if CFA_COMP_DBG_LEVEL(COMP_ID) <= CFA_DEBUG_LEVEL_WARN #define CFA_TRACE_WARN(format, ...) \ @@ -119,8 +119,8 @@ CFA_LOG_FL(function, line, CFA_DEBUG_LEVEL_CRITICAL, format, \ ##__VA_ARGS__) #else -#define CFA_TRACE_ERR(format, ...) -#define CFA_TRACE_ERR_FL(function, line, format, ...) +#define CFA_TRACE_ERR(format, ...) do { } while (0) +#define CFA_TRACE_ERR_FL(function, line, format, ...) do { } while (0) #endif #define CFA_TRACE_FATAL(format, ...) \ CFA_LOG(CFA_DEBUG_LEVEL_FATAL, format, ##__VA_ARGS__) diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h index 6ac1156fbf..5801bf89eb 100644 --- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h +++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h @@ -25,13 +25,13 @@
[PATCH 09/21] drivers/crypto: use portable variadic macros
1) Use portable variadic macros Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. 2) Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- drivers/crypto/caam_jr/caam_jr_log.h | 28 +-- drivers/crypto/ccp/ccp_pmd_private.h | 4 +- drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 28 +-- drivers/crypto/dpaa_sec/dpaa_sec_log.h| 28 +-- drivers/crypto/virtio/virtio_logs.h | 60 +++ 5 files changed, 74 insertions(+), 74 deletions(-) diff --git a/drivers/crypto/caam_jr/caam_jr_log.h b/drivers/crypto/caam_jr/caam_jr_log.h index 7c50119106..18de668e10 100644 --- a/drivers/crypto/caam_jr/caam_jr_log.h +++ b/drivers/crypto/caam_jr/caam_jr_log.h @@ -18,24 +18,24 @@ extern int caam_jr_logtype; #define PMD_INIT_FUNC_TRACE() CAAM_JR_DEBUG(" >>") -#define CAAM_JR_INFO(fmt, args...) \ - CAAM_JR_LOG(INFO, fmt, ## args) -#define CAAM_JR_ERR(fmt, args...) \ - CAAM_JR_LOG(ERR, fmt, ## args) -#define CAAM_JR_WARN(fmt, args...) \ - CAAM_JR_LOG(WARNING, fmt, ## args) +#define CAAM_JR_INFO(fmt, ...) \ + CAAM_JR_LOG(INFO, fmt, ## __VA_ARGS__) +#define CAAM_JR_ERR(fmt, ...) \ + CAAM_JR_LOG(ERR, fmt, ## __VA_ARGS__) +#define CAAM_JR_WARN(fmt, ...) \ + CAAM_JR_LOG(WARNING, fmt, ## __VA_ARGS__) /* DP Logs, toggled out at compile time if level lower than current level */ #define CAAM_JR_DP_LOG(level, ...) \ RTE_LOG_DP_LINE(level, CAAM_JR, __VA_ARGS__) -#define CAAM_JR_DP_DEBUG(fmt, args...) \ - CAAM_JR_DP_LOG(DEBUG, fmt, ## args) -#define CAAM_JR_DP_INFO(fmt, args...) \ - CAAM_JR_DP_LOG(INFO, fmt, ## args) -#define CAAM_JR_DP_WARN(fmt, args...) \ - CAAM_JR_DP_LOG(WARNING, fmt, ## args) -#define CAAM_JR_DP_ERR(fmt, args...) \ - CAAM_JR_DP_LOG(ERR, fmt, ## args) +#define CAAM_JR_DP_DEBUG(fmt, ...) \ + CAAM_JR_DP_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define CAAM_JR_DP_INFO(fmt, ...) \ + CAAM_JR_DP_LOG(INFO, fmt, ## __VA_ARGS__) +#define CAAM_JR_DP_WARN(fmt, ...) \ + CAAM_JR_DP_LOG(WARNING, fmt, ## __VA_ARGS__) +#define CAAM_JR_DP_ERR(fmt, ...) \ + CAAM_JR_DP_LOG(ERR, fmt, ## __VA_ARGS__) #endif /* _CAAM_JR_LOG_H_ */ diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h index 361a20fa3e..4795b88f9d 100644 --- a/drivers/crypto/ccp/ccp_pmd_private.h +++ b/drivers/crypto/ccp/ccp_pmd_private.h @@ -24,8 +24,8 @@ extern int crypto_ccp_logtype; RTE_LOG_LINE_PREFIX(DEBUG, CRYPTO_CCP, "%s() line %u: ", \ __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #else -#define CCP_LOG_INFO(...) -#define CCP_LOG_DBG(...) +#define CCP_LOG_INFO(...) do { } while (0) +#define CCP_LOG_DBG(...) do { } while (0) #endif /**< Maximum queue pairs supported by CCP PMD */ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h index 53a5ebc760..5f2a0bf8e1 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h @@ -19,25 +19,25 @@ extern int dpaa2_logtype_sec; #define PMD_INIT_FUNC_TRACE() DPAA2_SEC_DEBUG(">>") -#define DPAA2_SEC_INFO(fmt, args...) \ - DPAA2_SEC_LOG(INFO, fmt, ## args) -#define DPAA2_SEC_ERR(fmt, args...) \ - DPAA2_SEC_LOG(ERR, fmt, ## args) -#define DPAA2_SEC_WARN(fmt, args...) \ - DPAA2_SEC_LOG(WARNING, fmt, ## args) +#define DPAA2_SEC_INFO(fmt, ...) \ + DPAA2_SEC_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_SEC_ERR(fmt, ...) \ + DPAA2_SEC_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA2_SEC_WARN(fmt, ...) \ + DPAA2_SEC_LOG(WARNING, fmt, ## __VA_ARGS__) /* DP Logs, toggled out at compile time if level lower than current level */ #define DPAA2_SEC_DP_LOG(level, ...) \ RTE_LOG_DP_LINE(level, DPAA2_SEC, __VA_ARGS__) -#define DPAA2_SEC_DP_DEBUG(fmt, args...) \ - DPAA2_SEC_DP_LOG(DEBUG, fmt, ## args) -#define DPAA2_SEC_DP_INFO(fmt, args...) \ - DPAA2_SEC_DP_LOG(INFO, fmt, ## args) -#define DPAA2_SEC_DP_WARN(fmt, args...) \ - DPAA2_SEC_DP_LOG(WARNING, fmt, ## args) -#define DPAA2_SEC_DP_ERR(fmt, args...) \ - DPAA2_SEC_DP_LOG(ERR, fmt, ## args) +#define DPAA2_SEC_DP_DEBUG(fmt, ...) \ + DPAA2_SEC_DP_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA2_SEC_DP_INFO(fmt, ...) \ + DPAA2_SEC_DP_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_SEC_DP_WARN(fmt, ...) \ + DPAA2_SEC_DP_LOG(WARNING, fmt, ## __VA_ARGS__) +#define
[PATCH 15/21] drivers/vdpa: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- drivers/vdpa/ifc/base/ifcvf_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h index ba7d684c25..bbbde153ee 100644 --- a/drivers/vdpa/ifc/base/ifcvf_osdep.h +++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h @@ -16,8 +16,8 @@ extern int ifcvf_vdpa_logtype; #define RTE_LOGTYPE_IFCVF_VDPA ifcvf_vdpa_logtype -#define WARNINGOUT(S, args...) RTE_LOG(WARNING, IFCVF_VDPA, S, ##args) -#define DEBUGOUT(S, args...)RTE_LOG(DEBUG, IFCVF_VDPA, S, ##args) +#define WARNINGOUT(S, ...) RTE_LOG(WARNING, IFCVF_VDPA, S, ##__VA_ARGS__) +#define DEBUGOUT(S, ...)RTE_LOG(DEBUG, IFCVF_VDPA, S, ##__VA_ARGS__) #define STATIC static #define msec_delay(x) rte_delay_us_sleep(1000 * (x)) -- 2.47.0.vfs.0.3
[PATCH 10/21] drivers/dma: use portable variadic macros
Many places are using a GCC extension related to variadic macros, where a name prepends the ellipsis. This results in a warning like the one below when compiling the code with MSVC: app\test-pmd\testpmd.h(1314): error C2608: invalid token '...' in macro parameter list Variadic macros became a standard part of the C language with C99. GCC, Clang and MSVC handle them properly. The fix is to remove the prefix name (args... becomes ...) and use __VA_ARGS__. Signed-off-by: Andre Muezerie --- drivers/dma/dpaa/dpaa_qdma_logs.h | 24 drivers/dma/dpaa2/dpaa2_qdma_logs.h | 24 drivers/dma/idxd/idxd_internal.h| 8 drivers/dma/ioat/ioat_internal.h| 8 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma_logs.h b/drivers/dma/dpaa/dpaa_qdma_logs.h index 2d77255fd8..cbed89485f 100644 --- a/drivers/dma/dpaa/dpaa_qdma_logs.h +++ b/drivers/dma/dpaa/dpaa_qdma_logs.h @@ -16,22 +16,22 @@ extern int dpaa_qdma_logtype; #define DPAA_QDMA_FUNC_TRACE() DPAA_QDMA_DEBUG(">>") -#define DPAA_QDMA_INFO(fmt, args...) \ - DPAA_QDMA_LOG(INFO, fmt, ## args) -#define DPAA_QDMA_ERR(fmt, args...) \ - DPAA_QDMA_LOG(ERR, fmt, ## args) -#define DPAA_QDMA_WARN(fmt, args...) \ - DPAA_QDMA_LOG(WARNING, fmt, ## args) +#define DPAA_QDMA_INFO(fmt, ...) \ + DPAA_QDMA_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA_QDMA_ERR(fmt, ...) \ + DPAA_QDMA_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA_QDMA_WARN(fmt, ...) \ + DPAA_QDMA_LOG(WARNING, fmt, ## __VA_ARGS__) /* DP Logs, toggled out at compile time if level lower than current level */ #define DPAA_QDMA_DP_LOG(level, ...) \ RTE_LOG_DP_LINE(level, DPAA_QDMA, __VA_ARGS__) -#define DPAA_QDMA_DP_DEBUG(fmt, args...) \ - DPAA_QDMA_DP_LOG(DEBUG, fmt, ## args) -#define DPAA_QDMA_DP_INFO(fmt, args...) \ - DPAA_QDMA_DP_LOG(INFO, fmt, ## args) -#define DPAA_QDMA_DP_WARN(fmt, args...) \ - DPAA_QDMA_DP_LOG(WARNING, fmt, ## args) +#define DPAA_QDMA_DP_DEBUG(fmt, ...) \ + DPAA_QDMA_DP_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA_QDMA_DP_INFO(fmt, ...) \ + DPAA_QDMA_DP_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA_QDMA_DP_WARN(fmt, ...) \ + DPAA_QDMA_DP_LOG(WARNING, fmt, ## __VA_ARGS__) #endif /* __DPAA_QDMA_LOGS_H__ */ diff --git a/drivers/dma/dpaa2/dpaa2_qdma_logs.h b/drivers/dma/dpaa2/dpaa2_qdma_logs.h index 62ef60bcf2..50a865a56a 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma_logs.h +++ b/drivers/dma/dpaa2/dpaa2_qdma_logs.h @@ -20,23 +20,23 @@ extern int dpaa2_qdma_logtype; #define DPAA2_QDMA_FUNC_TRACE() DPAA2_QDMA_DEBUG(">>") -#define DPAA2_QDMA_INFO(fmt, args...) \ - DPAA2_QDMA_LOG(INFO, fmt, ## args) -#define DPAA2_QDMA_ERR(fmt, args...) \ - DPAA2_QDMA_LOG(ERR, fmt, ## args) -#define DPAA2_QDMA_WARN(fmt, args...) \ - DPAA2_QDMA_LOG(WARNING, fmt, ## args) +#define DPAA2_QDMA_INFO(fmt, ...) \ + DPAA2_QDMA_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_QDMA_ERR(fmt, ...) \ + DPAA2_QDMA_LOG(ERR, fmt, ## __VA_ARGS__) +#define DPAA2_QDMA_WARN(fmt, ...) \ + DPAA2_QDMA_LOG(WARNING, fmt, ## __VA_ARGS__) /* DP Logs, toggled out at compile time if level lower than current level */ #define DPAA2_QDMA_DP_LOG(level, ...) \ RTE_LOG_DP_LINE(level, DPAA2_QDMA, __VA_ARGS__) -#define DPAA2_QDMA_DP_DEBUG(fmt, args...) \ - DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## args) -#define DPAA2_QDMA_DP_INFO(fmt, args...) \ - DPAA2_QDMA_DP_LOG(INFO, fmt, ## args) -#define DPAA2_QDMA_DP_WARN(fmt, args...) \ - DPAA2_QDMA_DP_LOG(WARNING, fmt, ## args) +#define DPAA2_QDMA_DP_DEBUG(fmt, ...) \ + DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define DPAA2_QDMA_DP_INFO(fmt, ...) \ + DPAA2_QDMA_DP_LOG(INFO, fmt, ## __VA_ARGS__) +#define DPAA2_QDMA_DP_WARN(fmt, ...) \ + DPAA2_QDMA_DP_LOG(WARNING, fmt, ## __VA_ARGS__) #ifdef __cplusplus } diff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h index 99dc2b367e..b80a113455 100644 --- a/drivers/dma/idxd/idxd_internal.h +++ b/drivers/dma/idxd/idxd_internal.h @@ -25,10 +25,10 @@ extern int idxd_pmd_logtype; #define IDXD_PMD_LOG(level, ...) \ RTE_LOG_LINE_PREFIX(level, IDXD_PMD, "%s(): ", __func__, __VA_ARGS__) -#define IDXD_PMD_DEBUG(fmt, args...) IDXD_PMD_LOG(DEBUG, fmt, ## args) -#define IDXD_PMD_INFO(fmt, args...) IDXD_PMD_LOG(INFO, fmt, ## args) -#define IDXD_PMD_ERR(fmt, args...)IDXD_PMD_LOG(ERR, fmt, ## args) -#define IDXD_PMD_WARN(fmt, args...) IDXD_PMD_LOG(WARNING, fmt, ## args) +#define IDXD_PMD_DEBUG(fmt, ...) IDXD_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__) +#define IDXD_PMD_INFO(fmt, ...) IDXD_PMD_LOG(INFO, fmt, ## __VA_ARGS__) +#define IDXD_PMD_ERR(fmt, ...)IDXD_PMD_LOG(ERR, fmt, ## __VA_ARGS__) +#define IDXD_PMD_WARN(fmt, ...) IDXD_PMD_LOG(WARNING, fmt, ## __VA_ARGS__) struct idxd_pci_common { rte_spinlock_t lk; diff --git a/drivers/dma/ioat/i
[PATCH 18/21] lib/port: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- lib/port/rte_swx_port_ethdev.c | 2 +- lib/port/rte_swx_port_fd.c | 2 +- lib/port/rte_swx_port_ring.c| 2 +- lib/port/rte_swx_port_source_sink.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/port/rte_swx_port_ethdev.c b/lib/port/rte_swx_port_ethdev.c index 7cb3c4dfb1..71dabae826 100644 --- a/lib/port/rte_swx_port_ethdev.c +++ b/lib/port/rte_swx_port_ethdev.c @@ -25,7 +25,7 @@ do { \ #if TRACE_LEVEL #define TRACE(...) printf(__VA_ARGS__) #else -#define TRACE(...) +#define TRACE(...) do { } while (0) #endif /* diff --git a/lib/port/rte_swx_port_fd.c b/lib/port/rte_swx_port_fd.c index 4bbad2eaa7..f315db285f 100644 --- a/lib/port/rte_swx_port_fd.c +++ b/lib/port/rte_swx_port_fd.c @@ -18,7 +18,7 @@ #if TRACE_LEVEL #define TRACE(...) printf(__VA_ARGS__) #else -#define TRACE(...) +#define TRACE(...) do { } while (0) #endif /* diff --git a/lib/port/rte_swx_port_ring.c b/lib/port/rte_swx_port_ring.c index af541a2fa2..1f7abc0584 100644 --- a/lib/port/rte_swx_port_ring.c +++ b/lib/port/rte_swx_port_ring.c @@ -18,7 +18,7 @@ #if TRACE_LEVEL #define TRACE(...) printf(__VA_ARGS__) #else -#define TRACE(...) +#define TRACE(...) do { } while (0) #endif /* diff --git a/lib/port/rte_swx_port_source_sink.c b/lib/port/rte_swx_port_source_sink.c index 757a2c4a2e..9f080f2e93 100644 --- a/lib/port/rte_swx_port_source_sink.c +++ b/lib/port/rte_swx_port_source_sink.c @@ -28,7 +28,7 @@ do { \ #if TRACE_LEVEL #define TRACE(...) printf(__VA_ARGS__) #else -#define TRACE(...) +#define TRACE(...) do { } while (0) #endif /* -- 2.47.0.vfs.0.3
[PATCH 20/21] lib/rcu: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- lib/rcu/rte_rcu_qsbr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h index 550fadf56a..040bb273e9 100644 --- a/lib/rcu/rte_rcu_qsbr.h +++ b/lib/rcu/rte_rcu_qsbr.h @@ -52,7 +52,7 @@ extern int rte_rcu_log_type; RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __func__, __VA_ARGS__); \ } while (0) #else -#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, ...) +#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, ...) do { } while (0) #endif /* Registered thread IDs are stored as a bitmap of 64b element array. -- 2.47.0.vfs.0.3
[PATCH 16/21] lib/log: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- lib/log/rte_log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h index 3735137150..6b00caab88 100644 --- a/lib/log/rte_log.h +++ b/lib/log/rte_log.h @@ -364,7 +364,7 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) static_assert(!__builtin_strchr(fmt, '\n'), \ "This log format string contains a \\n") #else -#define RTE_LOG_CHECK_NO_NEWLINE(...) +#define RTE_LOG_CHECK_NO_NEWLINE(...) do { } while (0) #endif /** -- 2.47.0.vfs.0.3
[PATCH 17/21] lib/pipeline: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h index df864ea066..d6213bbe16 100644 --- a/lib/pipeline/rte_swx_pipeline_internal.h +++ b/lib/pipeline/rte_swx_pipeline_internal.h @@ -27,7 +27,7 @@ #if TRACE_LEVEL #define TRACE(...) printf(__VA_ARGS__) #else -#define TRACE(...) +#define TRACE(...) do { } while (0) #endif /* -- 2.47.0.vfs.0.3
[PATCH 19/21] lib/power: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- lib/power/power_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/power/power_common.h b/lib/power/power_common.h index 3f56b1103d..83a30858fe 100644 --- a/lib/power/power_common.h +++ b/lib/power/power_common.h @@ -20,7 +20,7 @@ extern int rte_power_logtype; #define POWER_DEBUG_LOG(...) \ RTE_LOG_LINE_PREFIX(ERR, POWER, "%s: ", __func__, __VA_ARGS__) #else -#define POWER_DEBUG_LOG(...) +#define POWER_DEBUG_LOG(...) do { } while (0) #endif /* check if scaling driver matches one we want */ -- 2.47.0.vfs.0.3
[PATCH 21/21] lib/vhost: ensure code structure does not change
Add "do { } while (0)" to macros used to remove logging calls, to ensure there's no code structure change when enabling/disabling logging. Signed-off-by: Andre Muezerie --- lib/vhost/vhost_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c index 7caf6d9afa..b5679380f5 100644 --- a/lib/vhost/vhost_crypto.c +++ b/lib/vhost/vhost_crypto.c @@ -33,7 +33,7 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO); RTE_LOG_LINE_PREFIX(DEBUG, VHOST_CRYPTO, "%s() line %u: ", \ __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #else -#define VC_LOG_DBG(...) +#define VC_LOG_DBG(...) do { } while (0) #endif #define VIRTIO_CRYPTO_FEATURES ((1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \ -- 2.47.0.vfs.0.3