mlx5e rc2 misc patches
Subsystems (6)
Tariq Toukan
maintainercover mlx5e rc2 misc patches
Hi,
This patchset includes small features and a cleanup for the mlx5e driver.
Patches 1-2 by Cosmin implements FEC settings for 100G/lane modes.
Patch 3-4 by Carolina adds generic rep-port ethtool stats group and implements an mlx5e counter that exposes RX packet drops of VFs/SFs on their representor.
Patch 5 is a simple cleanup.
Series generated against:
commit 57a03d83f229 ("Merge branch 'mlxsw-preparations-for-improving-performance'")
Thanks,
Tariq.
Carolina Jubran (2):
ethtool: add interface to read representor Rx statistics net/mlx5e: Expose the VF/SF RX drop counter on the representor
Cosmin Ratiu (2):
net/mlx5e: Extract checking of FEC support for a link mode net/mlx5e: Support FEC settings for 100G/lane modes
Tariq Toukan (1):
net/mlx5e: Un-expose functions in en.h
drivers/net/ethernet/mellanox/mlx5/core/en.h | 12 ----- .../net/ethernet/mellanox/mlx5/core/en/port.c | 50 ++++++++++++++++--- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 22 ++++---- .../net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 48 ++++++++++++++++++ .../ethernet/mellanox/mlx5/core/en_stats.h | 3 ++ include/linux/ethtool.h | 16 ++++++ include/linux/mlx5/mlx5_ifc.h | 20 +++++++- include/uapi/linux/ethtool.h | 2 + include/uapi/linux/ethtool_netlink.h | 10 ++++ net/ethtool/netlink.h | 1 + net/ethtool/stats.c | 31 ++++++++++++ net/ethtool/strset.c | 5 ++ 13 files changed, 190 insertions(+), 32 deletions(-)
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 1/5 net/mlx5e: Extract checking of FEC support for a link mode
From: Cosmin Ratiu <[email protected]>
The check of whether a given FEC mode is supported in a given link mode is about to get more complicated, so extract it in a separate function to avoid code duplication.
--- .../net/ethernet/mellanox/mlx5/core/en/port.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +11 -5
@@ -308,6 +308,14 @@ enum mlx5e_fec_supported_link_mode { *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \ }while (0 ) +/* Returns true if FEC can be set for a given link mode. */ +static bool mlx5e_is_fec_supported_link_mode(struct mlx5_core_dev *dev, +enum mlx5e_fec_supported_link_mode link_mode) +{ +return link_mode <MLX5E_FEC_FIRST_50G_PER_LANE_MODE || +MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm); +} +/* get/set FEC admin field for a given speed */ static int mlx5e_fec_admin_field (u32 *pplm,u16 *fec_policy,bool write,enum mlx5e_fec_supported_link_mode link_mode)
@@ -389,7 +397,6 @@ static int mlx5e_get_fec_cap_field(u32 *pplm, u16 *fec_cap,bool mlx5e_fec_in_caps (struct mlx5_core_dev *dev,int fec_policy) { -bool fec_50g_per_lane =MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm);u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg);
@@ -407,7 +414,7 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) {u16 fec_caps; -if (i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE && !fec_50g_per_lane) +if (!mlx5e_is_fec_supported_link_mode (dev, i))break ;mlx5e_get_fec_cap_field (out, &fec_caps, i);
@@ -420,7 +427,6 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)int mlx5e_get_fec_mode (struct mlx5_core_dev *dev,u32 *fec_mode_active,u16 *fec_configured_mode) { -bool fec_50g_per_lane =MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm);u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg);
@@ -445,7 +451,7 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active, *fec_configured_mode =0 ;for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) { -if (i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE && !fec_50g_per_lane) +if (!mlx5e_is_fec_supported_link_mode (dev, i))break ;mlx5e_fec_admin_field (out, fec_configured_mode,0 , i);
@@ -489,7 +495,7 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy)u16 conf_fec = fec_policy;u16 fec_caps =0 ; -if (i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE && !fec_50g_per_lane) +if (!mlx5e_is_fec_supported_link_mode (dev, i))break ;/* RS fec in ethtool is mapped to MLX5E_FEC_RS_528_514
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 2/5 net/mlx5e: Support FEC settings for 100G/lane modes
In reply to Tariq ToukanFrom: Cosmin Ratiu <[email protected]>
This consists of:
1. Expose the 100G/lane capability bit in the PCAM reg.
2. Expose the per link mode FEC capability masks in the PPLM reg.
3. Set the overrides according to ethtool parameters.
FEC for new modes is set if and only if the PCAM 100G/lane capability is advertised and the capability mask for a given link mode reports that it can accept the requested FEC mode.
--- .../net/ethernet/mellanox/mlx5/core/en/port.c | 36 +++++++++++++++++-- include/linux/mlx5/mlx5_ifc.h | 20 +++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +34 -2
@@ -292,10 +292,15 @@ enum mlx5e_fec_supported_link_mode {MLX5E_FEC_SUPPORTED_LINK_MODE_100G_2X ,MLX5E_FEC_SUPPORTED_LINK_MODE_200G_4X ,MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X , +MLX5E_FEC_SUPPORTED_LINK_MODE_100G_1X , +MLX5E_FEC_SUPPORTED_LINK_MODE_200G_2X , +MLX5E_FEC_SUPPORTED_LINK_MODE_400G_4X , +MLX5E_FEC_SUPPORTED_LINK_MODE_800G_8X , MLX5E_MAX_FEC_SUPPORTED_LINK_MODE, };#define MLX5E_FEC_FIRST_50G_PER_LANE_MODE MLX5E_FEC_SUPPORTED_LINK_MODE_50G_1X +#define MLX5E_FEC_FIRST_100G_PER_LANE_MODE MLX5E_FEC_SUPPORTED_LINK_MODE_100G_1X#define MLX5E_FEC_OVERRIDE_ADMIN_POLICY (buf, policy, write, link) \ do { \
@@ -313,7 +318,10 @@ static bool mlx5e_is_fec_supported_link_mode(struct mlx5_core_dev *dev, enum mlx5e_fec_supported_link_mode link_mode) {return link_mode <MLX5E_FEC_FIRST_50G_PER_LANE_MODE || -MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm); + (link_mode <MLX5E_FEC_FIRST_100G_PER_LANE_MODE && +MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm)) || + (link_mode >=MLX5E_FEC_FIRST_100G_PER_LANE_MODE && +MLX5_CAP_PCAM_FEATURE (dev, fec_100G_per_lane_in_pplm)); }/* get/set FEC admin field for a given speed */
@@ -348,6 +356,18 @@ static int mlx5e_fec_admin_field(u32 *pplm, u16 *fec_policy, bool write,case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X : MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 400g_8x);break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_100G_1X : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 100g_1x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_200G_2X : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 200g_2x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_4X : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 400g_4x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_800G_8X : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 800g_8x); +break ;default :return -EINVAL ; }
@@ -389,6 +409,18 @@ static int mlx5e_get_fec_cap_field(u32 *pplm, u16 *fec_cap,case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X : *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 400g_8x);break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_100G_1X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 100g_1x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_200G_2X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 200g_2x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_4X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 400g_4x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_800G_8X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 800g_8x); +break ;default :return -EINVAL ; }
@@ -501,7 +533,7 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy)/* RS fec in ethtool is mapped to MLX5E_FEC_RS_528_514 * to link modes up to 25G per lane and to * MLX5E_FEC_RS_544_514 in the new link modes based on -* 50 G per lane +* 50G or 100G per lane */ if (conf_fec == (1 <<MLX5E_FEC_RS_528_514 ) && i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE )
include/linux/mlx5/mlx5_ifc.h +18 -2
@@ -9817,7 +9817,21 @@ struct mlx5_ifc_pplm_reg_bits {u8 fec_override_admin_100g_2x[0x10 ];u8 fec_override_admin_50g_1x[0x10 ]; -u8 reserved_at_140[0x140 ]; +u8 fec_override_cap_800g_8x[0x10 ]; +u8 fec_override_cap_400g_4x[0x10 ]; + +u8 fec_override_cap_200g_2x[0x10 ]; +u8 fec_override_cap_100g_1x[0x10 ]; + +u8 reserved_at_180[0xa0 ]; + +u8 fec_override_admin_800g_8x[0x10 ]; +u8 fec_override_admin_400g_4x[0x10 ]; + +u8 fec_override_admin_200g_2x[0x10 ]; +u8 fec_override_admin_100g_1x[0x10 ]; + +u8 reserved_at_260[0x20 ]; };struct mlx5_ifc_ppcnt_reg_bits {
@@ -10189,7 +10203,9 @@ struct mlx5_ifc_mtutc_reg_bits { };struct mlx5_ifc_pcam_enhanced_features_bits { -u8 reserved_at_0[0x68 ]; +u8 reserved_at_0[0x48 ]; +u8 fec_100G_per_lane_in_pplm[0x1 ]; +u8 reserved_at_49[0x1f ];u8 fec_50G_per_lane_in_pplm[0x1 ];u8 reserved_at_69[0x4 ];u8 rx_icrc_encapsulated_counter[0x1 ];
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 3/5 ethtool: add interface to read representor Rx statistics
In reply to Tariq ToukanFrom: Carolina Jubran <[email protected]>
Implement common representor port statistics in a rep_port_stats struct_group, introducing a new 'out of buffer' stats for when packets are dropped due to a lack of receive buffers in RX queue.
The port statistics represent the statistics of the function with which the representor is associated.
Print the representor port stats when the --groups rep-port or --all-groups are used.
--- include/linux/ethtool.h | 16 ++++++++++++++ include/uapi/linux/ethtool.h | 2 ++ include/uapi/linux/ethtool_netlink.h | 10 +++++++++ net/ethtool/netlink.h | 1 + net/ethtool/stats.c | 31 ++++++++++++++++++++++++++++ net/ethtool/strset.c | 5 +++++ 6 files changed, 65 insertions(+)
include/linux/ethtool.h +16 -0
@@ -480,6 +480,17 @@ struct ethtool_rmon_stats { ); }; +/** +* struct ethtool_rep_port_stats - representor port statistics +* @rep_port_stats: struct group for representor port +* @out_of_buf: Number of packets were dropped due to buffer exhaustion. +*/ +struct ethtool_rep_port_stats { + struct_group(rep_port_stats, + u64 out_of_buf; + ); +}; +#define ETH_MODULE_EEPROM_PAGE_LEN 128#define ETH_MODULE_MAX_I2C_ADDRESS 0x7f
@@ -804,6 +815,8 @@ struct ethtool_rxfh_param {* @get_eth_ctrl_stats: Query some of the IEEE 802.3 MAC Ctrl statistics. * @get_rmon_stats: Query some of the RMON (RFC 2819) statistics. * Set %ranges to a pointer to zero-terminated array of byte ranges. +* @get_rep_port_stats: Query the representor port statistics. +* Returns zero on success. * @get_module_power_mode: Get the power mode policy for the plug-in module * used by the network device and its operational power mode, if * plugged-in.
@@ -940,6 +953,9 @@ struct ethtool_ops {void (*get_rmon_stats)(struct net_device *dev,struct ethtool_rmon_stats *rmon_stats,const struct ethtool_rmon_hist_range **ranges); +int (*get_rep_port_stats)(struct net_device *dev, +struct ethtool_rep_port_stats *rep_port_stats, +struct netlink_ext_ack *extack);int (*get_module_power_mode)(struct net_device *dev,struct ethtool_module_power_mode_params *params,struct netlink_ext_ack *extack);
include/uapi/linux/ethtool.h +2 -0
@@ -681,6 +681,7 @@ enum ethtool_link_ext_substate_module {* @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics * @ETH_SS_STATS_RMON: names of RMON statistics +* @ETH_SS_STATS_REP_PORT: names of representor port statistics * * @ETH_SS_COUNT: number of defined string sets */
@@ -706,6 +707,7 @@ enum ethtool_stringset {ETH_SS_STATS_ETH_MAC ,ETH_SS_STATS_ETH_CTRL ,ETH_SS_STATS_RMON , +ETH_SS_STATS_REP_PORT ,/* add new constants above here */ ETH_SS_COUNT
include/uapi/linux/ethtool_netlink.h +10 -0
@@ -764,6 +764,7 @@ enum {ETHTOOL_STATS_ETH_MAC ,ETHTOOL_STATS_ETH_CTRL ,ETHTOOL_STATS_RMON , +ETHTOOL_STATS_REP_PORT ,/* add new constants above here */ __ETHTOOL_STATS_CNT
@@ -879,6 +880,15 @@ enum {ETHTOOL_A_STATS_RMON_MAX = (__ETHTOOL_A_STATS_RMON_CNT -1 ) }; +enum { +/* out_of_buf */ +ETHTOOL_A_STATS_REP_PORT_OUT_OF_BUF , + +/* add new constants above here */ + __ETHTOOL_A_STATS_REP_PORT_CNT, +ETHTOOL_A_STATS_REP_PORT_MAX = (__ETHTOOL_A_STATS_REP_PORT_CNT -1 ) +}; +/* MODULE */ enum {
net/ethtool/netlink.h +1 -0
@@ -454,5 +454,6 @@ extern const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRINGextern const char stats_eth_mac_names[__ETHTOOL_A_STATS_ETH_MAC_CNT][ETH_GSTRING_LEN ];extern const char stats_eth_ctrl_names[__ETHTOOL_A_STATS_ETH_CTRL_CNT][ETH_GSTRING_LEN ];extern const char stats_rmon_names[__ETHTOOL_A_STATS_RMON_CNT][ETH_GSTRING_LEN ]; +extern const char stats_rep_port_names[__ETHTOOL_A_STATS_REP_PORT_CNT][ETH_GSTRING_LEN ];#endif /* _NET_ETHTOOL_NETLINK_H */
net/ethtool/stats.c +31 -0
@@ -20,6 +20,7 @@ struct stats_reply_data {struct ethtool_eth_mac_stats mac_stats;struct ethtool_eth_ctrl_stats ctrl_stats;struct ethtool_rmon_stats rmon_stats; +struct ethtool_rep_port_stats rep_port_stats; );const struct ethtool_rmon_hist_range *rmon_ranges; };
@@ -32,6 +33,7 @@ const char stats_std_names[__ETHTOOL_STATS_CNT][ETH_GSTRING_LEN] = { [ETHTOOL_STATS_ETH_MAC] = "eth-mac", [ETHTOOL_STATS_ETH_CTRL] = "eth-ctrl", [ETHTOOL_STATS_RMON] = "rmon", + [ETHTOOL_STATS_REP_PORT] = "rep-port", };const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRING_LEN ] = {
@@ -76,6 +78,10 @@ const char stats_rmon_names[__ETHTOOL_A_STATS_RMON_CNT][ETH_GSTRING_LEN] = { [ETHTOOL_A_STATS_RMON_JABBER] = "etherStatsJabbers", }; +const char stats_rep_port_names[__ETHTOOL_A_STATS_REP_PORT_CNT][ETH_GSTRING_LEN ] = { + [ETHTOOL_A_STATS_REP_PORT_OUT_OF_BUF ] ="out_of_buf" , +}; +const struct nla_policy ethnl_stats_get_policy[ETHTOOL_A_STATS_SRC +1 ] = { [ETHTOOL_A_STATS_HEADER ] =NLA_POLICY_NESTED (ethnl_header_policy),
@@ -158,6 +164,15 @@ static int stats_prepare_data(const struct ethnl_req_info *req_base, dev->ethtool_ops->get_rmon_stats) dev->ethtool_ops->get_rmon_stats (dev, &data->rmon_stats, &data->rmon_ranges); +if (test_bit (ETHTOOL_STATS_REP_PORT , req_info->stat_mask) && + dev->ethtool_ops->get_rep_port_stats) { + ret = dev->ethtool_ops->get_rep_port_stats (dev, &data->rep_port_stats, + info->extack); +if (ret) { +ethnl_ops_complete (dev); +return ret; + } + }ethnl_ops_complete (dev);return 0 ;
@@ -194,6 +209,10 @@ static int stats_reply_size(const struct ethnl_req_info *req_base, nla_total_size(4)) * /* _A_STATS_GRP_HIST_BKT_HI */ETHTOOL_RMON_HIST_MAX *2 ; } +if (test_bit (ETHTOOL_STATS_REP_PORT , req_info->stat_mask)) { + n_stats +=sizeof (struct ethtool_rep_port_stats ) /sizeof (u64); + n_grps++; + } len += n_grps * (nla_total_size(0) + /* _A_STATS_GRP */ nla_total_size(4) + /* _A_STATS_GRP_ID */
@@ -370,6 +389,15 @@ static int stats_put_rmon_stats(struct sk_buff *skb,return 0 ; } +static int stats_put_rep_port_stats (struct sk_buff *skb, +const struct stats_reply_data *data) +{ +if (stat_put (skb,ETHTOOL_A_STATS_REP_PORT_OUT_OF_BUF , data->rep_port_stats.out_of_buf)) +return -EMSGSIZE ; + +return 0 ; +} + static int stats_put_stats(struct sk_buff *skb, const struct stats_reply_data *data, u32 id, u32 ss_id,
@@ -423,6 +451,9 @@ static int stats_fill_reply(struct sk_buff *skb,if (!ret &&test_bit (ETHTOOL_STATS_RMON , req_info->stat_mask)) ret =stats_put_stats (skb, data,ETHTOOL_STATS_RMON ,ETH_SS_STATS_RMON , stats_put_rmon_stats); +if (!ret &&test_bit (ETHTOOL_STATS_REP_PORT , req_info->stat_mask)) + ret =stats_put_stats (skb, data,ETHTOOL_STATS_REP_PORT , +ETH_SS_STATS_REP_PORT , stats_put_rep_port_stats);return ret; }
net/ethtool/strset.c +5 -0
@@ -105,6 +105,11 @@ static const struct strset_info info_template[] = { .count = __ETHTOOL_A_STATS_RMON_CNT, .strings = stats_rmon_names, }, + [ETH_SS_STATS_REP_PORT] = { + .per_dev = false, + .count = __ETHTOOL_A_STATS_REP_PORT_CNT, + .strings = stats_rep_port_names, + }, }; struct strset_req_info {
Signature · 1 line
2.44.0
Jakub Kicinski
maintainerRe: [PATCH net-next 3/5] ethtool: add interface to read representor Rx statistics
Quoted 10 lines · On Thu, 4 Apr 2024 20:33:55 +0300 Tariq Toukan wrote:
Implement common representor port statistics in a
rep_port_statsstruct_group, introducing a new 'out of buffer' stats for when packets are dropped due to a lack of receive buffers in RX queue.The port statistics represent the statistics of the function with which the representor is associated.
Print the representor port stats when the --groups rep-port or --all-groups are used.
I re-read what Tariq said on v1 and I clearly missed the point, sorry about that. Looking that his patch makes it pretty obvious.
With the netdev netlink family in place I was hoping we would only put in ethtool stats for functionality already configured via ethtool or clearly related to Ethernet.
But before we go to netdev - can you think of more such error stats that we may need to add? Since it's the equivalent of rtnl rx_missed I think we should consider putting it in netdev_offload_xstats. Maybe following the same definition as packet/byte counters? Report sum by default and CPU ones under IFLA_OFFLOAD_XSTATS_CPU_HIT? Or new enum entry?
Simon, WDYT?
Quoted 3 lines
+/**
+ * structethtool_rep_port_stats- representor port statistics
+ * @rep_port_stats: struct group for representor port
In more trivial remarks - kernel-doc script apparently doesn't want the group to be documented (any more?)
Quoted 8 lines
+ * @out_of_buf: Number of packets were dropped due to buffer exhaustion.
+ */include/linux/ethtool.h +6
-0+struct ethtool_rep_port_stats { + struct_group(rep_port_stats, + u64 out_of_buf; + ); +}; +
Re: [PATCH net-next 3/5] ethtool: add interface to read representor Rx statistics
Quoted 8 lines · On Fri, 05 Apr, 2024 21:53:35 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 3 lines · On Thu, 4 Apr 2024 20:33:55 +0300 Tariq Toukan wrote:
+/**
+ * structethtool_rep_port_stats- representor port statistics
+ * @rep_port_stats: struct group for representor portIn more trivial remarks - kernel-doc script apparently doesn't want the group to be documented (any more?)
I took a look, and I believe the behavior of kernel-doc has remained the same since the struct_group() helper macro was introduced. That said, I think allowing the documentation of struct_group() would be a reasonable choice/maybe worth updating the script.
Quoted 8 lines
Quoted 8 lines
+ * @out_of_buf: Number of packets were dropped due to buffer exhaustion.
+ */include/linux/ethtool.h +6
-0+struct ethtool_rep_port_stats { + struct_group(rep_port_stats, + u64 out_of_buf; + ); +}; +
Jakub Kicinski
maintainerRe: [PATCH net-next 3/5] ethtool: add interface to read representor Rx statistics
Quoted 7 lines · On Fri, 05 Apr 2024 22:25:21 -0700 Rahul Rameshbabu wrote:
Quoted 2 lines
In more trivial remarks - kernel-doc script apparently doesn't want the group to be documented (any more?)
I took a look, and I believe the behavior of kernel-doc has remained the same since the
struct_group()helper macro was introduced. That said, I think allowing the documentation ofstruct_group()would be a reasonable choice/maybe worth updating the script.
Thanks for investigating! Dunno why this started getting hit so much out of the sudden.
Tariq Toukan
maintainerPATCH 4/5 net/mlx5e: Expose the VF/SF RX drop counter on the representor
In reply to Tariq ToukanFrom: Carolina Jubran <[email protected]>
Q counters are device-level counters that track specific events, among which are out_of_buffer events. These events occur when packets are dropped due to a lack of receive buffer in the RX queue.
Expose the total number of rx_out_of_buffer events on the VF/SF to their respective representor, using the "ethtool -S devname --all-groups|--groups rep-port" under the name of "rep-port-out_of_buf".
The "rep-port-out_of_buf" equals the sum of all
Q counters rx_out_of_buffer values allocated on the VF/SF.
--- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 48 +++++++++++++++++++ .../ethernet/mellanox/mlx5/core/en_stats.h | 3 ++ 2 files changed, 51 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +48 -0
@@ -273,6 +273,44 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep)kvfree (out); } +static int mlx5e_rep_query_q_counter (struct mlx5_core_dev *mdev,int vport,void *out) +{ +u32 in[MLX5_ST_SZ_DW (query_q_counter_in)] = {}; + +MLX5_SET (query_q_counter_in, in, opcode,MLX5_CMD_OP_QUERY_Q_COUNTER ); +MLX5_SET (query_q_counter_in, in, other_vport,1 ); +MLX5_SET (query_q_counter_in, in, vport_number, vport); +MLX5_SET (query_q_counter_in, in, aggregate,1 ); + +return mlx5_cmd_exec_inout (mdev, query_q_counter, in, out); +} + +int mlx5e_stats_rep_port_get (struct mlx5e_priv *priv, +struct ethtool_rep_port_stats *rep_port_stats, +struct netlink_ext_ack *extack) +{ +u32 out[MLX5_ST_SZ_DW (query_q_counter_out)] = {}; +struct mlx5e_rep_priv *rpriv = priv->ppriv; +struct mlx5_eswitch_rep *rep = rpriv->rep; +int err; + +if (!MLX5_CAP_GEN (priv->mdev, q_counter_other_vport) || + !MLX5_CAP_GEN (priv->mdev, q_counter_aggregation)) { +NL_SET_ERR_MSG_MOD (extack, +"Representor port stats is not supported on this device" ); +return -EOPNOTSUPP ; + } + + err =mlx5e_rep_query_q_counter (priv->mdev, rep->vport, out); +if (err) { +NL_SET_ERR_MSG_MOD (extack,"Failed reading stats on vport" ); +return err; + } + rep_port_stats->out_of_buf =MLX5_GET (query_q_counter_out, out, out_of_buffer); + +return 0 ; +} +static void mlx5e_rep_get_strings (struct net_device *dev,u32 stringset,u8 *data) {
@@ -377,6 +415,15 @@ static u32 mlx5e_rep_get_rxfh_indir_size(struct net_device *netdev)return mlx5e_ethtool_get_rxfh_indir_size (priv); } +static int mlx5e_rep_get_port_stats (struct net_device *netdev, +struct ethtool_rep_port_stats *rep_port_stats, +struct netlink_ext_ack *extack) +{ +struct mlx5e_priv *priv =netdev_priv (netdev); + +return mlx5e_stats_rep_port_get (priv, rep_port_stats, extack); +} +static const struct ethtool_ops mlx5e_rep_ethtool_ops = { .supported_coalesce_params =ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES |
@@ -394,6 +441,7 @@ static const struct ethtool_ops mlx5e_rep_ethtool_ops = { .set_coalesce = mlx5e_rep_set_coalesce, .get_rxfh_key_size = mlx5e_rep_get_rxfh_key_size, .get_rxfh_indir_size = mlx5e_rep_get_rxfh_indir_size, + .get_rep_port_stats = mlx5e_rep_get_port_stats, }; static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +3 -0
@@ -128,6 +128,9 @@ void mlx5e_stats_eth_ctrl_get(struct mlx5e_priv *priv,void mlx5e_stats_rmon_get (struct mlx5e_priv *priv,struct ethtool_rmon_stats *rmon,const struct ethtool_rmon_hist_range **ranges); +int mlx5e_stats_rep_port_get (struct mlx5e_priv *priv, +struct ethtool_rep_port_stats *rep_port_stats, +struct netlink_ext_ack *extack);void mlx5e_get_link_ext_stats (struct net_device *dev,struct ethtool_link_ext_stats *stats);
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 5/5 net/mlx5e: Un-expose functions in en.h
In reply to Tariq ToukanUn-expose functions that are not used outside of their c file. Make them static.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 12 ---------- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 22 +++++++++---------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- 3 files changed, 12 insertions(+), 24 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +0 -12
@@ -1143,7 +1143,6 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq);int mlx5e_create_tis (struct mlx5_core_dev *mdev,void *in,u32 *tisn);void mlx5e_destroy_tis (struct mlx5_core_dev *mdev,u32 tisn); -int mlx5e_update_nic_rx (struct mlx5e_priv *priv);void mlx5e_update_carrier (struct mlx5e_priv *priv);int mlx5e_close (struct net_device *netdev);int mlx5e_open (struct net_device *netdev);
@@ -1180,23 +1179,12 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack); -int mlx5e_ethtool_get_link_ksettings (struct mlx5e_priv *priv, -struct ethtool_link_ksettings *link_ksettings); -int mlx5e_ethtool_set_link_ksettings (struct mlx5e_priv *priv, -const struct ethtool_link_ksettings *link_ksettings); -int mlx5e_get_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh); -int mlx5e_set_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh, -struct netlink_ext_ack *extack);u32 mlx5e_ethtool_get_rxfh_key_size (struct mlx5e_priv *priv);u32 mlx5e_ethtool_get_rxfh_indir_size (struct mlx5e_priv *priv);int mlx5e_ethtool_get_ts_info (struct mlx5e_priv *priv,struct ethtool_ts_info *info);int mlx5e_ethtool_flash_device (struct mlx5e_priv *priv,struct ethtool_flash *flash); -void mlx5e_ethtool_get_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam); -int mlx5e_ethtool_set_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam);/* mlx5e generic netdev management API */ static inline bool
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +11 -11
@@ -996,8 +996,8 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp,ptys2ethtool_adver_link (lp_advertising, eth_proto_lp, ext); } -int mlx5e_ethtool_get_link_ksettings (struct mlx5e_priv *priv, -struct ethtool_link_ksettings *link_ksettings) +static int mlx5e_ethtool_get_link_ksettings (struct mlx5e_priv *priv, +struct ethtool_link_ksettings *link_ksettings) {struct mlx5_core_dev *mdev = priv->mdev;u32 out[MLX5_ST_SZ_DW (ptys_reg)] = {};
@@ -1167,8 +1167,8 @@ static bool ext_requested(u8 autoneg, const unsigned long *adver, bool ext_supporeturn autoneg ==AUTONEG_ENABLE ? ext_link_mode : ext_supported; } -int mlx5e_ethtool_set_link_ksettings (struct mlx5e_priv *priv, -const struct ethtool_link_ksettings *link_ksettings) +static int mlx5e_ethtool_set_link_ksettings (struct mlx5e_priv *priv, +const struct ethtool_link_ksettings *link_ksettings) {struct mlx5_core_dev *mdev = priv->mdev;struct mlx5_port_eth_proto eproto;
@@ -1268,7 +1268,7 @@ static u32 mlx5e_get_rxfh_indir_size(struct net_device *netdev)return mlx5e_ethtool_get_rxfh_indir_size (priv); } -int mlx5e_get_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh) +static int mlx5e_get_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh) {struct mlx5e_priv *priv =netdev_priv (netdev);u32 rss_context = rxfh->rss_context;
@@ -1281,8 +1281,8 @@ int mlx5e_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)return err; } -int mlx5e_set_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh, -struct netlink_ext_ack *extack) +static int mlx5e_set_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh, +struct netlink_ext_ack *extack) {struct mlx5e_priv *priv =netdev_priv (dev);u32 *rss_context = &rxfh->rss_context;
@@ -1411,8 +1411,8 @@ static void mlx5e_get_pause_stats(struct net_device *netdev,mlx5e_stats_pause_get (priv, pause_stats); } -void mlx5e_ethtool_get_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam) +static void mlx5e_ethtool_get_pauseparam (struct mlx5e_priv *priv, +struct ethtool_pauseparam *pauseparam) {struct mlx5_core_dev *mdev = priv->mdev;int err;
@@ -1433,8 +1433,8 @@ static void mlx5e_get_pauseparam(struct net_device *netdev,mlx5e_ethtool_get_pauseparam (priv, pauseparam); } -int mlx5e_ethtool_set_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam) +static int mlx5e_ethtool_set_pauseparam (struct mlx5e_priv *priv, +struct ethtool_pauseparam *pauseparam) {struct mlx5_core_dev *mdev = priv->mdev;int err;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -5562,7 +5562,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)mlx5e_ipsec_cleanup (priv); } -int mlx5e_update_nic_rx (struct mlx5e_priv *priv) +static int mlx5e_update_nic_rx (struct mlx5e_priv *priv) {return mlx5e_refresh_tirs (priv, false, false); }
Signature · 1 line
2.44.0
Re: [PATCH net-next 5/5] net/mlx5e: Un-expose functions in en.h
Quoted 10 lines · Tariq Toukan
Un-expose functions that are not used outside of their c file. Make them static.
Signed-off-by Tariq Toukan <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 12 ---------- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 22 +++++++++---------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- 3 files changed, 12 insertions(+), 24 deletions(-)
Quoted 122 lines
drivers/net/ethernet/mellanox/mlx5/core/en.h +0
-12@@ -1143,7 +1143,6 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq);int mlx5e_create_tis (struct mlx5_core_dev *mdev,void *in,u32 *tisn);void mlx5e_destroy_tis (struct mlx5_core_dev *mdev,u32 tisn); -int mlx5e_update_nic_rx (struct mlx5e_priv *priv);void mlx5e_update_carrier (struct mlx5e_priv *priv);int mlx5e_close (struct net_device *netdev);int mlx5e_open (struct net_device *netdev);@@ -1180,23 +1179,12 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack); -int mlx5e_ethtool_get_link_ksettings (struct mlx5e_priv *priv, -struct ethtool_link_ksettings *link_ksettings); -int mlx5e_ethtool_set_link_ksettings (struct mlx5e_priv *priv, -const struct ethtool_link_ksettings *link_ksettings); -int mlx5e_get_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh); -int mlx5e_set_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh, -struct netlink_ext_ack *extack);u32 mlx5e_ethtool_get_rxfh_key_size (struct mlx5e_priv *priv);u32 mlx5e_ethtool_get_rxfh_indir_size (struct mlx5e_priv *priv);int mlx5e_ethtool_get_ts_info (struct mlx5e_priv *priv,struct ethtool_ts_info *info);int mlx5e_ethtool_flash_device (struct mlx5e_priv *priv,struct ethtool_flash *flash); -void mlx5e_ethtool_get_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam); -int mlx5e_ethtool_set_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam);/* mlx5e generic netdev management API */ static inline booldrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +11
-11@@ -996,8 +996,8 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp,ptys2ethtool_adver_link (lp_advertising, eth_proto_lp, ext); } -int mlx5e_ethtool_get_link_ksettings (struct mlx5e_priv *priv, -struct ethtool_link_ksettings *link_ksettings) +static int mlx5e_ethtool_get_link_ksettings (struct mlx5e_priv *priv, +struct ethtool_link_ksettings *link_ksettings) {struct mlx5_core_dev *mdev = priv->mdev;u32 out[MLX5_ST_SZ_DW (ptys_reg)] = {};@@ -1167,8 +1167,8 @@ static bool ext_requested(u8 autoneg, const unsigned long *adver, bool ext_supporeturn autoneg ==AUTONEG_ENABLE ? ext_link_mode : ext_supported; } -int mlx5e_ethtool_set_link_ksettings (struct mlx5e_priv *priv, -const struct ethtool_link_ksettings *link_ksettings) +static int mlx5e_ethtool_set_link_ksettings (struct mlx5e_priv *priv, +const struct ethtool_link_ksettings *link_ksettings) {struct mlx5_core_dev *mdev = priv->mdev;struct mlx5_port_eth_proto eproto;@@ -1268,7 +1268,7 @@ static u32 mlx5e_get_rxfh_indir_size(struct net_device *netdev)return mlx5e_ethtool_get_rxfh_indir_size (priv); } -int mlx5e_get_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh) +static int mlx5e_get_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh) {struct mlx5e_priv *priv =netdev_priv (netdev);u32 rss_context = rxfh->rss_context;@@ -1281,8 +1281,8 @@ int mlx5e_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)return err; } -int mlx5e_set_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh, -struct netlink_ext_ack *extack) +static int mlx5e_set_rxfh (struct net_device *dev,struct ethtool_rxfh_param *rxfh, +struct netlink_ext_ack *extack) {struct mlx5e_priv *priv =netdev_priv (dev);u32 *rss_context = &rxfh->rss_context;@@ -1411,8 +1411,8 @@ static void mlx5e_get_pause_stats(struct net_device *netdev,mlx5e_stats_pause_get (priv, pause_stats); } -void mlx5e_ethtool_get_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam) +static void mlx5e_ethtool_get_pauseparam (struct mlx5e_priv *priv, +struct ethtool_pauseparam *pauseparam) {struct mlx5_core_dev *mdev = priv->mdev;int err;@@ -1433,8 +1433,8 @@ static void mlx5e_get_pauseparam(struct net_device *netdev,mlx5e_ethtool_get_pauseparam (priv, pauseparam); } -int mlx5e_ethtool_set_pauseparam (struct mlx5e_priv *priv, -struct ethtool_pauseparam *pauseparam) +static int mlx5e_ethtool_set_pauseparam (struct mlx5e_priv *priv, +struct ethtool_pauseparam *pauseparam) {struct mlx5_core_dev *mdev = priv->mdev;int err;drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1
-2@@ -5562,7 +5562,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)mlx5e_ipsec_cleanup (priv); } -int mlx5e_update_nic_rx (struct mlx5e_priv *priv) +static int mlx5e_update_nic_rx (struct mlx5e_priv *priv) {return mlx5e_refresh_tirs (priv, false, false); } --2.44.0
Signature · 2 lines
Regards, Kalesh A P
Jakub Kicinski
maintainerQuoted 3 lines · On Thu, 4 Apr 2024 20:33:52 +0300 Tariq Toukan wrote:
Patches 1-2 by Cosmin implements FEC settings for 100G/lane modes.
Patch 5 is a simple cleanup.
Don't wanna hold these patches hostage to the stats conversation so let me take these already. LMK if that's not helpful.
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 4 Apr 2024 20:33:52 +0300 you wrote:
Hi,
This patchset includes small features and a cleanup for the mlx5e driver.
Patches 1-2 by Cosmin implements FEC settings for 100G/lane modes.
Patch 3-4 by Carolina adds generic rep-port ethtool stats group and implements an mlx5e counter that exposes RX packet drops of VFs/SFs on their representor.
[...]
Here is the summary with links:
- [net-next,1/5] net/mlx5e: Extract checking of FEC support for a link mode
https://git.kernel.org/netdev/net-next/c/d4383ce15f5b - [net-next,2/5] net/mlx5e: Support FEC settings for 100G/lane modes https://git.kernel.org/netdev/net-next/c/4aafb8ab2a62 - [net-next,3/5] ethtool: add interface to read representor Rx statistics (no matching commit) - [net-next,4/5] net/mlx5e: Expose the VF/SF RX drop counter on the representor (no matching commit) - [net-next,5/5] net/mlx5e: Un-expose functions in en.h https://git.kernel.org/netdev/net-next/c/958f56e48385
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html