igc/ixgbe: add get/set link settings interface
Subsystems (2)
PATCH 1/1 igc/ixgbe: add get/set link settings interface
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/ ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others. Additionally dpdk-testpmd application has been extended to provided testing tool for newly implemtented interface functions.
--- .mailmap | 1 + app/test-pmd/cmdline.c | 9 + app/test-pmd/cmdline_settings.c | 516 +++++++++++++++++++++++++++++ app/test-pmd/cmdline_settings.h | 14 + app/test-pmd/meson.build | 1 + app/test-pmd/testpmd.h | 1 + app/test-pmd/util.c | 10 + drivers/net/igc/igc_ethdev.c | 229 ++++++++++++- drivers/net/ixgbe/base/ixgbe_phy.h | 7 + drivers/net/ixgbe/ixgbe_ethdev.c | 395 ++++++++++++++++++++++ lib/ethdev/ethdev_driver.h | 33 ++ lib/ethdev/rte_ethdev.c | 26 ++ lib/ethdev/rte_ethdev.h | 215 +++++++++++- lib/ethdev/version.map | 3 + 14 files changed, 1450 insertions(+), 10 deletions(-) create mode 100644 app/test-pmd/cmdline_settings.c create mode 100644 app/test-pmd/cmdline_settings.h
.mailmap +1 -0
@@ -885,6 +885,7 @@ Marcin Wojtas <[email protected]> Marcin Zapolski <[email protected]> Marco Varlese <[email protected]> Marc Sune <[email protected]> <[email protected]> +Marek Pazdan <[email protected]> Maria Lingemark <[email protected]> Mario Carrillo <[email protected]> Mário Kuka <[email protected]>
app/test-pmd/cmdline.c +9 -0
@@ -65,6 +65,7 @@#include "cmdline_cman.h" #include "cmdline_mtr.h" #include "cmdline_tm.h" +#include "cmdline_settings.h" #include "bpf_cmd.h" static struct cmdline *testpmd_cl;
@@ -255,6 +256,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) flow_ctrl" " Show flow control info of a port.\n\n" +"show port (port_id) link settings" +" Show link settings of a port.\n\n" +"dump_physmem\n" " Dumps all physical memory segment layouts\n\n"
@@ -661,6 +665,9 @@ static void cmd_help_long_parsed(void *parsed_result,"(max_thresh) (prob_inv)]\n" " Set congestion management configuration\n\n" +"set port (port_id) link settings advertising (bitmap_str)" +" Set link advertising settings of a port.\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -13219,6 +13226,8 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, (cmdline_parse_inst_t *)&cmd_link_flow_control_show, + (cmdline_parse_inst_t *)&cmd_link_settings_show, + (cmdline_parse_inst_t *)&cmd_link_settings_set_advertising, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb,
app/test-pmd/cmdline_settings.c new file +516 -0
516 lines not on this page · raw message
app/test-pmd/cmdline_settings.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (c) 2024 Arista Networks, Inc. All rights reserved. +* Arista Networks, Inc. Confidential and Proprietary +*/ + +#ifndef _CMDLINE_SETTINGS_H +#define _CMDLINE_SETTINGS_H + +/* Link settings CLI */ +extern cmdline_parse_inst_t cmd_link_settings_show; +extern cmdline_parse_inst_t cmd_link_settings_set_advertising; + +#endif /* _CMDLINE_SETTINGS_H */ +
app/test-pmd/meson.build +1 -0
@@ -11,6 +11,7 @@ sources = files( 'cmdline_flow.c', 'cmdline_mtr.c', 'cmdline_tm.c', + 'cmdline_settings.c', 'cmd_flex_item.c', 'config.c', 'csumonly.c',
app/test-pmd/testpmd.h +1 -0
@@ -1187,6 +1187,7 @@ void eth_set_allmulticast_mode(uint16_t port, int enable);int eth_link_get_nowait_print_err (uint16_t port_id,struct rte_eth_link *link);int eth_macaddr_get_print_err (uint16_t port_id,struct rte_ether_addr *mac_addr); +int get_bit (const uint32_t *ptr,uint32_t pos);/* Functions to display the set of MAC addresses added to a port*/ void show_macs (portid_t port_id);
app/test-pmd/util.c +10 -0
@@ -17,6 +17,8 @@#define MAX_STRING_LEN 8192 +#define UINT_32_BIT_WIDTH (CHAR_BIT * sizeof(uint32_t)) +#define MKDUMPSTR (buf, buf_size, cur_len, ...) \ do { \ if (cur_len >= buf_size) \
@@ -525,3 +527,11 @@ eth_macaddr_get_print_err(uint16_t port_id, struct rte_ether_addr *mac_addr)return ret; } + +int +get_bit (const uint32_t *ptr,uint32_t pos) +{ +uint32_t byte_idx = pos /UINT_32_BIT_WIDTH ; +uint32_t bit_idx = pos %UINT_32_BIT_WIDTH ; +return (ptr[byte_idx] >> bit_idx) &0x1 ; +}
drivers/net/igc/igc_ethdev.c +227 -2
259 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_phy.h +7 -0
@@ -125,6 +125,13 @@/* SFP+ SFF-8472 Compliance */ #define IXGBE_SFF_SFF_8472_UNSUP 0x00 +#define IXGBE_SPEED_10000 10000 + +/* Duplex, half or full. */ +#define IXGBE_DUPLEX_HALF 0x00 +#define IXGBE_DUPLEX_FULL 0x01 +#define IXGBE_DUPLEX_UNKNOWN 0xff +s32 ixgbe_init_phy_ops_generic (struct ixgbe_hw *hw);bool ixgbe_validate_phy_addr (struct ixgbe_hw *hw,u32 phy_addr);enum ixgbe_phy_type ixgbe_get_phy_type_from_id (u32 phy_id);
drivers/net/ixgbe/ixgbe_ethdev.c +395 -0
425 lines not on this page · raw message
lib/ethdev/ethdev_driver.h +33 -0
@@ -1119,6 +1119,34 @@ typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rt*/ typedef int (*eth_dev_priv_dump_t )(struct rte_eth_dev *dev,FILE *file); +/** @internal Retrieve physical link settings of a port. +* +* @param dev +* Port (ethdev) handle +* +* @param[out] settings +* Physical port link settings. +* +* @return +* Negative errno value on error, zero otherwise +*/ +typedef int (*eth_get_link_settings_t )(struct rte_eth_dev *dev, +struct rte_link_settings *settings); + +/** @internal Configure physical link settings of a port. +* +* @param dev +* Port (ethdev) handle +* +* @param settings +* Physical port link settings. +* +* @return +* Negative errno value on error, zero otherwise +*/ +typedef int (*eth_set_link_settings_t )(struct rte_eth_dev *dev, +const struct rte_link_settings *settings); +/** * @internal Set Rx queue available descriptors threshold. * @see rte_eth_rx_avail_thresh_set()
@@ -1474,6 +1502,11 @@ struct eth_dev_ops {eth_count_aggr_ports_t count_aggr_ports;/** Map a Tx queue with an aggregated port of the DPDK port */ eth_map_aggr_tx_affinity_t map_aggr_tx_affinity; + +/** Retrieve physical link settings */ +eth_get_link_settings_t get_link_settings; +/** Configure physical link settings */ +eth_set_link_settings_t set_link_settings; };/**
lib/ethdev/rte_ethdev.c +26 -0
@@ -6844,6 +6844,32 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)return eth_err (port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); } +int rte_eth_dev_get_link_settings (uint16_t port_id, +struct rte_link_settings *settings) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->get_link_settings ==NULL ) +return -ENOTSUP ; +return eth_err (port_id, (*dev->dev_ops->get_link_settings)(dev, settings)); +} + +int rte_eth_dev_set_link_settings (uint16_t port_id, +const struct rte_link_settings *settings) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->set_link_settings ==NULL ) +return -ENOTSUP ; +return eth_err (port_id, (*dev->dev_ops->set_link_settings)(dev, settings)); +} +int rte_eth_rx_descriptor_dump (uint16_t port_id,uint16_t queue_id,uint16_t offset,uint16_t num,FILE *file)
lib/ethdev/rte_ethdev.h +207 -8
239 lines not on this page · raw message
lib/ethdev/version.map +3 -0
@@ -325,6 +325,9 @@ EXPERIMENTAL { rte_flow_template_table_resizable; rte_flow_template_table_resize; rte_flow_template_table_resize_complete; + rte_eth_dev_get_link_settings; + rte_eth_dev_set_link_settings; + }; INTERNAL {
Signature · 1 line
2.41.0
Quoted 22 lines · Marek Pazdan
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others. Additionally dpdk-testpmd application has been extended to provided testing tool for newly implemtented interface functions.Signed-off-by Marek Pazdan <[email protected]>--- .mailmap | 1 + app/test-pmd/cmdline.c | 9 + app/test-pmd/cmdline_settings.c | 516 +++++++++++++++++++++++++++++ app/test-pmd/cmdline_settings.h | 14 + app/test-pmd/meson.build | 1 + app/test-pmd/testpmd.h | 1 + app/test-pmd/util.c | 10 + drivers/net/igc/igc_ethdev.c | 229 ++++++++++++- drivers/net/ixgbe/base/ixgbe_phy.h | 7 +
Quoted 9 lines
drivers/net/ixgbe/ixgbe_ethdev.c | 395 ++++++++++++++++++++++ lib/ethdev/ethdev_driver.h | 33 ++ lib/ethdev/rte_ethdev.c | 26 ++ lib/ethdev/rte_ethdev.h | 215 +++++++++++- lib/ethdev/version.map | 3 + 14 files changed, 1450 insertions(+), 10 deletions(-) create mode 100644 app/test-pmd/cmdline_settings.c create mode 100644 app/test-pmd/cmdline_settings.h
Hi Marek,
it seems this patch is not just for igc and ixgbe drivers, but is adding a new feature and pair of functions to ethdev, correct? In order to simplify review, can you please split this patch up into multiple patches based on component, for example, ethdev hooks, then testpmd calls using those hooks and finally the individual driver changes to implement the new functions. Even the driver changes could probably be omitted, if you want, for the early versions of the patchset, as we'd need to get agreement on the ethdev APIs before looking at specific implementations in detail.
Thanks for the contribution,
/Bruce
PATCH 1/1 lib: add get/set link settings interface
In reply to Marek Pazdan There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/ ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.
--- .mailmap | 1 + lib/ethdev/ethdev_driver.h | 33 ++++++ lib/ethdev/rte_ethdev.c | 26 +++++ lib/ethdev/rte_ethdev.h | 215 +++++++++++++++++++++++++++++++++++-- lib/ethdev/version.map | 3 + 5 files changed, 270 insertions(+), 8 deletions(-)
.mailmap +1 -0
@@ -885,6 +885,7 @@ Marcin Wojtas <[email protected]> Marcin Zapolski <[email protected]> Marco Varlese <[email protected]> Marc Sune <[email protected]> <[email protected]> +Marek Pazdan <[email protected]> Maria Lingemark <[email protected]> Mario Carrillo <[email protected]> Mário Kuka <[email protected]>
lib/ethdev/ethdev_driver.h +33 -0
@@ -1119,6 +1119,34 @@ typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rt*/ typedef int (*eth_dev_priv_dump_t )(struct rte_eth_dev *dev,FILE *file); +/** @internal Retrieve physical link settings of a port. +* +* @param dev +* Port (ethdev) handle +* +* @param[out] settings +* Physical port link settings. +* +* @return +* Negative errno value on error, zero otherwise +*/ +typedef int (*eth_get_link_settings_t )(struct rte_eth_dev *dev, +struct rte_link_settings *settings); + +/** @internal Configure physical link settings of a port. +* +* @param dev +* Port (ethdev) handle +* +* @param settings +* Physical port link settings. +* +* @return +* Negative errno value on error, zero otherwise +*/ +typedef int (*eth_set_link_settings_t )(struct rte_eth_dev *dev, +const struct rte_link_settings *settings); +/** * @internal Set Rx queue available descriptors threshold. * @see rte_eth_rx_avail_thresh_set()
@@ -1474,6 +1502,11 @@ struct eth_dev_ops {eth_count_aggr_ports_t count_aggr_ports;/** Map a Tx queue with an aggregated port of the DPDK port */ eth_map_aggr_tx_affinity_t map_aggr_tx_affinity; + +/** Retrieve physical link settings */ +eth_get_link_settings_t get_link_settings; +/** Configure physical link settings */ +eth_set_link_settings_t set_link_settings; };/**
lib/ethdev/rte_ethdev.c +26 -0
@@ -6844,6 +6844,32 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)return eth_err (port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); } +int rte_eth_dev_get_link_settings (uint16_t port_id, +struct rte_link_settings *settings) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->get_link_settings ==NULL ) +return -ENOTSUP ; +return eth_err (port_id, (*dev->dev_ops->get_link_settings)(dev, settings)); +} + +int rte_eth_dev_set_link_settings (uint16_t port_id, +const struct rte_link_settings *settings) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->set_link_settings ==NULL ) +return -ENOTSUP ; +return eth_err (port_id, (*dev->dev_ops->set_link_settings)(dev, settings)); +} +int rte_eth_rx_descriptor_dump (uint16_t port_id,uint16_t queue_id,uint16_t offset,uint16_t num,FILE *file)
lib/ethdev/rte_ethdev.h +207 -8
239 lines not on this page · raw message
lib/ethdev/version.map +3 -0
@@ -325,6 +325,9 @@ EXPERIMENTAL { rte_flow_template_table_resizable; rte_flow_template_table_resize; rte_flow_template_table_resize_complete; + rte_eth_dev_get_link_settings; + rte_eth_dev_set_link_settings; + }; INTERNAL {
Signature · 1 line
2.41.0
Re: [PATCH] lib: add get/set link settings interface
03/04/2024 15:59, Marek Pazdan:
Quoted 8 lines
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.
Which information is missing exactly?
Why are you trying to mimic ethtool API?
Please let's add what is missing instead of adding a full new API.
Re: [PATCH] lib: add get/set link settings interface
Hi Thomas,
Information like advertising: speed, pause, autonegotiation etc. and that same for link partner advertising.
I try to mimic ethtool since it's a common, well known and widely used tool so adding an API which provides the same set of information in case the interface is passthrough to dpdk will be useful I think.
I've 2 more patches dependent on the one we are discussing now, but I need patchwork id to add dependency information. I need moderator approval for the current patch.
Regards,
Marek
Quoted 17 lines · Thomas Monjalon
03/04/2024 15:59, Marek Pazdan:
Quoted 8 lines
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.Which information is missing exactly?
Why are you trying to mimic ethtool API?Please let's add what is missing instead of adding a full new API.
Re: [PATCH] lib: add get/set link settings interface
03/04/2024 16:59, Marek Pazdan:
Quoted 4 lines
Hi Thomas,
Information like advertising: speed, pause, autonegotiation etc. and that same for link partner advertising.
speed and duplex are already provided in some existing API.
Quoted 3 lines
I try to mimic ethtool since it's a common, well known and widely used tool so adding an API which provides the same set of information in case the interface is passthrough to dpdk will be useful I think.
DPDK API is widely used as well :)
I am not sure adding a new API for the same thing is a good idea.
Quoted 3 lines
I've 2 more patches dependent on the one we are discussing now, but I need patchwork id to add dependency information. I need moderator approval for the current patch.
I've approved your mails,
but you would not need a manual approval if you register. Note that you can disable receiving other threads in ML options. See an explanation here:
https://www.dpdk.org/first-patch-submission-to-the-dpdk-open-source-project/
Quoted 16 lines · Thomas Monjalon
Quoted 15 lines
03/04/2024 15:59, Marek Pazdan:
Quoted 8 lines
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.Which information is missing exactly?
Why are you trying to mimic ethtool API?Please let's add what is missing instead of adding a full new API.
Re: [PATCH] lib: add get/set link settings interface
In reply to Marek PazdanQuoted 11 lines · On Wed, 3 Apr 2024 16:59:08 +0200 Marek Pazdan <[email protected]> wrote:
Hi Thomas,
Information like advertising: speed, pause, autonegotiation etc. and that same for link partner advertising.
I try to mimic ethtool since it's a common, well known and widely used tool so adding an API which provides the same set of information in case the interface is passthrough to dpdk will be useful I think.
I've 2 more patches dependent on the one we are discussing now, but I need patchwork id to add dependency information. I need moderator approval for the current patch.
Quoted 2 lines
Regards,
Marek
DPDK already had this info under rte_eth_conf and it is supported on all drivers. Why introduce yet another API and only for some drivers?
Re: [PATCH] lib: add get/set link settings interface
I can remove this part (rte_eth_config), but the new API provides other link information which is not available from the existing API, like supported/advertising/partner_advertising link modes. Additionally from what I see, rte_eth_confg is available from rte_eth_dev_conf_get API and it's copy of requested configuration:memcpy(dev_conf, &dev->data->dev_conf, sizeof(struct rte_eth_conf));
Quoted 22 lines · Stephen Hemminger
Quoted 5 lines · On Wed, 3 Apr 2024 16:59:08 +0200 Marek Pazdan <[email protected]> wrote:
Hi Thomas,
Information like advertising: speed, pause, autonegotiation etc. and that same for link partner advertising.
I try to mimic ethtool since it's a common, well known and widely usedtool
Quoted 3 lines
so adding an API which provides the same set of information in case the interface is passthrough to dpdk will be useful I think. I've 2 more patches dependent on the one we are discussing now, but I
need
Quoted 5 lines
patchwork id to add dependency information. I need moderator approval for the current patch.
Regards,
MarekDPDK already had this info under
rte_eth_confand it is supported on all drivers. Why introduce yet another API and only for some drivers?
Re: [PATCH] lib: add get/set link settings interface
Quoted 6 lines · On Thu, 4 Apr 2024 00:08:41 +0200 Marek Pazdan <[email protected]> wrote:
I can remove this part (
rte_eth_config), but the new API provides other link information which is not available from the existing API, like supported/advertising/partner_advertising link modes. Additionally from what I see,rte_eth_confgis available fromrte_eth_dev_conf_getAPI and it's copy of requested configuration:memcpy(dev_conf, &dev->data->dev_conf, sizeof(struct rte_eth_conf));
Then the new info should go in the rte_eth_config in a future version of DPDK. Having bits in different places makes the API confusing.
Re: [PATCH] lib: add get/set link settings interface
Quoted 11 lines · Stephen Hemminger
Quoted 6 lines · On Thu, 4 Apr 2024 00:08:41 +0200 Marek Pazdan <[email protected]> wrote:
I can remove this part (
rte_eth_config), but the new API provides other link information which is not available from the existing API, like supported/advertising/partner_advertising link modes. Additionally from what I see,rte_eth_confgis available fromrte_eth_dev_conf_getAPI and it's copy of requested configuration:memcpy(dev_conf, &dev->data->dev_conf, sizeof(struct rte_eth_conf));
Quoted 3 lines
Then the new info should go in the
rte_eth_configin a future version of DPDK. Having bits in different places makes the API confusing.
Hi Marek,
Not able to get enough justification for the new set of ethdev APIs for the link.
It can be an option to extend existing APIs, and have a more focused API for the missing part. This depends on what is missing.
I am marking this patch and two relevant patches [1] as change requested, if the functionality is still relevant please start with a new RFC in next release with one of the above approaches to enable discussion again.
Thanks,
ferruh
[1]
-
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
-
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
PATCH 1/1 lib: add get/set link settings interface
In reply to Marek Pazdan There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/ ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.
--- .mailmap | 1 + lib/ethdev/ethdev_driver.h | 33 ++++++ lib/ethdev/rte_ethdev.c | 26 +++++ lib/ethdev/rte_ethdev.h | 215 +++++++++++++++++++++++++++++++++++-- lib/ethdev/version.map | 3 + 5 files changed, 270 insertions(+), 8 deletions(-)
.mailmap +1 -0
@@ -885,6 +885,7 @@ Marcin Wojtas <[email protected]> Marcin Zapolski <[email protected]> Marco Varlese <[email protected]> Marc Sune <[email protected]> <[email protected]> +Marek Pazdan <[email protected]> Maria Lingemark <[email protected]> Mario Carrillo <[email protected]> Mário Kuka <[email protected]>
lib/ethdev/ethdev_driver.h +33 -0
@@ -1119,6 +1119,34 @@ typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rt*/ typedef int (*eth_dev_priv_dump_t )(struct rte_eth_dev *dev,FILE *file); +/** @internal Retrieve physical link settings of a port. +* +* @param dev +* Port (ethdev) handle +* +* @param[out] settings +* Physical port link settings. +* +* @return +* Negative errno value on error, zero otherwise +*/ +typedef int (*eth_get_link_settings_t )(struct rte_eth_dev *dev, +struct rte_link_settings *settings); + +/** @internal Configure physical link settings of a port. +* +* @param dev +* Port (ethdev) handle +* +* @param settings +* Physical port link settings. +* +* @return +* Negative errno value on error, zero otherwise +*/ +typedef int (*eth_set_link_settings_t )(struct rte_eth_dev *dev, +const struct rte_link_settings *settings); +/** * @internal Set Rx queue available descriptors threshold. * @see rte_eth_rx_avail_thresh_set()
@@ -1474,6 +1502,11 @@ struct eth_dev_ops {eth_count_aggr_ports_t count_aggr_ports;/** Map a Tx queue with an aggregated port of the DPDK port */ eth_map_aggr_tx_affinity_t map_aggr_tx_affinity; + +/** Retrieve physical link settings */ +eth_get_link_settings_t get_link_settings; +/** Configure physical link settings */ +eth_set_link_settings_t set_link_settings; };/**
lib/ethdev/rte_ethdev.c +26 -0
@@ -6844,6 +6844,32 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)return eth_err (port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); } +int rte_eth_dev_get_link_settings (uint16_t port_id, +struct rte_link_settings *settings) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->get_link_settings ==NULL ) +return -ENOTSUP ; +return eth_err (port_id, (*dev->dev_ops->get_link_settings)(dev, settings)); +} + +int rte_eth_dev_set_link_settings (uint16_t port_id, +const struct rte_link_settings *settings) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->set_link_settings ==NULL ) +return -ENOTSUP ; +return eth_err (port_id, (*dev->dev_ops->set_link_settings)(dev, settings)); +} +int rte_eth_rx_descriptor_dump (uint16_t port_id,uint16_t queue_id,uint16_t offset,uint16_t num,FILE *file)
lib/ethdev/rte_ethdev.h +207 -8
239 lines not on this page · raw message
lib/ethdev/version.map +3 -0
@@ -325,6 +325,9 @@ EXPERIMENTAL { rte_flow_template_table_resizable; rte_flow_template_table_resize; rte_flow_template_table_resize_complete; + rte_eth_dev_get_link_settings; + rte_eth_dev_set_link_settings; + }; INTERNAL {
Signature · 1 line
2.41.0
Re: [PATCH] lib: add get/set link settings interface
Quoted 16 lines · Marek Pazdan
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.Signed-off-by Marek Pazdan <[email protected]>---
lib/ethdev/rte_ethdev.h +0
-0
lib/ethdev/rte_ethdev.h struct rte_eth_stats { · line 341
Quoted 8 lines
lib/ethdev/rte_ethdev.h +1
-1@@ -335,7 +335,7 @@ struct rte_eth_stats { __extension__ struct __rte_aligned(8) rte_eth_link { /**< aligned for atomic64 read/write */uint32_t link_speed;/**< RTE_ETH_SPEED_NUM_ */ - uint16_t link_duplex : 1; /**< RTE_ETH_LINK_[HALF/FULL]_DUPLEX */ + uint16_t link_duplex : 2; /**< RTE_ETH_LINK_[HALF/FULL/UNKNOWN]_DUPLEX */ uint16_t link_autoneg : 1; /**< RTE_ETH_LINK_[AUTONEG/FIXED] */ uint16_t link_status : 1; /**< RTE_ETH_LINK_[DOWN/UP] */ };
this breaks the abi. David does libabigail pick this up i wonder?
Re: [PATCH] lib: add get/set link settings interface
Hello Tyler, Marek,
Quoted 20 lines · Tyler Retzlaff
Quoted 18 lines · Marek Pazdan
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.Signed-off-by Marek Pazdan <[email protected]>---
lib/ethdev/rte_ethdev.h +0
-0@@ -335,7 +335,7 @@ struct rte_eth_stats { __extension__ struct __rte_aligned(8) rte_eth_link { /**< aligned for atomic64 read/write */
Quoted 9 lines
lib/ethdev/rte_ethdev.h struct rte_eth_stats { · line 341
Quoted 6 lines
lib/ethdev/rte_ethdev.h +1
-1uint32_t link_speed;/**< RTE_ETH_SPEED_NUM_ */ - uint16_t link_duplex : 1; /**< RTE_ETH_LINK_[HALF/FULL]_DUPLEX */ + uint16_t link_duplex : 2; /**< RTE_ETH_LINK_[HALF/FULL/UNKNOWN]_DUPLEX */ uint16_t link_autoneg : 1; /**< RTE_ETH_LINK_[AUTONEG/FIXED] */ uint16_t link_status : 1; /**< RTE_ETH_LINK_[DOWN/UP] */ };this breaks the abi. David does libabigail pick this up i wonder?
Yes, the CI flagged it.
Looking at the UNH report (in patchwork):
http://mails.dpdk.org/archives/test-report/2024-April/631222.html
1 function with some indirect sub-type change:
[C] 'function int rte_eth_link_get(uint16_t, rte_eth_link*)' at rte_ethdev.c:2972:1 has some indirect sub-type changes:
parameter 2 of type 'rte_eth_link*' has sub-type changes:
in pointed to type 'struct rte_eth_link' at rte_ethdev.h:336:1:
type size hasn't changed
2 data member changes:
'uint16_t link_autoneg' offset changed from 33 to 34 (in bits) (by +1 bits) 'uint16_t link_status' offset changed from 34 to 35 (in bits) (by +1 bits)
Error: ABI issue reported for abidiff --suppr /home-local/jenkins-local/jenkins-agent/workspace/Generic-DPDK-Compile-ABI at 3/dpdk/devtools/libabigail.abignore --no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 build_install/usr/local/include reference/usr/local/lib/x86_64-linux-gnu/librte_ethdev.so.24.0 build_install/usr/local/lib/x86_64-linux-gnu/librte_ethdev.so.24.2 ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).
GHA would have caught it too, but the documentation generation failed before reaching the ABI check.
http://mails.dpdk.org/archives/test-report/2024-April/631086.html
Signature · 1 line
David Marchand
Re: [PATCH] lib: add get/set link settings interface
Quoted 34 lines · David Marchand
Hello Tyler, Marek,
Quoted 20 lines · Tyler Retzlaff
Quoted 18 lines · Marek Pazdan
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.Signed-off-by Marek Pazdan <[email protected]>---
lib/ethdev/rte_ethdev.h +0
-0@@ -335,7 +335,7 @@ struct rte_eth_stats { __extension__ struct __rte_aligned(8) rte_eth_link { /**< aligned for atomic64 read/write */Quoted 9 lines
lib/ethdev/rte_ethdev.h struct rte_eth_stats { · line 341
Quoted 6 lines
lib/ethdev/rte_ethdev.h +1
-1uint32_t link_speed;/**< RTE_ETH_SPEED_NUM_ */ - uint16_t link_duplex : 1; /**< RTE_ETH_LINK_[HALF/FULL]_DUPLEX */ + uint16_t link_duplex : 2; /**< RTE_ETH_LINK_[HALF/FULL/UNKNOWN]_DUPLEX */ uint16_t link_autoneg : 1; /**< RTE_ETH_LINK_[AUTONEG/FIXED] */ uint16_t link_status : 1; /**< RTE_ETH_LINK_[DOWN/UP] */ };this breaks the abi. David does libabigail pick this up i wonder?
Quoted 4 lines
Yes, the CI flagged it.
Looking at the UNH report (in patchwork):
http://mails.dpdk.org/archives/test-report/2024-April/631222.html
i'm jealous we don't have libabigail on windows, so helpfull.
Quoted 30 lines
1 function with some indirect sub-type change:
[C] 'function int
rte_eth_link_get(uint16_t, rte_eth_link*)' at rte_ethdev.c:2972:1 has some indirect sub-type changes:
parameter 2 of type 'rte_eth_link*' has sub-type changes:
in pointed to type 'structrte_eth_link' at rte_ethdev.h:336:1:
type size hasn't changed
2 data member changes:
'uint16_tlink_autoneg' offset changed from 33 to 34 (in bits) (by +1 bits) 'uint16_tlink_status' offset changed from 34 to 35 (in bits) (by +1 bits)Error: ABI issue reported for abidiff --suppr /home-local/jenkins-local/jenkins-agent/workspace/Generic-DPDK-Compile-ABI at 3/dpdk/devtools/libabigail.abignore --no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 build_install/usr/local/include reference/usr/local/lib/x86_64-linux-gnu/librte_ethdev.so.24.0 build_install/usr/local/lib/x86_64-linux-gnu/librte_ethdev.so.24.2
ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).GHA would have caught it too, but the documentation generation failed before reaching the ABI check.
http://mails.dpdk.org/archives/test-report/2024-April/631086.htmlSignature · 1 line
David Marchand
Re: [PATCH] lib: add get/set link settings interface
Quoted 35 lines · Tyler Retzlaff
Quoted 34 lines · David Marchand
Hello Tyler, Marek,
Quoted 29 lines · Tyler Retzlaff
Quoted 16 lines · Marek Pazdan
There are link settings parameters available from PMD drivers level which are currently not exposed to the user via consistent interface. When interface is available for system level those information can be acquired with 'ethtool DEVNAME' (ioctl: ETHTOOL_SLINKSETTINGS/
ETHTOOL_GLINKSETTINGS). There are use cases where
physical interface is passthrough to dpdk driver and is not available from system level. Information provided by ioctl carries information useful for link auto negotiation settings among others.Signed-off-by Marek Pazdan <[email protected]>---
lib/ethdev/rte_ethdev.h +0
-0lib/ethdev/rte_ethdev.h struct rte_eth_stats { · line 341
Quoted 8 lines
lib/ethdev/rte_ethdev.h +1
-1@@ -335,7 +335,7 @@ struct rte_eth_stats { __extension__ struct __rte_aligned(8) rte_eth_link { /**< aligned for atomic64 read/write */uint32_t link_speed;/**< RTE_ETH_SPEED_NUM_ */ - uint16_t link_duplex : 1; /**< RTE_ETH_LINK_[HALF/FULL]_DUPLEX */ + uint16_t link_duplex : 2; /**< RTE_ETH_LINK_[HALF/FULL/UNKNOWN]_DUPLEX */ uint16_t link_autoneg : 1; /**< RTE_ETH_LINK_[AUTONEG/FIXED] */ uint16_t link_status : 1; /**< RTE_ETH_LINK_[DOWN/UP] */ };this breaks the abi. David does libabigail pick this up i wonder?
Quoted 6 lines
Quoted 4 lines
Yes, the CI flagged it.
Looking at the UNH report (in patchwork):
http://mails.dpdk.org/archives/test-report/2024-April/631222.htmli'm jealous we don't have libabigail on windows, so helpfull.
s/ll/l/ end of day bah.
Quoted 31 lines
Quoted 31 lines
1 function with some indirect sub-type change:
[C] 'function int
rte_eth_link_get(uint16_t, rte_eth_link*)' at rte_ethdev.c:2972:1 has some indirect sub-type changes:
parameter 2 of type 'rte_eth_link*' has sub-type changes:
in pointed to type 'structrte_eth_link' at rte_ethdev.h:336:1:
type size hasn't changed
2 data member changes:
'uint16_tlink_autoneg' offset changed from 33 to 34 (in bits) (by +1 bits) 'uint16_tlink_status' offset changed from 34 to 35 (in bits) (by +1 bits)Error: ABI issue reported for abidiff --suppr /home-local/jenkins-local/jenkins-agent/workspace/Generic-DPDK-Compile-ABI at 3/dpdk/devtools/libabigail.abignore --no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 build_install/usr/local/include reference/usr/local/lib/x86_64-linux-gnu/librte_ethdev.so.24.0 build_install/usr/local/lib/x86_64-linux-gnu/librte_ethdev.so.24.2
ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).GHA would have caught it too, but the documentation generation failed before reaching the ABI check.
http://mails.dpdk.org/archives/test-report/2024-April/631086.htmlSignature · 1 line
David Marchand
Re: [PATCH] lib: add get/set link settings interface
In reply to Tyler RetzlaffQuoted 10 lines · Tyler Retzlaff
Quoted 7 lines · David Marchand
On Wed, Apr 3, 2024 at 6:49 PM Tyler Retzlaff
Quoted 1 line
this breaks the abi. David does libabigail pick this up i wonder?
Yes, the CI flagged it.
Looking at the UNH report (in patchwork):
http://mails.dpdk.org/archives/test-report/2024-April/631222.htmli'm jealous we don't have libabigail on windows, so helpful.
libabigail is written in C++ and relies on the elfutils and libxml2 libraries. I am unclear about what binary format is used in Windows... so I am not sure how much work would be required to have it on Windows.
That's more something to discuss with Dodji :-).
Signature · 1 line
David Marchand
Re: [PATCH] lib: add get/set link settings interface
Hello,
Quoted 1 line
On Fri, Apr 5, 2024 at 2:55 AM Tyler Retzlaff
[...]
Quoted 1 line
Quoted 1 line
i'm jealous we don't have libabigail on windows, so helpful.
Heh, thank you for the kind words.
David Marchand <[email protected]> writes:
[...]
Quoted 2 lines
libabigail is written in C++ and relies on the elfutils and libxml2 libraries.
That is correct. Thank you for chiming in, David.
Quoted 2 lines
I am unclear about what binary format is used in Windows... so I am not sure how much work would be required to have it on Windows.
So for a little bit of context, libabigail constructs its own internal representation (IR) of the artifacts relevant to perform the analysis. The middle-end of the system then performs the needed analysis on that IR.
The binary format itself it handled by a front-end. Today, we have front-ends that reads the ELF format and constructs the IR and hands it over to the middle end.
One could very well imagine a new front-end that knows how to read the Portable Executable (PE) format that is used on Windows, along with its accompanying debug information.
Luckily, I've written articles[1][2] that explains how libabigail recently switched to having a multi-front-end architecture that we have used to support alternative debug information formats like CTF[3] and BTF.
In light of that, adding a new PE front-end would be "just work to do", I would think. And I would obviously not be opposed to helping such a project and merging the result in the end.
As for any feature request, I would encourage potentially interested parties to file an "enhancement request" on the bug tracker of the project[4].
Quoted 1 line
That's more something to discuss with Dodji :-).
Thanks for the plug ;-)
I hope this helps.
[1]: https://developers.redhat.com/articles/2023/01/05/libabigail-multiple-debugging-formats#the_resulting_multi_front_end_architecture
[2]: https://www.redhat.com/en/blog/bpf-type-format-support-libabigail-23
[3]: https://lwn.net/Articles/795384/
[4]: https://sourceware.org/bugzilla/enter_bug.cgi?product=libabigail
Cheers,
Signature · 1 line
Dodji