* [PATCH net-next v19 0/4] net: hinic3: Support ethtool ops
@ 2026-12-04 4:08 Fan Gong
2026-12-04 4:08 ` [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) Fan Gong
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Fan Gong @ 2026-12-04 4:08 UTC (permalink / raw)
To: Fan Gong, Wu Di, Teng Peisen, netdev, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Andrew Lunn, Ioana Ciornei, Maxime Chevallier, Mohsin Bashir,
Dimitri Daskalakis, Harshitha Ramamurthy, Larysa Zaremba,
Vadim Fedorenko
Cc: linux-kernel, linux-doc, Zhou Shuai, Wu Like
This series adds the ethtool statistics, per-queue netdev-genl stats and
pause parameter support for the hinic3 driver. It is a subset of the
larger hinic3 patch set; the RX stall fix is already in net-next, and
the link settings, PHY LED, FEC, ringparam and Hi1872/HTN patches will
be sent separately.
Add ethtool ops:
.get_strings
.get_sset_count
.get_ethtool_stats
.get_eth_phy_stats
.get_eth_mac_stats
.get_eth_ctrl_stats
.get_rmon_stats
.get_pause_stats
.get_pauseparam
.set_pauseparam
Add netdev ops:
.get_queue_stats_rx
.get_queue_stats_tx
.get_base_stats
Changes:
PATCH 03 V01: https://lore.kernel.org/netdev/cover.1773387649.git.zhuyikai1@h-partners.com/
* Add rmon/pause/phy/mac/ctrl stats (Ioana Ciornei)
PATCH 03 V02: https://lore.kernel.org/netdev/cover.1774684571.git.zhuyikai1@h-partners.com/
* Remove OutOfRangeLengthField, FrameToolong and InRangeLengthErrors (Ioana Ciornei)
* Remove redundant mtu commit (Maxime Chevallier)
* Modify "return -EINVAL" intension problem (AI Review)
* Use le16_to_cpu for rss_indir pair.out->buf (AI Review)
* Use u32 instead of int in coalesce_limits to avoid overflow (AI Review)
* Remove redundant u64_stats_update_begin/end when reading stats without
concurrent reader (AI Review)
* Modify nic_dev->stats.syncp logic (AI Review)
* Complete rxq/txq stats stats fileds in hinic3_rx/txq_get_stats (AI Review)
* Remove statistics values in rtnl_link_stats64 from ethtool statistics
values (AI Review)
* Add channel_cfg_lock & channel_res_lock to protect resources access (AI Review)
PATCH 03 V03: https://lore.kernel.org/netdev/cover.1774940117.git.zhuyikai1@h-partners.com/
* Change unnedd to unneeded (AI Review)
* Remove packets,bytes,errors and dropped in hinic3_rx/tx_queue_stats (AI Review)
* Remove duplicated entried in hinic3_port_stats[] (AI Review)
* change stats_info.head.status to ps->head.status (AI Review)
PATCH 03 V04: https://lore.kernel.org/netdev/cover.1775618797.git.zhuyikai1@h-partners.com/
* Use old_q_param to store old config and use it in error handling (Mohsin Bashir)
* Add netdev_info to inform the user that depth is trimmed (Mohsin Bashir)
* Remove const in hinic3_get_qp_stats_strings parameters (Mohsin Bashir)
* Change EOPNOTSUPP to ERANGE in is_coalesce_exceed_limit (Mohsin Bashir)
* Update nic_dev->rss_type after hinic3_set_rss_type (Mohsin Bashir)
* Modify MGMT_STATUS_CMD_UNSUPPORTED to EOPNOTSUPP for complying with the
error code specifications (Mohsin Bashir)
* Remove restore_drop_sge in hinic3_rx_queue_stats (AI Review)
* Remove hinic3_nic_stats (AI Review)
PATCH 03 V05: https://lore.kernel.org/netdev/cover.1775711066.git.zhuyikai1@h-partners.com/
* As tx and rx share interrupts, we only use ETHTOOL_COALESCE_RX_USECS for
user setting to avoid user misunderstanding. So we do not add
ETHTOOL_COALESCE_TX_USECS. (Mohsin Bashir & AI Review)
* Clear HINIC3_CHANGE_RES_INVALID bit in error handling (AI Review)
* Use low >= high to avoid low=high in is_coalesce_legal (AI Review)
PATCH 03 V06: https://lore.kernel.org/netdev/cover.1779867397.git.zhuyikai1@h-partners.com/
* Remove redundant rx_jumbo_pending and rx_mini_pending judgement (Jakub Kicinski)
* Remove redundant max tx_pending judgement when .get_ringparam already got the
max value (Jakub Kicinski)
* Use extack instead of netdev_err/netdev_info/netdev_warning (Jakub Kicinski)
* Remove HINIC3_CHANNEL_RES_VALID and only use HINIC3_CHANGE_RES_INVALID
bit (Jakub Kicinski)
* Deference freed pointers in hinic3_change_channel_settings error
handling (Jakub Kicinski)
* Modify hinic3_open_channel (Jakub Kicinski)
PATCH 03 V07: https://lore.kernel.org/netdev/cover.1779940072.git.zhuyikai1@h-partners.com/
* Remove the trailing '\n' in NL_SET_ERR_MSG* (Jakub Kicinski)
PATCH 03 V08: https://lore.kernel.org/netdev/cover.1780907605.git.wudi234@huawei.com/
* Update patch commit to be more accurate for change information (AI Review)
* Modify <net/devlink.h> to <linux/netlink.h> (AI Review)
* Use sq/rq_depth instead of rx/txqs[0].q_depth (AI Review)
* hinic3_change_channel_settings() runs under change_res_mutex
to protect dynamic channel updates (AI Review)
* hinic3_close() serializes close and channel reconfiguration paths (AI Review)
* Remove useless u64_stats_init in hinic3_get_drv_queue_stats() (AI Review)
* hinic3_get_drv_queue_stats() fills rxq stats at correct idx
when txq is null (AI Review)
* Remove unnecessary semicolons after the closing bracket of
static inline functions (AI Review)
* Disable preemption in hinic3_rx_fill_buffers() (AI Review)
* Add spinlock to protect per-queue coalesce parameters from
concurrent access (AI Review)
* Reject static coalesce config when adaptive RX coalesce is
enabled (AI Review)
* Validate interface state and queue ID before modifying coalesce
parameters (AI Review)
* Differentiate get_coalesce output for adaptive/static modes and
zero-fill the struct (AI Review)
* Return -ERANGE for invalid coalesce frame limits and simplify
error message (AI Review)
* Remove unused watchdog timeout definition and assignment (AI Review)
* Return -EOPNOTSUPP when RSS type query is unsupported by firmware (AI Review)
* Reject L4 hash bits for pure L3 flow types (AI Review)
* Split RSS type conversion to correctly handle L3-only flows (AI Review)
* Reprogram RSS indir table and HW parameters after channel count
changes (AI Review)
* Propagate exact error code from channel parameter validation (AI Review)
* Update SW RSS indir copy only after HW programming succeeds (AI Review)
* Program RSS hash type to HW before updating SW state to prevent
inconsistency (AI Review)
PATCH 03 V09: https://lore.kernel.org/netdev/cover.1781062575.git.wudi234@huawei.com/
* Remove useless messages in hinic3_set_ringparam() (Jakub Kicinski)
* Solve the big-endian and little-endian issue (Jakub Kicinski)
PATCH 03 V10: https://lore.kernel.org/netdev/cover.1782718232.git.wudi234@huawei.com/
* Unify 3 mutex in struct hinic3_nic_dev: port_state_mutex, change_res_mutex,
coal_lock.(Simon Horman)
* Use rxq->q_mask instead of rxq->q_depth - 1 in hinic3_configure_rxqs()
(Dimitri Daskalakis)
* Implement dedicated get_rx_ring_count ethtool operation (Dimitri Daskalakis)
* Correct copy-paste error in hinic3_get_ringparam() (AI Review and
Harshitha Ramamurthy)
* Clarify extack error message in hinic3_check_ringparam_valid()
(Harshitha Ramamurthy)
* Use rounddown_pow_of_two() instead of 1U << ilog2() in hinic3_set_ringparam()
for readability. (Harshitha Ramamurthy)
* hinic3_set_interrupt_moder() now compare q_id and num_qps inside mutex lock
(AI Review)
* Error branches in hinic3_link_status_change() goto unlock mutex before return
(AI Review)
* In hinic3_change_channel_settings(), hinic3_config_num_qps() and
hinic3_alloc_channel_resources() now run inside mutex lock. (AI Review)
* Call hinic3_free_qp_ctxts() in error paths of hinic3_open_channel(),
thus hinic3_change_channel_settings() don't call it in error path (AI Review)
* Unset HINIC3_INTF_UP during close and reopen in hinic3_change_channel_settings
* hinic3_change_channel_settings() restore previous resources before freeing
new_qp_params (AI Review)
* Delete unused macro HINIC3_LRO_PKT_HDR_LEN (AI Review)
* Drop packets when skb_checksum_help() return error (AI Review)
* Protect interrupt coalesce parameter reads with state_lock to prevent data
races(AI Review)
* Restore previous coalesce parameters on HW configuration failure (AI Review)
* Always report all coalesce parameters regardless of adaptive mode (AI Review)
* Safely stop DIM work when disabling adaptive RX coalescing (AI Review)
* Change coalesce disabled message from extack error to info log (AI Review)
* Pass new RSS hash type to HW instead of the old one (AI Review)
* Initialize default RSS indirection table before HW programming when not
user-configured(AI Review)
* Revert queue count on RSS reprogramming failure (AI Review)
* Use sizeof for RSS indirection table copy to prevent size mismatch (AI Review)
PATCH 03 V11: https://lore.kernel.org/all/cover.1784538912.git.root@localhost.localdomain/
* Remove state_lock in hinic3_set_interrupt_moder() and
hinic3_link_status_change() (Andrew Lunn and AI Review)
* In hinic3_change_channel_settings(), cur_trxq_params is read after taking lock,
and get symmetrically restored when alloc resources failed. (AI Review)
* Remove preempt_disable()/preempt_enable() pairs in hinic3_rx_fill_buffers().
(AI Review)
* Add a comment about csum_err, and rewrite its judgement in hinic3_rx_csum().
(AI Review)
* Rollback hash function type to previous state if setting RSS indirection
table or key fails (AI Review)
* Allow users to disable L3 hashing for IPV4/IPV6 flows by properly handling
empty hash tuple in ethtool (AI Review)
* Update software queue coalesce state only after successful hardware
configuration to avoid manual rollback (AI Review)
* Use READ_ONCE and WRITE_ONCE for adaptive_rx_coal to ensure safe
concurrent memory access (AI Review)
* Reset RX queue DIM state to DIM_START_MEASURE when canceling
adaptive RX coalescing work (AI Review)
* Remove unnecessary state_lock mutexes when reading queue coalesce
parameters in IRQ and update paths (AI Review)
* Rename is_coalesce_legal to hinic3_validate_coalesce for better code
readability and naming consistency (AI Review)
PATCH 03 V12: https://lore.kernel.org/all/cover.1785120952.git.root@localhost.localdomain/
* Remove get_val_of_ptr() which is unnecessary (Dimitri Daskalakis)
* Split the monolithic patch into multiple patches (Mohsin Bashir)
* Fix MSI-X leak and defer q_params publication and add error-path
rollback to prevent regressions (AI Review)
* Rfactor hinic3_update_hash_func_type() (AI Review)
* Guard irq_cfg traversal with INTF_UP check to prevent NULL dereference
and fully reinitialize DIM state on adaptive re-enable (AI Review)
* Snapshot per-queue coalesce configs before applying and rollback via
backup array on partial failure to ensure atomic set_coalesce (AI Review)
PATCH 03 V13: https://lore.kernel.org/netdev/cover.1786774752.git.tengpeisen@huawei.com/
* Split previous version into 3 parts. The first 2 patches were sent to
net tree, patch #5, #6 and #8 stayes in this series, and others will be sent
in the future. (Larysa Zaremba and Jakub Kicinski)
* Remove dead size field from struct hinic3_stats and add
HINIC3_STAT_SIZE_CHECK() with BUILD_BUG_ON_ZERO to enforce
per-entry compile-time verification that all stats members are u64. (AI Review)
* Remove never-incremented frag_len_overflow and frag_size_err from
hinic3_txq_stats, hinic3_txq_clean_stats(), hinic3_txq_get_stats()
and the hinic3_tx_queue_stats ethtool table. (AI Review)
* Add missing txq_stats.busy increment in hinic3_send_one_skb() when
returning NETDEV_TX_BUSY due to insufficient WQEBBs. (AI Review)
* Add missing txq_stats.offload_cow_skb_err increment when offload
type is invalid in hinic3_send_one_skb(). (AI Review)
* Remove mac_tx_good_oct_num and mac_rx_good_oct_num from the
hinic3_port_stats private table as they are already reported through
the get_eth_mac_stats standard interface. (AI Review)
* Fix OctetsTransmittedOK/ReceivedOK mapping in
hinic3_get_eth_mac_stats() to use mac_tx/rx_good_oct_num instead
of mac_tx/rx_total_oct_num per RFC 2863 (error-free frames only). (AI Review)
* Add HINIC3_IS_VF guard to hinic3_get_eth_phy_stats() to prevent
VF from reading physical port stats, consistent with the ethtool
-S path which already gates hinic3_port_stats on PF-only. (AI Review)
* Use u64_stats_update_begin_irqsave/end_irqrestore in
hinic3_rx_fill_buffers() where the function can be called from
preemptible process context via hinic3_configure_rxqs(), avoiding
seqcount deadlock on 32-bit systems. (AI Review)
* Expand state_lock protection scope in hinic3_get_coalesce() and
hinic3_set_coalesce() to cover intr_coalesce array accesses. (AI Review)
* Use standard net_dim_work_cancel() in hinic3_set_coalesce() to cancel
DIM work instead of manually clearing struct fields, ensuring safe DIM
state reset and simplifying error rollback. (AI Review)
PATCH 03 V14: https://lore.kernel.org/netdev/cover.1791858167.git.gongfan1@huawei.com/
* Remove if (!nic_dev->txqs) & if (!nic_dev->rxqs). (Vadim Fedorenko)
* All comments regarding this submission have been documented and will be
addressed incrementally in subsequent patch-set.
PATCH 03 V15: https://lore.kernel.org/netdev/cover.1792053295.git.gongfan1@huawei.com/
* Break get_ethtool_stats into the standard statistic groups.
Only retain the counters which are not part of standard groups.
(Andrew Lunn and AI Review)
* Netdev netlink qstats (struct netdev_stat_ops) does not be implemented
by hinic3, it will be implemented in future. So the per-queue stats of
rxq%d_csum_errors etc. will be retained in ethtool -S.(AI Review)
* Change netdev_err to netdev_err_once and dev_err to dev_err_once.
(AI Review)
* The stall of hinic3_rx_fill_buffers() and LRO in extreme condition will
go in a separate patch.(AI Review)
* Use the same algorithms for calculating the number of bytes and packets
in the TSO and LRO statistics.(AI Review)
* Replace skb_inner_transport_header() with skb_inner_tcp_all_headers()
will go in a separate patch.(AI Review)
* Drops taken in hinic3_xmit_frame() are counted.(AI Review)
* u64_stats_update_begin() in hinic3_rxq_clean_stats() and
hinic3_txq_clean_stats() will go in a separate patch.(AI Review)
* get_pauseparam callback will go in a separate patch.(AI Review)
PATCH 03 V16: https://lore.kernel.org/netdev/cover.1792149958.git.gongfan1@huawei.com/
* Change lro_packets = 1 to lro_packets++.(Mohsin Bashir)
* Init txq at the correct place.(Mohsin Bashir)
* Statistics in hinic3_function_stats and rtnl_link_stats64 originate from
different sources: the chip records the former, while the driver records
the latter. Chip statistics are readable via ethtool -S, and driver
statistics are returned via rtnl_link_stats64.(AI Review)
* Change u64 to __le64 in l2nic_vport_stats and mag_cmd_port_stats.(AI Review)
* Reset lro_packets and gso_packets.(AI Review)
PATCH 03 V17: https://lore.kernel.org/netdev/cover.1792378301.git.gongfan1@huawei.com/
* Use ethtool_puts().(Dimitri Daskalakis)
* Remove the casting of char *p = (char *)data.(Dimitri Daskalakis)
* It was clarified in the last patch that tx_unicast_pkts_vport and
per-queue metrics are not standard statistics.(AI Review)
* Use le64_to_cpu() to handle variables definded as __le64.(AI Review)
* Optimize the txq initialization position to prevent out-of-bounds
memory access.(Mohsin Bashir & AI Review)
PATCH 03 V18: https://lore.kernel.org/netdev/cover.1792671176.git.gongfan1@huawei.com/
* Merge the alloc_skb_err and alloc_rx_buf_err counters into a standard
alloc_fail counter.(Jakub Kicinski)
* Rename mac_rx/tx_1519_max_* to mac_rx/tx_jumbo_*.(Jakub Kicinski)
* Remove gso_packets and lro_packets.(Jakub Kicinski)
* Implement netdev netlink qstats (struct netdev_stat_ops) in hinic3 for
per-queue standard counter.(AI Review)
* Remove some vport counters form ethtool -S. They will go in a separate
patch.(AI Review)
* Remove mac_tx/rx_pfc_pri_* counter from ethtool -S. They will go in a
separate patch for the dcbnl struct ieee_pfc.(AI Review)
* Move csum_errors to csum_bad in netdev netlink qstats.(AI Review)
* Solve the coexistence of hinic3_get_stats64() and hinic3_get_pkt_stats()
on a 32-bit system and remove hinic3_get_pkt_stats().(AI Review)
* Detailed statistics of TSO and LRO will go in a separate patch. The problem
in dim_update_sample() will be solved.(AI Review)
* Implement .get_pauseparam and .set_pauseparam for hinic3_get_pause_stats().
(AI Review)
PATCH 03 V19:
* Save skb->len to a local variable before the doorbell, so the TX
completion path cannot free the skb before the stats read.(AI Review)
* Update the TX packet/byte counters from hinic3_tx_poll() when the
device completes the descriptors, so in-flight and flushed skbs are
not reported as sent.(AI Review)
* Count TX wire packets with skb_shinfo(skb)->gso_segs and add the
repeated TCP header length to tx_bytes for TCP GSO. Guard gso_segs
against zero.(AI Review)
* Count tx-stop only when netif_subqueue_try_stop()/maybe_stop() really
stops the queue, and count the normal stop path as well.(AI Review)
* Count RX packets with num_lro for LRO aggregates.(AI Review)
* Move csum_errors to the standard rx-csum-bad qstats and keep only
other_errors in rtnl_link_stats64.rx_errors.(AI Review)
* Count csum_errors regardless of NETIF_F_RXCSUM so toggling RXCSUM
does not change the meaning of the counter.(AI Review)
* Add hinic3vf_ethtool_ops for VF, hinic3_ethtool_ops only for PF, so
VF does not issue physical-port stats/pause commands.(AI Review)
* Only initialize the supported counters in hinic3_get_base_stats(),
add stats_rx->alloc_fail, and use netdev->real_num_{rx,tx}_queues as
the lower bound so the base range cannot overlap the per-queue
range.(AI Review)
* Bound-check the queue index in hinic3_get_queue_stats_rx/tx().(AI Review)
* Merge the 12288-16383 octet bucket into the last RMON histogram range,
since ETHTOOL_RMON_HIST_MAX is 11.(AI Review)
* Use the firmware pause values whenever hinic3_get_pause_info()
succeeds and fall back to the cached state only on error.(AI Review)
* Preserve the firmware auto_neg when setting pause parameters and
reject an explicit change, since pause autonegotiation is not user
configurable.(AI Review)
* Change (u8)pause->rx_pause to !!pause->rx_pause to avoid values 2 to
255 being passed to firmware.(AI Review)
* Initialize nic_cfg.cfg_mutex and protect the cached pause state.
(AI Review)
* Skip the pause query for VF during probe, since the firmware may not
support L2NIC_CMD_CFG_PAUSE_INFO for VF.(AI Review)
* The vport multicast/discard/err counters are removed from ethtool -S
and will be exposed through rtnl_link_stats64 in a separate patch.
PFC per-priority counters will go to the dcbnl ieee_pfc interface
separately.
* TX bytes expand the repeated TCP header for TCP GSO; UDP tunnel GSO
and RX LRO wire byte accounting need hardware confirmation and will
be addressed separately if required.
Fan Gong (4):
hinic3: Add ethtool statistic ops part(1/2)
hinic3: Add ethtool statistic ops part(2/2)
hinic3: Add per-queue netdev-genl stats
hinic3: Add ethtool pause param ops
.../ethernet/huawei/hinic3/hinic3_ethtool.c | 536 +++++++++++++++++-
.../ethernet/huawei/hinic3/hinic3_hw_intf.h | 11 +
.../net/ethernet/huawei/hinic3/hinic3_main.c | 8 +
.../huawei/hinic3/hinic3_mgmt_interface.h | 37 ++
.../huawei/hinic3/hinic3_netdev_ops.c | 109 +++-
.../ethernet/huawei/hinic3/hinic3_nic_cfg.c | 71 +++
.../ethernet/huawei/hinic3/hinic3_nic_cfg.h | 114 +++-
.../ethernet/huawei/hinic3/hinic3_nic_dev.h | 3 +
.../net/ethernet/huawei/hinic3/hinic3_rx.c | 69 ++-
.../net/ethernet/huawei/hinic3/hinic3_rx.h | 10 +-
.../net/ethernet/huawei/hinic3/hinic3_tx.c | 149 ++++-
.../net/ethernet/huawei/hinic3/hinic3_tx.h | 9 +-
12 files changed, 1085 insertions(+), 41 deletions(-)
base-commit: ed3135d0881a926de56a7f490dea3d51698ba118
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) 2026-12-04 4:08 [PATCH net-next v19 0/4] net: hinic3: Support ethtool ops Fan Gong @ 2026-12-04 4:08 ` Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 2026-12-04 4:08 ` [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2) Fan Gong ` (2 subsequent siblings) 3 siblings, 1 reply; 9+ messages in thread From: Fan Gong @ 2026-12-04 4:08 UTC (permalink / raw) To: Fan Gong, Wu Di, Teng Peisen, netdev, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn, Ioana Ciornei, Maxime Chevallier, Mohsin Bashir, Dimitri Daskalakis, Harshitha Ramamurthy, Larysa Zaremba, Vadim Fedorenko Cc: linux-kernel, linux-doc, Zhou Shuai, Wu Like This commit adds per-queue TX/RX software counters and firmware-backed vport and physical port statistics to the hinic3 driver. It implements the .get_strings, .get_sset_count and .get_ethtool_stats callbacks so these can be read with ethtool -S. TX packet/byte counters are updated from hinic3_tx_poll() when the device completes the descriptors, so in-flight and flushed skbs are not reported as sent. tx-stop is counted only when the queue is really stopped, using the return value of netif_subqueue_try_stop() and netif_subqueue_maybe_stop(). TX packets and bytes are counted as wire packets and wire bytes: GSO skbs contribute skb_shinfo(skb)->gso_segs packets, and the repeated TCP header length is added to the byte count. gso_segs is clamped to at least one to keep the wire byte arithmetic well defined. Co-developed-by: Wu Di <wudi234@huawei.com> Signed-off-by: Wu Di <wudi234@huawei.com> Co-developed-by: Teng Peisen <tengpeisen@huawei.com> Signed-off-by: Teng Peisen <tengpeisen@huawei.com> Co-developed-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> --- .../ethernet/huawei/hinic3/hinic3_ethtool.c | 257 ++++++++++++++++++ .../ethernet/huawei/hinic3/hinic3_hw_intf.h | 11 + .../huawei/hinic3/hinic3_mgmt_interface.h | 37 +++ .../huawei/hinic3/hinic3_netdev_ops.c | 3 +- .../ethernet/huawei/hinic3/hinic3_nic_cfg.c | 64 +++++ .../ethernet/huawei/hinic3/hinic3_nic_cfg.h | 108 ++++++++ .../net/ethernet/huawei/hinic3/hinic3_rx.c | 69 ++++- .../net/ethernet/huawei/hinic3/hinic3_rx.h | 10 +- .../net/ethernet/huawei/hinic3/hinic3_tx.c | 149 ++++++++-- .../net/ethernet/huawei/hinic3/hinic3_tx.h | 9 +- 10 files changed, 679 insertions(+), 38 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c index 90fc16288de9..0ec5d7f21e09 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c @@ -13,8 +13,11 @@ #include "hinic3_lld.h" #include "hinic3_hw_comm.h" +#include "hinic3_hwif.h" #include "hinic3_nic_dev.h" #include "hinic3_nic_cfg.h" +#include "hinic3_tx.h" +#include "hinic3_rx.h" #define HINIC3_MGMT_VERSION_MAX_LEN 32 @@ -409,6 +412,257 @@ hinic3_get_link_ksettings(struct net_device *netdev, return 0; } +struct hinic3_stats { + char name[ETH_GSTRING_LEN]; + int offset; +}; + +#define HINIC3_STAT_SIZE_CHECK(type, member) \ + BUILD_BUG_ON_ZERO(sizeof_field(type, member) != sizeof(u64)) + +#define HINIC3_FUNC_STAT(_stat_item) { \ + .name = #_stat_item, \ + .offset = offsetof(struct l2nic_vport_stats, _stat_item) \ + + 0 * HINIC3_STAT_SIZE_CHECK(struct l2nic_vport_stats, \ + _stat_item) \ +} + +static struct hinic3_stats hinic3_function_stats[] = { + HINIC3_FUNC_STAT(tx_unicast_pkts_vport), + HINIC3_FUNC_STAT(tx_unicast_bytes_vport), + HINIC3_FUNC_STAT(tx_broadcast_pkts_vport), + HINIC3_FUNC_STAT(tx_broadcast_bytes_vport), + + HINIC3_FUNC_STAT(rx_unicast_pkts_vport), + HINIC3_FUNC_STAT(rx_unicast_bytes_vport), + HINIC3_FUNC_STAT(rx_broadcast_pkts_vport), + HINIC3_FUNC_STAT(rx_broadcast_bytes_vport), +}; + +#define HINIC3_PORT_STAT(_stat_item) { \ + .name = #_stat_item, \ + .offset = offsetof(struct mag_cmd_port_stats, _stat_item) \ + + 0 * HINIC3_STAT_SIZE_CHECK(struct mag_cmd_port_stats, \ + _stat_item) \ +} + +static struct hinic3_stats hinic3_port_stats[] = { + HINIC3_PORT_STAT(mac_tx_fragment_pkts), + HINIC3_PORT_STAT(mac_tx_undersize_pkts), + HINIC3_PORT_STAT(mac_tx_undermin_pkts), + HINIC3_PORT_STAT(mac_tx_jabber_bad_pkts), + HINIC3_PORT_STAT(mac_tx_jabber_good_pkts), + HINIC3_PORT_STAT(mac_tx_oversize_pkts), + HINIC3_PORT_STAT(mac_tx_ieee_jabber_pkts), + HINIC3_PORT_STAT(mac_tx_bad_pkts), + HINIC3_PORT_STAT(mac_tx_bad_octs), + HINIC3_PORT_STAT(mac_tx_total_pkts), + HINIC3_PORT_STAT(mac_tx_uni_pkts), + HINIC3_PORT_STAT(mac_tx_err_all_pkts), + HINIC3_PORT_STAT(mac_tx_from_app_good_pkts), + HINIC3_PORT_STAT(mac_tx_from_app_bad_pkts), + + HINIC3_PORT_STAT(mac_rx_undermin_pkts), + HINIC3_PORT_STAT(mac_rx_jabber_good_pkts), + HINIC3_PORT_STAT(mac_rx_ieee_jabber_pkts), + HINIC3_PORT_STAT(mac_rx_bad_pkts), + HINIC3_PORT_STAT(mac_rx_bad_octs), + HINIC3_PORT_STAT(mac_rx_total_pkts), + HINIC3_PORT_STAT(mac_rx_uni_pkts), + HINIC3_PORT_STAT(mac_rx_send_app_good_pkts), + HINIC3_PORT_STAT(mac_rx_send_app_bad_pkts), + HINIC3_PORT_STAT(mac_rx_unfilter_pkts), +}; + +#define HINIC3_TXQ_STAT(_stat_item) { \ + .name = "txq%d_"#_stat_item, \ + .offset = offsetof(struct hinic3_txq_stats, _stat_item) \ + + 0 * HINIC3_STAT_SIZE_CHECK(struct hinic3_txq_stats, \ + _stat_item) \ +} + +#define HINIC3_RXQ_STAT(_stat_item) { \ + .name = "rxq%d_"#_stat_item, \ + .offset = offsetof(struct hinic3_rxq_stats, _stat_item) \ + + 0 * HINIC3_STAT_SIZE_CHECK(struct hinic3_rxq_stats, \ + _stat_item) \ +} + +static struct hinic3_stats hinic3_tx_queue_stats[] = { + HINIC3_TXQ_STAT(skb_pad_err), + HINIC3_TXQ_STAT(offload_cow_skb_err), + HINIC3_TXQ_STAT(map_frag_err), + HINIC3_TXQ_STAT(unknown_tunnel_pkt), +}; + +static struct hinic3_stats hinic3_rx_queue_stats[] = { + HINIC3_RXQ_STAT(other_errors), + HINIC3_RXQ_STAT(rx_buf_empty), +}; + +static u16 hinic3_get_hw_stats_strings(struct hinic3_nic_dev *nic_dev, u8 *p) +{ + u16 i, cnt = 0; + + for (i = 0; i < ARRAY_SIZE(hinic3_function_stats); i++) { + ethtool_puts(&p, hinic3_function_stats[i].name); + cnt++; + } + + if (!HINIC3_IS_VF(nic_dev->hwdev)) { + for (i = 0; i < ARRAY_SIZE(hinic3_port_stats); i++) { + ethtool_puts(&p, hinic3_port_stats[i].name); + cnt++; + } + } + + return cnt; +} + +static void hinic3_get_qp_stats_strings(struct hinic3_nic_dev *nic_dev, u8 *p) +{ + u16 i, j; + + for (i = 0; i < nic_dev->q_params.num_qps; i++) { + for (j = 0; j < ARRAY_SIZE(hinic3_tx_queue_stats); j++) + ethtool_sprintf(&p, + hinic3_tx_queue_stats[j].name, i); + } + + for (i = 0; i < nic_dev->q_params.num_qps; i++) { + for (j = 0; j < ARRAY_SIZE(hinic3_rx_queue_stats); j++) + ethtool_sprintf(&p, + hinic3_rx_queue_stats[j].name, i); + } +} + +static void hinic3_get_strings(struct net_device *netdev, + u32 stringset, u8 *data) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + u16 offset; + + switch (stringset) { + case ETH_SS_STATS: + offset = hinic3_get_hw_stats_strings(nic_dev, data); + hinic3_get_qp_stats_strings(nic_dev, + data + offset * ETH_GSTRING_LEN); + + break; + } +} + +static int hinic3_get_sset_count(struct net_device *netdev, int sset) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + int count, q_num; + + switch (sset) { + case ETH_SS_STATS: + q_num = nic_dev->q_params.num_qps; + count = ARRAY_SIZE(hinic3_function_stats) + + (ARRAY_SIZE(hinic3_tx_queue_stats) + + ARRAY_SIZE(hinic3_rx_queue_stats)) * + q_num; + + if (!HINIC3_IS_VF(nic_dev->hwdev)) + count += ARRAY_SIZE(hinic3_port_stats); + + return count; + default: + return -EOPNOTSUPP; + } +} + +static u16 hinic3_get_ethtool_port_stats(struct net_device *netdev, u64 *data) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct mag_cmd_port_stats *ps; + u16 i = 0, j; + char *p; + int err; + + ps = kmalloc_obj(*ps); + if (!ps) + goto err_zero_stats; + + err = hinic3_get_phy_port_stats(nic_dev->hwdev, ps); + if (err) { + kfree(ps); + netdev_err_once(netdev, "Failed to get port stats from fw\n"); + goto err_zero_stats; + } + + for (j = 0; j < ARRAY_SIZE(hinic3_port_stats); j++, i++) { + p = (char *)ps + hinic3_port_stats[j].offset; + data[i] = le64_to_cpu(*(__le64 *)p); + } + + kfree(ps); + + return i; + +err_zero_stats: + memset(&data[i], 0, ARRAY_SIZE(hinic3_port_stats) * sizeof(*data)); + + return i + ARRAY_SIZE(hinic3_port_stats); +} + +static void hinic3_get_drv_queue_stats(struct net_device *netdev, u64 *data) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct hinic3_txq_stats txq_stats = {}; + struct hinic3_rxq_stats rxq_stats = {}; + u16 i = 0, j, qid; + char *p; + + for (qid = 0; qid < nic_dev->q_params.num_qps; qid++) { + hinic3_txq_get_stats(&nic_dev->txqs[qid], &txq_stats); + for (j = 0; j < ARRAY_SIZE(hinic3_tx_queue_stats); j++, i++) { + p = (char *)&txq_stats + + hinic3_tx_queue_stats[j].offset; + data[i] = *(u64 *)p; + } + } + + i = nic_dev->q_params.num_qps * ARRAY_SIZE(hinic3_tx_queue_stats); + for (qid = 0; qid < nic_dev->q_params.num_qps; qid++) { + hinic3_rxq_get_stats(&nic_dev->rxqs[qid], &rxq_stats); + for (j = 0; j < ARRAY_SIZE(hinic3_rx_queue_stats); j++, i++) { + p = (char *)&rxq_stats + + hinic3_rx_queue_stats[j].offset; + data[i] = *(u64 *)p; + } + } +} + +static void hinic3_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats *stats, u64 *data) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct l2nic_vport_stats vport_stats = {}; + u16 i = 0, j; + char *p; + int err; + + err = hinic3_get_vport_stats(nic_dev->hwdev, + hinic3_global_func_id(nic_dev->hwdev), + &vport_stats); + if (err) + netdev_err_once(netdev, + "Failed to get function stats from fw\n"); + + for (j = 0; j < ARRAY_SIZE(hinic3_function_stats); j++, i++) { + p = (char *)&vport_stats + hinic3_function_stats[j].offset; + data[i] = le64_to_cpu(*(__le64 *)p); + } + + if (!HINIC3_IS_VF(nic_dev->hwdev)) + i += hinic3_get_ethtool_port_stats(netdev, data + i); + + hinic3_get_drv_queue_stats(netdev, data + i); +} + static const struct ethtool_ops hinic3_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_PKT_RATE_RX_USECS, @@ -417,6 +671,9 @@ static const struct ethtool_ops hinic3_ethtool_ops = { .get_msglevel = hinic3_get_msglevel, .set_msglevel = hinic3_set_msglevel, .get_link = ethtool_op_get_link, + .get_strings = hinic3_get_strings, + .get_sset_count = hinic3_get_sset_count, + .get_ethtool_stats = hinic3_get_ethtool_stats, }; void hinic3_set_ethtool_ops(struct net_device *netdev) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_hw_intf.h b/drivers/net/ethernet/huawei/hinic3/hinic3_hw_intf.h index cfc9daa3034f..6b0f486ba590 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_hw_intf.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_hw_intf.h @@ -53,6 +53,17 @@ static inline void mgmt_msg_params_init_default(struct mgmt_msg_params *msg_para msg_params->timeout_ms = 0; } +static inline void +mgmt_msg_params_init_in_out(struct mgmt_msg_params *msg_params, void *in_buf, + void *out_buf, u32 in_buf_size, u32 out_buf_size) +{ + msg_params->buf_in = in_buf; + msg_params->buf_out = out_buf; + msg_params->in_size = in_buf_size; + msg_params->expected_out_size = out_buf_size; + msg_params->timeout_ms = 0; +} + enum cfg_cmd { CFG_CMD_GET_DEV_CAP = 0, }; diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_mgmt_interface.h b/drivers/net/ethernet/huawei/hinic3/hinic3_mgmt_interface.h index c5bca3c4af96..a2fe66a40b3f 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_mgmt_interface.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_mgmt_interface.h @@ -143,6 +143,41 @@ struct l2nic_cmd_set_dcb_state { u8 rsvd[7]; }; +struct l2nic_port_stats_info { + struct mgmt_msg_head msg_head; + u16 func_id; + u16 rsvd1; +}; + +struct l2nic_vport_stats { + __le64 tx_unicast_pkts_vport; + __le64 tx_unicast_bytes_vport; + __le64 tx_multicast_pkts_vport; + __le64 tx_multicast_bytes_vport; + __le64 tx_broadcast_pkts_vport; + __le64 tx_broadcast_bytes_vport; + + __le64 rx_unicast_pkts_vport; + __le64 rx_unicast_bytes_vport; + __le64 rx_multicast_pkts_vport; + __le64 rx_multicast_bytes_vport; + __le64 rx_broadcast_pkts_vport; + __le64 rx_broadcast_bytes_vport; + + __le64 tx_discard_vport; + __le64 rx_discard_vport; + __le64 tx_err_vport; + __le64 rx_err_vport; +}; + +struct l2nic_cmd_vport_stats { + struct mgmt_msg_head msg_head; + u32 stats_size; + u32 rsvd1; + struct l2nic_vport_stats stats; + u64 rsvd2[6]; +}; + struct l2nic_cmd_lro_config { struct mgmt_msg_head msg_head; u16 func_id; @@ -234,6 +269,7 @@ enum l2nic_cmd { L2NIC_CMD_SET_VPORT_ENABLE = 6, L2NIC_CMD_SET_RX_MODE = 7, L2NIC_CMD_SET_SQ_CI_ATTR = 8, + L2NIC_CMD_GET_VPORT_STAT = 9, L2NIC_CMD_CLEAR_QP_RESOURCE = 11, L2NIC_CMD_CFG_RX_LRO = 13, L2NIC_CMD_CFG_LRO_TIMER = 14, @@ -272,6 +308,7 @@ enum mag_cmd { MAG_CMD_SET_PORT_ENABLE = 6, MAG_CMD_GET_LINK_STATUS = 7, + MAG_CMD_GET_PORT_STAT = 151, MAG_CMD_GET_PORT_INFO = 153, }; diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c index 943310274a69..621d8b12e247 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c @@ -816,8 +816,7 @@ static void hinic3_get_stats64(struct net_device *netdev, start = u64_stats_fetch_begin(&rxq_stats->syncp); bytes = rxq_stats->bytes; packets = rxq_stats->packets; - errors = rxq_stats->csum_errors + - rxq_stats->other_errors; + errors = rxq_stats->other_errors; dropped = rxq_stats->dropped; } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); stats->rx_packets += packets; diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c index de5a7984d2cb..e4a3fa6fb8db 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c @@ -738,3 +738,67 @@ int hinic3_get_pause_info(struct hinic3_nic_dev *nic_dev, return hinic3_cfg_hw_pause(nic_dev->hwdev, MGMT_MSG_CMD_OP_GET, nic_pause); } + +int hinic3_get_vport_stats(struct hinic3_hwdev *hwdev, u16 func_id, + struct l2nic_vport_stats *stats) +{ + struct l2nic_cmd_vport_stats vport_stats = {}; + struct l2nic_port_stats_info stats_info = {}; + struct mgmt_msg_params msg_params = {}; + int err; + + stats_info.func_id = func_id; + + mgmt_msg_params_init_in_out(&msg_params, &stats_info, &vport_stats, + sizeof(stats_info), sizeof(vport_stats)); + + err = hinic3_send_mbox_to_mgmt(hwdev, MGMT_MOD_L2NIC, + L2NIC_CMD_GET_VPORT_STAT, &msg_params); + + if (err || vport_stats.msg_head.status) { + dev_err_once(hwdev->dev, + "Failed to get function statistics, err: %d, status: 0x%x\n", + err, vport_stats.msg_head.status); + return -EFAULT; + } + + memcpy(stats, &vport_stats.stats, sizeof(*stats)); + + return 0; +} + +int hinic3_get_phy_port_stats(struct hinic3_hwdev *hwdev, + struct mag_cmd_port_stats *stats) +{ + struct mag_cmd_get_port_stats_in ps_in = {}; + struct mag_cmd_get_port_stats_out *ps_out; + struct mgmt_msg_params msg_params = {}; + int err; + + ps_out = kzalloc_obj(*ps_out); + if (!ps_out) + return -ENOMEM; + + ps_in.port_id = hinic3_physical_port_id(hwdev); + + mgmt_msg_params_init_in_out(&msg_params, &ps_in, ps_out, + sizeof(ps_in), sizeof(*ps_out)); + + err = hinic3_send_mbox_to_mgmt(hwdev, MGMT_MOD_HILINK, + MAG_CMD_GET_PORT_STAT, &msg_params); + + if (err || ps_out->head.status) { + dev_err_once(hwdev->dev, + "Failed to get port statistics, err: %d, status: 0x%x\n", + err, ps_out->head.status); + err = -EFAULT; + goto out; + } + + memcpy(stats, &ps_out->counter, sizeof(*stats)); + +out: + kfree(ps_out); + + return err; +} diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h index 5d52202a8d4e..bcfdc8c7367d 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h @@ -129,6 +129,110 @@ struct mag_cmd_get_xsfp_present { u8 rsvd[2]; }; +struct mag_cmd_port_stats { + __le64 mac_tx_fragment_pkts; + __le64 mac_tx_undersize_pkts; + __le64 mac_tx_undermin_pkts; + __le64 mac_tx_64_oct_pkts; + __le64 mac_tx_65_127_oct_pkts; + __le64 mac_tx_128_255_oct_pkts; + __le64 mac_tx_256_511_oct_pkts; + __le64 mac_tx_512_1023_oct_pkts; + __le64 mac_tx_1024_1518_oct_pkts; + __le64 mac_tx_1519_2047_oct_pkts; + __le64 mac_tx_2048_4095_oct_pkts; + __le64 mac_tx_4096_8191_oct_pkts; + __le64 mac_tx_8192_9216_oct_pkts; + __le64 mac_tx_9217_12287_oct_pkts; + __le64 mac_tx_12288_16383_oct_pkts; + __le64 mac_tx_jabber_bad_pkts; + __le64 mac_tx_jabber_good_pkts; + __le64 mac_tx_oversize_pkts; + __le64 mac_tx_ieee_jabber_pkts; + __le64 mac_tx_bad_pkts; + __le64 mac_tx_bad_octs; + __le64 mac_tx_good_pkts; + __le64 mac_tx_good_octs; + __le64 mac_tx_total_pkts; + __le64 mac_tx_total_octs; + __le64 mac_tx_uni_pkts; + __le64 mac_tx_multi_pkts; + __le64 mac_tx_broad_pkts; + __le64 mac_tx_pause_pkts; + __le64 mac_tx_pfc_pkts; + __le64 mac_tx_pfc_pri0_pkts; + __le64 mac_tx_pfc_pri1_pkts; + __le64 mac_tx_pfc_pri2_pkts; + __le64 mac_tx_pfc_pri3_pkts; + __le64 mac_tx_pfc_pri4_pkts; + __le64 mac_tx_pfc_pri5_pkts; + __le64 mac_tx_pfc_pri6_pkts; + __le64 mac_tx_pfc_pri7_pkts; + __le64 mac_tx_control_pkts; + __le64 mac_tx_err_all_pkts; + __le64 mac_tx_from_app_good_pkts; + __le64 mac_tx_from_app_bad_pkts; + + __le64 mac_rx_fragment_pkts; + __le64 mac_rx_undersize_pkts; + __le64 mac_rx_undermin_pkts; + __le64 mac_rx_64_oct_pkts; + __le64 mac_rx_65_127_oct_pkts; + __le64 mac_rx_128_255_oct_pkts; + __le64 mac_rx_256_511_oct_pkts; + __le64 mac_rx_512_1023_oct_pkts; + __le64 mac_rx_1024_1518_oct_pkts; + __le64 mac_rx_1519_2047_oct_pkts; + __le64 mac_rx_2048_4095_oct_pkts; + __le64 mac_rx_4096_8191_oct_pkts; + __le64 mac_rx_8192_9216_oct_pkts; + __le64 mac_rx_9217_12287_oct_pkts; + __le64 mac_rx_12288_16383_oct_pkts; + __le64 mac_rx_jabber_bad_pkts; + __le64 mac_rx_jabber_good_pkts; + __le64 mac_rx_oversize_pkts; + __le64 mac_rx_ieee_jabber_pkts; + __le64 mac_rx_bad_pkts; + __le64 mac_rx_bad_octs; + __le64 mac_rx_good_pkts; + __le64 mac_rx_good_octs; + __le64 mac_rx_total_pkts; + __le64 mac_rx_total_octs; + __le64 mac_rx_uni_pkts; + __le64 mac_rx_multi_pkts; + __le64 mac_rx_broad_pkts; + __le64 mac_rx_pause_pkts; + __le64 mac_rx_pfc_pkts; + __le64 mac_rx_pfc_pri0_pkts; + __le64 mac_rx_pfc_pri1_pkts; + __le64 mac_rx_pfc_pri2_pkts; + __le64 mac_rx_pfc_pri3_pkts; + __le64 mac_rx_pfc_pri4_pkts; + __le64 mac_rx_pfc_pri5_pkts; + __le64 mac_rx_pfc_pri6_pkts; + __le64 mac_rx_pfc_pri7_pkts; + __le64 mac_rx_control_pkts; + __le64 mac_rx_sym_err_pkts; + __le64 mac_rx_fcs_err_pkts; + __le64 mac_rx_send_app_good_pkts; + __le64 mac_rx_send_app_bad_pkts; + __le64 mac_rx_unfilter_pkts; +}; + +struct mag_cmd_get_port_stats_in { + struct mgmt_msg_head head; + + u8 port_id; + u8 rsvd0[3]; +}; + +struct mag_cmd_get_port_stats_out { + struct mgmt_msg_head head; + + struct mag_cmd_port_stats counter; + u64 rsvd1[15]; +}; + enum link_err_type { LINK_ERR_MODULE_UNRECOGENIZED, LINK_ERR_NUM, @@ -215,4 +319,8 @@ int hinic3_del_vlan(struct hinic3_hwdev *hwdev, u16 vlan_id, u16 func_id); int hinic3_get_pause_info(struct hinic3_nic_dev *nic_dev, struct hinic3_nic_pause_config *nic_pause); +int hinic3_get_vport_stats(struct hinic3_hwdev *hwdev, u16 func_id, + struct l2nic_vport_stats *stats); +int hinic3_get_phy_port_stats(struct hinic3_hwdev *hwdev, + struct mag_cmd_port_stats *stats); #endif diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c index ad6b65fce9c9..8154a6bff928 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c @@ -43,10 +43,7 @@ static void hinic3_rxq_clean_stats(struct hinic3_rxq_stats *rxq_stats) rxq_stats->other_errors = 0; rxq_stats->dropped = 0; rxq_stats->rx_buf_empty = 0; - - rxq_stats->alloc_skb_err = 0; - rxq_stats->alloc_rx_buf_err = 0; - rxq_stats->restore_drop_sge = 0; + rxq_stats->alloc_fail = 0; u64_stats_update_end(&rxq_stats->syncp); } @@ -147,6 +144,8 @@ static u32 hinic3_rx_fill_buffers(struct hinic3_rxq *rxq) { u32 i, free_wqebbs = rxq->delta - 1; struct hinic3_rx_info *rx_info; + struct u64_stats_sync *syncp; + unsigned long flags; dma_addr_t dma_addr; int err; @@ -155,8 +154,13 @@ static u32 hinic3_rx_fill_buffers(struct hinic3_rxq *rxq) err = rx_alloc_mapped_page(rxq->page_pool, rx_info, rxq->buf_len); - if (unlikely(err)) + if (unlikely(err)) { + syncp = &rxq->rxq_stats.syncp; + flags = u64_stats_update_begin_irqsave(syncp); + rxq->rxq_stats.alloc_fail++; + u64_stats_update_end_irqrestore(syncp, flags); break; + } dma_addr = page_pool_get_dma_addr(rx_info->page) + rx_info->page_offset; @@ -170,6 +174,11 @@ static u32 hinic3_rx_fill_buffers(struct hinic3_rxq *rxq) rxq->next_to_update << HINIC3_NORMAL_RQ_WQE); rxq->delta -= i; rxq->next_to_alloc = rxq->next_to_update; + } else if (free_wqebbs == rxq->q_depth - 1) { + syncp = &rxq->rxq_stats.syncp; + flags = u64_stats_update_begin_irqsave(syncp); + rxq->rxq_stats.rx_buf_empty++; + u64_stats_update_end_irqrestore(syncp, flags); } return i; @@ -328,8 +337,25 @@ static void hinic3_rx_csum(struct hinic3_rxq *rxq, u32 offload_type, u32 ip_type = RQ_CQE_OFFOLAD_TYPE_GET(offload_type, IP_TYPE); u32 csum_err = RQ_CQE_STATUS_GET(status, CSUM_ERR); struct net_device *netdev = rxq->netdev; + bool hw_csum_failed; bool l2_tunnel; + /* HW ensures that only 1 bit is set in csum_err. */ + if (unlikely(csum_err == HINIC3_RX_CSUM_IPSU_OTHER_ERR)) { + u64_stats_update_begin(&rxq->rxq_stats.syncp); + rxq->rxq_stats.other_errors++; + u64_stats_update_end(&rxq->rxq_stats.syncp); + } + + hw_csum_failed = csum_err && + csum_err != HINIC3_RX_CSUM_HW_CHECK_NONE && + csum_err != HINIC3_RX_CSUM_IPSU_OTHER_ERR; + if (unlikely(hw_csum_failed)) { + u64_stats_update_begin(&rxq->rxq_stats.syncp); + rxq->rxq_stats.csum_errors++; + u64_stats_update_end(&rxq->rxq_stats.syncp); + } + if (!(netdev->features & NETIF_F_RXCSUM)) return; @@ -387,8 +413,12 @@ static int recv_one_pkt(struct hinic3_rxq *rxq, struct hinic3_rq_cqe *rx_cqe, u16 num_lro; skb = hinic3_fetch_rx_buffer(rxq, pkt_len); - if (unlikely(!skb)) + if (unlikely(!skb)) { + u64_stats_update_begin(&rxq->rxq_stats.syncp); + rxq->rxq_stats.alloc_fail++; + u64_stats_update_end(&rxq->rxq_stats.syncp); return -ENOMEM; + } /* place header in linear portion of buffer */ if (skb_is_nonlinear(skb)) @@ -554,6 +584,7 @@ int hinic3_rx_poll(struct hinic3_rxq *rxq, int budget) { struct hinic3_nic_dev *nic_dev = netdev_priv(rxq->netdev); u32 sw_ci, status, pkt_len, vlan_len; + u64 rx_packets = 0, rx_bytes = 0; struct hinic3_rq_cqe *rx_cqe; bool poll_again = false; bool oom = false; @@ -580,8 +611,13 @@ int hinic3_rx_poll(struct hinic3_rxq *rxq, int budget) nr_pkts++; num_lro = RQ_CQE_STATUS_GET(status, NUM_LRO); - if (num_lro) + if (num_lro) { num_wqe += hinic3_get_sge_num(rxq, pkt_len); + rx_packets += num_lro; + } else { + rx_packets++; + } + rx_bytes += pkt_len; rx_cqe->status = 0; @@ -604,5 +640,24 @@ int hinic3_rx_poll(struct hinic3_rxq *rxq, int budget) if (unlikely(oom)) hinic3_rx_oom_schedule(rxq->netdev, rxq->q_id); + u64_stats_update_begin(&rxq->rxq_stats.syncp); + rxq->rxq_stats.packets += rx_packets; + rxq->rxq_stats.bytes += rx_bytes; + u64_stats_update_end(&rxq->rxq_stats.syncp); return poll_again ? budget : nr_pkts; } + +void hinic3_rxq_get_stats(struct hinic3_rxq *rxq, + struct hinic3_rxq_stats *stats) +{ + struct hinic3_rxq_stats *rxq_stats = &rxq->rxq_stats; + unsigned int start; + + do { + start = u64_stats_fetch_begin(&rxq_stats->syncp); + stats->csum_errors = rxq_stats->csum_errors; + stats->other_errors = rxq_stats->other_errors; + stats->rx_buf_empty = rxq_stats->rx_buf_empty; + stats->alloc_fail = rxq_stats->alloc_fail; + } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); +} diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.h b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.h index 06d1b3299e7c..a54184beedc9 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.h @@ -8,6 +8,10 @@ #include <linux/dim.h> #include <linux/netdevice.h> +/* rx cqe checksum err */ +#define HINIC3_RX_CSUM_HW_CHECK_NONE BIT(7) +#define HINIC3_RX_CSUM_IPSU_OTHER_ERR BIT(8) + #define RQ_CQE_OFFOLAD_TYPE_PKT_TYPE_MASK GENMASK(4, 0) #define RQ_CQE_OFFOLAD_TYPE_IP_TYPE_MASK GENMASK(6, 5) #define RQ_CQE_OFFOLAD_TYPE_TUNNEL_PKT_FORMAT_MASK GENMASK(11, 8) @@ -37,9 +41,7 @@ struct hinic3_rxq_stats { u64 other_errors; u64 dropped; u64 rx_buf_empty; - u64 alloc_skb_err; - u64 alloc_rx_buf_err; - u64 restore_drop_sge; + u64 alloc_fail; struct u64_stats_sync syncp; }; @@ -125,4 +127,6 @@ int hinic3_configure_rxqs(struct net_device *netdev, u16 num_rq, u32 rq_depth, struct hinic3_dyna_rxq_res *rxqs_res); int hinic3_rx_poll(struct hinic3_rxq *rxq, int budget); +void hinic3_rxq_get_stats(struct hinic3_rxq *rxq, + struct hinic3_rxq_stats *stats); #endif diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c index f92568f0f00b..04086947b0bc 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c @@ -25,11 +25,14 @@ static void hinic3_txq_clean_stats(struct hinic3_txq_stats *txq_stats) txq_stats->dropped = 0; txq_stats->skb_pad_err = 0; - txq_stats->frag_len_overflow = 0; txq_stats->offload_cow_skb_err = 0; txq_stats->map_frag_err = 0; txq_stats->unknown_tunnel_pkt = 0; - txq_stats->frag_size_err = 0; + txq_stats->gso_wire_packets = 0; + txq_stats->gso_wire_bytes = 0; + txq_stats->gso_packets = 0; + txq_stats->gso_bytes = 0; + txq_stats->wake = 0; u64_stats_update_end(&txq_stats->syncp); } @@ -97,8 +100,12 @@ static int hinic3_tx_map_skb(struct net_device *netdev, struct sk_buff *skb, dma_info[0].dma = dma_map_single(&pdev->dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE); - if (dma_mapping_error(&pdev->dev, dma_info[0].dma)) + if (dma_mapping_error(&pdev->dev, dma_info[0].dma)) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.map_frag_err++; + u64_stats_update_end(&txq->txq_stats.syncp); return -EFAULT; + } dma_info[0].len = skb_headlen(skb); @@ -117,6 +124,9 @@ static int hinic3_tx_map_skb(struct net_device *netdev, struct sk_buff *skb, skb_frag_size(frag), DMA_TO_DEVICE); if (dma_mapping_error(&pdev->dev, dma_info[idx].dma)) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.map_frag_err++; + u64_stats_update_end(&txq->txq_stats.syncp); err = -EFAULT; goto err_unmap_page; } @@ -260,6 +270,9 @@ static int hinic3_tx_csum(struct hinic3_txq *txq, struct hinic3_sq_task *task, if (l4_proto != IPPROTO_UDP || ((struct udphdr *)skb_transport_header(skb))->dest != VXLAN_OFFLOAD_PORT_LE) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.unknown_tunnel_pkt++; + u64_stats_update_end(&txq->txq_stats.syncp); /* Unsupported tunnel packet, disable csum offload */ return skb_checksum_help(skb); } @@ -531,41 +544,54 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb, struct hinic3_txq *txq) { struct hinic3_sq_wqe_combo wqe_combo = {}; + u16 wqebb_cnt, num_sge, free_wqebb; struct hinic3_tx_info *tx_info; struct hinic3_sq_task task; - u16 wqebb_cnt, num_sge; __le32 queue_info = 0; u16 saved_wq_prod_idx; u16 owner, pi = 0; u8 saved_sq_owner; u32 offload; + u32 pkt_len; int err; - if (skb_put_padto(skb, MIN_SKB_LEN)) + if (skb_put_padto(skb, MIN_SKB_LEN)) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.skb_pad_err++; + u64_stats_update_end(&txq->txq_stats.syncp); goto err_out; + } offload = hinic3_tx_offload(skb, &task, &queue_info, txq); num_sge = skb_shinfo(skb)->nr_frags + 1; /* assume normal wqe format + 1 wqebb for task info */ wqebb_cnt = num_sge + 1; + pkt_len = skb->len; - if (unlikely(hinic3_wq_free_wqebbs(&txq->sq->wq) < wqebb_cnt)) { + free_wqebb = hinic3_wq_free_wqebbs(&txq->sq->wq); + if (unlikely(free_wqebb < wqebb_cnt)) { if (likely(wqebb_cnt > txq->tx_stop_thrs)) txq->tx_stop_thrs = min(wqebb_cnt, txq->tx_start_thrs); - netif_subqueue_try_stop(netdev, txq->sq->q_id, - hinic3_wq_free_wqebbs(&txq->sq->wq), - txq->tx_start_thrs); - + if (!netif_subqueue_try_stop(netdev, txq->sq->q_id, + free_wqebb, + txq->tx_start_thrs)) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.busy++; + u64_stats_update_end(&txq->txq_stats.syncp); + } return NETDEV_TX_BUSY; } if (unlikely(offload == HINIC3_TX_OFFLOAD_INVALID)) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.offload_cow_skb_err++; + u64_stats_update_end(&txq->txq_stats.syncp); goto err_drop_pkt; } else if (!offload) { wqebb_cnt -= 1; if (unlikely(num_sge == 1 && - skb->len > HINIC3_COMPACT_WQEE_SKB_MAX_LEN)) + pkt_len > HINIC3_COMPACT_WQEE_SKB_MAX_LEN)) goto err_drop_pkt; } @@ -589,11 +615,16 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb, tx_info->skb = skb; tx_info->wqebb_cnt = wqebb_cnt; - netif_subqueue_sent(netdev, txq->sq->q_id, skb->len); - netif_subqueue_maybe_stop(netdev, txq->sq->q_id, - hinic3_wq_free_wqebbs(&txq->sq->wq), - txq->tx_stop_thrs, - txq->tx_start_thrs); + netif_subqueue_sent(netdev, txq->sq->q_id, pkt_len); + free_wqebb = hinic3_wq_free_wqebbs(&txq->sq->wq); + if (!netif_subqueue_maybe_stop(netdev, txq->sq->q_id, + free_wqebb, + txq->tx_stop_thrs, + txq->tx_start_thrs)) { + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.busy++; + u64_stats_update_end(&txq->txq_stats.syncp); + } hinic3_prepare_sq_ctrl(&wqe_combo, queue_info, num_sge, owner); hinic3_write_db(txq->sq, 0, DB_CFLAG_DP_SQ, @@ -604,6 +635,9 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb, err_drop_pkt: dev_kfree_skb_any(skb); err_out: + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.dropped++; + u64_stats_update_end(&txq->txq_stats.syncp); return NETDEV_TX_OK; } @@ -611,18 +645,25 @@ netdev_tx_t hinic3_xmit_frame(struct sk_buff *skb, struct net_device *netdev) { struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); u16 q_id = skb_get_queue_mapping(skb); - - if (unlikely(!netif_carrier_ok(netdev))) - goto err_drop_pkt; + struct hinic3_txq *txq; if (unlikely(q_id >= nic_dev->q_params.num_qps)) + goto err_qid_out; + + txq = &nic_dev->txqs[q_id]; + + if (unlikely(!netif_carrier_ok(netdev))) goto err_drop_pkt; - return hinic3_send_one_skb(skb, netdev, &nic_dev->txqs[q_id]); + return hinic3_send_one_skb(skb, netdev, txq); err_drop_pkt: - dev_kfree_skb_any(skb); + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.dropped++; + u64_stats_update_end(&txq->txq_stats.syncp); +err_qid_out: + dev_kfree_skb_any(skb); return NETDEV_TX_OK; } @@ -758,9 +799,18 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) { struct net_device *netdev = txq->netdev; u16 hw_ci, sw_ci, q_id = txq->sq->q_id; + unsigned int gso_wire_packets = 0; + unsigned int gso_wire_bytes = 0; struct hinic3_tx_info *tx_info; + unsigned int wire_packets = 0; unsigned int bytes_compl = 0; + unsigned int gso_packets = 0; + unsigned int wire_bytes = 0; + unsigned int gso_bytes = 0; unsigned int pkts = 0; + unsigned int wake = 0; + unsigned int gso_segs; + unsigned int hdr_len; u16 wqebb_cnt = 0; hw_ci = hinic3_get_sq_hw_ci(txq->sq); @@ -782,6 +832,29 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) bytes_compl += tx_info->skb->len; pkts++; + gso_segs = skb_is_gso(tx_info->skb) ? + max_t(u32, skb_shinfo(tx_info->skb)->gso_segs, 1) : 1; + wire_packets += gso_segs; + if (skb_is_gso(tx_info->skb)) { + u32 wire_len = tx_info->skb->len; + + gso_packets++; + gso_bytes += tx_info->skb->len; + gso_wire_packets += gso_segs; + + /* Only TCP GSO repeats a TCP header per segment. */ + if (skb_shinfo(tx_info->skb)->gso_type & + (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { + hdr_len = skb_transport_offset(tx_info->skb) + + tcp_hdrlen(tx_info->skb); + wire_len += (gso_segs - 1) * hdr_len; + } + wire_bytes += wire_len; + gso_wire_bytes += wire_len; + } else { + wire_bytes += tx_info->skb->len; + } + hinic3_tx_unmap_skb(netdev, tx_info->skb, tx_info->dma_info); napi_consume_skb(tx_info->skb, budget); tx_info->skb = NULL; @@ -789,9 +862,37 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) hinic3_wq_put_wqebbs(&txq->sq->wq, wqebb_cnt); - netif_subqueue_completed_wake(netdev, q_id, pkts, bytes_compl, - hinic3_wq_free_wqebbs(&txq->sq->wq), - txq->tx_start_thrs); + if (!netif_subqueue_completed_wake(netdev, q_id, pkts, bytes_compl, + hinic3_wq_free_wqebbs(&txq->sq->wq), + txq->tx_start_thrs)) { + wake = 1; + } + + u64_stats_update_begin(&txq->txq_stats.syncp); + txq->txq_stats.bytes += wire_bytes; + txq->txq_stats.packets += wire_packets; + txq->txq_stats.gso_bytes += gso_bytes; + txq->txq_stats.gso_packets += gso_packets; + txq->txq_stats.gso_wire_bytes += gso_wire_bytes; + txq->txq_stats.gso_wire_packets += gso_wire_packets; + txq->txq_stats.wake += wake; + u64_stats_update_end(&txq->txq_stats.syncp); return pkts == HINIC3_TX_POLL_WEIGHT; } + +void hinic3_txq_get_stats(struct hinic3_txq *txq, + struct hinic3_txq_stats *stats) +{ + struct hinic3_txq_stats *txq_stats = &txq->txq_stats; + unsigned int start; + + do { + start = u64_stats_fetch_begin(&txq_stats->syncp); + stats->busy = txq_stats->busy; + stats->skb_pad_err = txq_stats->skb_pad_err; + stats->offload_cow_skb_err = txq_stats->offload_cow_skb_err; + stats->map_frag_err = txq_stats->map_frag_err; + stats->unknown_tunnel_pkt = txq_stats->unknown_tunnel_pkt; + } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); +} diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.h b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.h index 00194f2a1bcc..c03af76a4cbc 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.h @@ -106,11 +106,14 @@ struct hinic3_txq_stats { u64 busy; u64 dropped; u64 skb_pad_err; - u64 frag_len_overflow; u64 offload_cow_skb_err; u64 map_frag_err; u64 unknown_tunnel_pkt; - u64 frag_size_err; + u64 gso_wire_packets; + u64 gso_wire_bytes; + u64 gso_packets; + u64 gso_bytes; + u64 wake; struct u64_stats_sync syncp; }; @@ -160,4 +163,6 @@ netdev_tx_t hinic3_xmit_frame(struct sk_buff *skb, struct net_device *netdev); bool hinic3_tx_poll(struct hinic3_txq *txq, int budget); void hinic3_flush_txqs(struct net_device *netdev); +void hinic3_txq_get_stats(struct hinic3_txq *txq, + struct hinic3_txq_stats *stats); #endif -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) 2026-12-04 4:08 ` [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) Fan Gong @ 2026-12-05 4:17 ` netdev-bot+sashiko 0 siblings, 0 replies; 9+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 4:17 UTC (permalink / raw) To: gongfan1 Cc: wudi234, tengpeisen, netdev, davem, edumazet, kuba, pabeni, horms, andrew+netdev, ioana.ciornei, maxime.chevallier, mohsin.bashr, dimitri.daskalakis1, hramamurthy, larysa.zaremba, vadim.fedorenko, linux-kernel, linux-doc, zhoushuai28, wulike1 Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 1 · Low: 3 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] hinic3_send_one_skb() (drivers/net/ethernet/huawei/hinic3/hinic3_tx.c) now reads the free… - [Medium] hinic3_tx_poll() (drivers/net/ethernet/huawei/hinic3/hinic3_tx.c) computes the per-… - [Low] This patch makes hinic3_rx_poll() (drivers/net/ethernet/huawei/hinic3/hinic3_rx.c) the first writer of… - [Low] hinic3: concurrent txq_stats.syncp updates and unmarked u64 stats accesses - [Low] hinic3: commit message omits rx_errors change in hinic3_get_stats64() -- hinic3: Add ethtool statistic ops part(1/2) This commit adds per-queue TX/RX software counters and firmware-backed vport and physical port statistics to hinic3, and exposes them through ethtool -S. TX packet and byte accounting moves to hinic3_tx_poll() and is counted as wire packets/bytes. The tx stop paths now use the return values of netif_subqueue_try_stop() and netif_subqueue_maybe_stop(). > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c > index ad6b65fce9c9e..8154a6bff9282 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c [ ... ] > @@ -580,8 +611,13 @@ int hinic3_rx_poll(struct hinic3_rxq *rxq, int budget) > > nr_pkts++; > num_lro = RQ_CQE_STATUS_GET(status, NUM_LRO); > - if (num_lro) > + if (num_lro) { > num_wqe += hinic3_get_sge_num(rxq, pkt_len); > + rx_packets += num_lro; > + } else { > + rx_packets++; > + } > + rx_bytes += pkt_len; > > rx_cqe->status = 0; > > @@ -604,5 +640,24 @@ int hinic3_rx_poll(struct hinic3_rxq *rxq, int budget) > if (unlikely(oom)) > hinic3_rx_oom_schedule(rxq->netdev, rxq->q_id); > > + u64_stats_update_begin(&rxq->rxq_stats.syncp); > + rxq->rxq_stats.packets += rx_packets; > + rxq->rxq_stats.bytes += rx_bytes; > + u64_stats_update_end(&rxq->rxq_stats.syncp); > return poll_again ? budget : nr_pkts; > } [Severity: Low] This isn't a bug, but the commit message doesn't mention this change. Before this patch, rxq_stats.packets and rxq_stats.bytes were only zeroed in hinic3_rxq_clean_stats(). This makes hinic3_rx_poll() the first code that writes them. hinic3_net_dim() in hinic3_irq.c feeds the same fields to DIM: dim_update_sample(irq_cfg->total_events, rxq->rxq_stats.packets, rxq->rxq_stats.bytes, &sample); adaptive_rx_coal defaults to 1 in hinic3_main.c. So since b35a6fd37a00 ("hinic3: Add adaptive IRQ coalescing with DIM"), DIM has been sampling zeros by default. With this patch it starts adapting, which changes the default interrupt moderation behaviour. hinic3_get_stats64() also stops reporting zero RX packets and bytes. Could the commit message describe the RX accounting change? That includes the LRO rule (packets counted as num_lro, bytes counted as the coalesced pkt_len, unlike the wire bytes rule described for TX) and the resulting DIM behaviour change. Would it also make sense to split out the DIM fix with a Fixes: tag, so that it can reach stable? [ ... ] > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c > index f92568f0f00b7..04086947b0bc5 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c [ ... ] > @@ -531,41 +544,54 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb, [ ... ] > offload = hinic3_tx_offload(skb, &task, &queue_info, txq); > num_sge = skb_shinfo(skb)->nr_frags + 1; > /* assume normal wqe format + 1 wqebb for task info */ > wqebb_cnt = num_sge + 1; > + pkt_len = skb->len; > > - if (unlikely(hinic3_wq_free_wqebbs(&txq->sq->wq) < wqebb_cnt)) { > + free_wqebb = hinic3_wq_free_wqebbs(&txq->sq->wq); > + if (unlikely(free_wqebb < wqebb_cnt)) { > if (likely(wqebb_cnt > txq->tx_stop_thrs)) > txq->tx_stop_thrs = min(wqebb_cnt, txq->tx_start_thrs); > > - netif_subqueue_try_stop(netdev, txq->sq->q_id, > - hinic3_wq_free_wqebbs(&txq->sq->wq), > - txq->tx_start_thrs); > - > + if (!netif_subqueue_try_stop(netdev, txq->sq->q_id, > + free_wqebb, > + txq->tx_start_thrs)) { > + u64_stats_update_begin(&txq->txq_stats.syncp); > + txq->txq_stats.busy++; > + u64_stats_update_end(&txq->txq_stats.syncp); > + } > return NETDEV_TX_BUSY; > } [Severity: High] Can this lose a TX queue wakeup? netif_subqueue_try_stop() evaluates get_desc again after stopping the queue, so that it can catch completions that ran concurrently: netif_tx_stop_queue(txq); smp_mb__after_atomic(); ... if (unlikely(get_desc >= start_thrs)) { netif_tx_start_queue(txq); include/net/netdev_queues.h documents this requirement: @get_desc must be a formula or a function call, it must always return up-to-date information when evaluated! free_wqebb is a local snapshot taken before the stop. The second check therefore compares a stale value and can no longer see a concurrent hinic3_tx_poll(). For example: CPU0 (hinic3_send_one_skb) CPU1 (hinic3_tx_poll) free_wqebb = hinic3_wq_free_wqebbs() (< wqebb_cnt) hinic3_wq_put_wqebbs() netif_subqueue_completed_wake() queue not stopped yet, no wake netif_tx_stop_queue() smp_mb__after_atomic() free_wqebb >= tx_start_thrs (stale, false) return NETDEV_TX_BUSY If CPU1 completed the last in-flight WQEs, no later completion runs to wake the queue, and it stays stopped. hinic3_tx_timeout() does not wake the queue either, and it does nothing when sw_pi == hw_ci. Would passing hinic3_wq_free_wqebbs(&txq->sq->wq) directly, as the old code did, restore the re-check? The netif_subqueue_maybe_stop() call after the WQE is posted has the same pattern. There, the doorbelled packet's completion should still wake the queue, so the effect is limited to unneeded stops. [ ... ] > @@ -782,6 +832,29 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) > bytes_compl += tx_info->skb->len; > pkts++; > > + gso_segs = skb_is_gso(tx_info->skb) ? > + max_t(u32, skb_shinfo(tx_info->skb)->gso_segs, 1) : 1; > + wire_packets += gso_segs; > + if (skb_is_gso(tx_info->skb)) { > + u32 wire_len = tx_info->skb->len; > + > + gso_packets++; > + gso_bytes += tx_info->skb->len; > + gso_wire_packets += gso_segs; > + > + /* Only TCP GSO repeats a TCP header per segment. */ > + if (skb_shinfo(tx_info->skb)->gso_type & > + (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { > + hdr_len = skb_transport_offset(tx_info->skb) + > + tcp_hdrlen(tx_info->skb); > + wire_len += (gso_segs - 1) * hdr_len; > + } [Severity: Medium] Does this compute the wrong hdr_len for UDP tunnel TSO skbs? The driver advertises NETIF_F_GSO_UDP_TUNNEL and NETIF_F_GSO_UDP_TUNNEL_CSUM in features and hw_enc_features. For a VXLAN TCP GSO skb, gso_type contains both SKB_GSO_UDP_TUNNEL and SKB_GSO_TCPV4/6, and skb->transport_header points at the outer UDP header. tcp_hdrlen() would then read doff from inside the VXLAN header instead of the inner TCP header. hinic3_tso() already handles this case by switching to the inner headers: if (skb->encapsulation) { ... ip.hdr = skb_inner_network_header(skb); l4.hdr = skb_inner_transport_header(skb); As written, txq_stats.bytes and gso_wire_bytes look wrong for tunnel TSO traffic. txq_stats.bytes is reported as tx_bytes by hinic3_get_stats64(). gso_wire_bytes is exported as qstats hw-gso-wire-bytes by the later patch "hinic3: Add per-queue netdev-genl stats" in this series. Should this use skb_inner_transport_offset() + inner_tcp_hdrlen() when skb->encapsulation is set? This also doesn't match this part of the commit message: the repeated TCP header length is added to the byte count. [ ... ] > @@ -789,9 +862,37 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) > > hinic3_wq_put_wqebbs(&txq->sq->wq, wqebb_cnt); > > - netif_subqueue_completed_wake(netdev, q_id, pkts, bytes_compl, > - hinic3_wq_free_wqebbs(&txq->sq->wq), > - txq->tx_start_thrs); > + if (!netif_subqueue_completed_wake(netdev, q_id, pkts, bytes_compl, > + hinic3_wq_free_wqebbs(&txq->sq->wq), > + txq->tx_start_thrs)) { > + wake = 1; > + } > + > + u64_stats_update_begin(&txq->txq_stats.syncp); > + txq->txq_stats.bytes += wire_bytes; > + txq->txq_stats.packets += wire_packets; > + txq->txq_stats.gso_bytes += gso_bytes; > + txq->txq_stats.gso_packets += gso_packets; > + txq->txq_stats.gso_wire_bytes += gso_wire_bytes; > + txq->txq_stats.gso_wire_packets += gso_wire_packets; > + txq->txq_stats.wake += wake; > + u64_stats_update_end(&txq->txq_stats.syncp); > > return pkts == HINIC3_TX_POLL_WEIGHT; > } > + > +void hinic3_txq_get_stats(struct hinic3_txq *txq, > + struct hinic3_txq_stats *stats) > +{ > + struct hinic3_txq_stats *txq_stats = &txq->txq_stats; > + unsigned int start; > + > + do { > + start = u64_stats_fetch_begin(&txq_stats->syncp); > + stats->busy = txq_stats->busy; > + stats->skb_pad_err = txq_stats->skb_pad_err; > + stats->offload_cow_skb_err = txq_stats->offload_cow_skb_err; > + stats->map_frag_err = txq_stats->map_frag_err; > + stats->unknown_tunnel_pkt = txq_stats->unknown_tunnel_pkt; > + } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); > +} [Severity: Low] Is it safe for the xmit path and the NAPI completion path to share txq->txq_stats.syncp as writers? hinic3_send_one_skb(), hinic3_tx_map_skb(), hinic3_tx_csum() and hinic3_xmit_frame() update txq->txq_stats.syncp under the netdev_queue _xmit_lock, while hinic3_tx_poll() updates it from hinic3_poll() in softirq without holding that lock. include/linux/u64_stats_sync.h requires writers on the same syncp to be mutually exclusive. Otherwise a lost seqcount update can leave 32-bit readers spinning forever. The Kconfig dependency on 64BIT makes the seqcount compile away, and the two paths touch disjoint fields, so this is latent today. That also means syncp provides no protection on the supported builds. The counters are plain u64 updated with ++ and += in hinic3_send_one_skb(), hinic3_tx_poll() and hinic3_rx_poll(), and read locklessly by hinic3_get_stats64(), hinic3_txq_get_stats() and hinic3_rxq_get_stats(). Those are plain C data races that KCSAN will flag, and nothing stops the compiler from tearing the accesses. Would it make sense to give the submit and completion paths separate u64_stats_sync instances, and to convert the queue counters to u64_stats_t with u64_stats_inc(), u64_stats_add() and u64_stats_read()? The per-queue netdev-genl stats added later in this series read the same fields, so they would need the same treatment. [ ... ] > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c > @@ -816,8 +816,7 @@ static void hinic3_get_stats64(struct net_device *netdev, > start = u64_stats_fetch_begin(&rxq_stats->syncp); > bytes = rxq_stats->bytes; > packets = rxq_stats->packets; > - errors = rxq_stats->csum_errors + > - rxq_stats->other_errors; > + errors = rxq_stats->other_errors; > dropped = rxq_stats->dropped; > } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); > stats->rx_packets += packets; [Severity: Low] This isn't a bug, but the commit message doesn't mention this change. hinic3_get_stats64() used to report csum_errors + other_errors as rx_errors. This patch drops csum_errors from rx_errors, and it is the same patch that adds the first csum_errors writer in hinic3_rx_csum(). Commit 0f00324913b4 ("hinic3: Read the queue counters once per u64_stats retry loop") kept rx_errors as the sum and left the checksum error accounting to the commit that adds the writer, so this is where the decision is actually made. Frames that fail the hardware checksum are still passed up with CHECKSUM_NONE rather than dropped, so leaving them out of rx_errors may well be intended. Could the commit message describe the rx_errors change and say where hardware checksum failures are reported instead? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796348433.git.gongfan1%40huawei.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2) 2026-12-04 4:08 [PATCH net-next v19 0/4] net: hinic3: Support ethtool ops Fan Gong 2026-12-04 4:08 ` [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) Fan Gong @ 2026-12-04 4:08 ` Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 2026-12-04 4:08 ` [PATCH net-next v19 3/4] hinic3: Add per-queue netdev-genl stats Fan Gong 2026-12-04 4:08 ` [PATCH net-next v19 4/4] hinic3: Add ethtool pause param ops Fan Gong 3 siblings, 1 reply; 9+ messages in thread From: Fan Gong @ 2026-12-04 4:08 UTC (permalink / raw) To: Fan Gong, Wu Di, Teng Peisen, netdev, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn, Ioana Ciornei, Maxime Chevallier, Mohsin Bashir, Dimitri Daskalakis, Harshitha Ramamurthy, Larysa Zaremba, Vadim Fedorenko Cc: linux-kernel, linux-doc, Zhou Shuai, Wu Like This commit adds five standard ethtool statistics callbacks to the hinic3 driver: get_eth_phy_stats, get_eth_mac_stats, get_eth_ctrl_stats, get_rmon_stats and get_pause_stats. Each callback reads the physical port counters from firmware via hinic3_get_phy_port_stats() and copies them into the standard ethtool structures. Co-developed-by: Wu Di <wudi234@huawei.com> Signed-off-by: Wu Di <wudi234@huawei.com> Co-developed-by: Teng Peisen <tengpeisen@huawei.com> Signed-off-by: Teng Peisen <tengpeisen@huawei.com> Co-developed-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> --- .../ethernet/huawei/hinic3/hinic3_ethtool.c | 218 +++++++++++++++++- 1 file changed, 217 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c index 0ec5d7f21e09..1a62668a65f7 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c @@ -663,6 +663,199 @@ static void hinic3_get_ethtool_stats(struct net_device *netdev, hinic3_get_drv_queue_stats(netdev, data + i); } +static void hinic3_get_eth_phy_stats(struct net_device *netdev, + struct ethtool_eth_phy_stats *phy_stats) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct mag_cmd_port_stats *ps; + int err; + + ps = kmalloc_obj(*ps); + if (!ps) + return; + + err = hinic3_get_phy_port_stats(nic_dev->hwdev, ps); + if (err) { + kfree(ps); + netdev_err_once(netdev, + "Failed to get eth phy stats from fw\n"); + return; + } + + phy_stats->SymbolErrorDuringCarrier = + le64_to_cpu(ps->mac_rx_sym_err_pkts); + + kfree(ps); +} + +static void hinic3_get_eth_mac_stats(struct net_device *netdev, + struct ethtool_eth_mac_stats *mac_stats) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct mag_cmd_port_stats *ps; + int err; + + ps = kmalloc_obj(*ps); + if (!ps) + return; + + err = hinic3_get_phy_port_stats(nic_dev->hwdev, ps); + if (err) { + kfree(ps); + netdev_err_once(netdev, + "Failed to get eth mac stats from fw\n"); + return; + } + + mac_stats->FramesTransmittedOK = + le64_to_cpu(ps->mac_tx_good_pkts); + mac_stats->FramesReceivedOK = + le64_to_cpu(ps->mac_rx_good_pkts); + mac_stats->FrameCheckSequenceErrors = + le64_to_cpu(ps->mac_rx_fcs_err_pkts); + mac_stats->OctetsTransmittedOK = + le64_to_cpu(ps->mac_tx_good_octs); + mac_stats->OctetsReceivedOK = + le64_to_cpu(ps->mac_rx_good_octs); + mac_stats->MulticastFramesXmittedOK = + le64_to_cpu(ps->mac_tx_multi_pkts); + mac_stats->BroadcastFramesXmittedOK = + le64_to_cpu(ps->mac_tx_broad_pkts); + mac_stats->MulticastFramesReceivedOK = + le64_to_cpu(ps->mac_rx_multi_pkts); + mac_stats->BroadcastFramesReceivedOK = + le64_to_cpu(ps->mac_rx_broad_pkts); + + kfree(ps); +} + +static void hinic3_get_eth_ctrl_stats(struct net_device *netdev, + struct ethtool_eth_ctrl_stats *ctrl_stats) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct mag_cmd_port_stats *ps; + int err; + + ps = kmalloc_obj(*ps); + if (!ps) + return; + + err = hinic3_get_phy_port_stats(nic_dev->hwdev, ps); + if (err) { + kfree(ps); + netdev_err_once(netdev, + "Failed to get eth ctrl stats from fw\n"); + return; + } + + ctrl_stats->MACControlFramesTransmitted = + le64_to_cpu(ps->mac_tx_control_pkts); + ctrl_stats->MACControlFramesReceived = + le64_to_cpu(ps->mac_rx_control_pkts); + + kfree(ps); +} + +static const struct ethtool_rmon_hist_range hinic3_rmon_ranges[] = { + { 0, 64 }, + { 65, 127 }, + { 128, 255 }, + { 256, 511 }, + { 512, 1023 }, + { 1024, 1518 }, + { 1519, 2047 }, + { 2048, 4095 }, + { 4096, 8191 }, + { 8192, 9216 }, + { 9217, 16383 }, + {} +}; + +static void hinic3_get_rmon_stats(struct net_device *netdev, + struct ethtool_rmon_stats *rmon_stats, + const struct ethtool_rmon_hist_range **ranges) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct mag_cmd_port_stats *ps; + int err; + + ps = kmalloc_obj(*ps); + if (!ps) + goto get_rmon_stats_err; + + err = hinic3_get_phy_port_stats(nic_dev->hwdev, ps); + if (err) { + kfree(ps); + netdev_err_once(netdev, + "Failed to get eth rmon stats from fw\n"); + goto get_rmon_stats_err; + } + + rmon_stats->undersize_pkts = le64_to_cpu(ps->mac_rx_undersize_pkts); + rmon_stats->oversize_pkts = le64_to_cpu(ps->mac_rx_oversize_pkts); + rmon_stats->fragments = le64_to_cpu(ps->mac_rx_fragment_pkts); + rmon_stats->jabbers = le64_to_cpu(ps->mac_rx_jabber_bad_pkts); + + rmon_stats->hist[0] = le64_to_cpu(ps->mac_rx_64_oct_pkts); + rmon_stats->hist[1] = le64_to_cpu(ps->mac_rx_65_127_oct_pkts); + rmon_stats->hist[2] = le64_to_cpu(ps->mac_rx_128_255_oct_pkts); + rmon_stats->hist[3] = le64_to_cpu(ps->mac_rx_256_511_oct_pkts); + rmon_stats->hist[4] = le64_to_cpu(ps->mac_rx_512_1023_oct_pkts); + rmon_stats->hist[5] = le64_to_cpu(ps->mac_rx_1024_1518_oct_pkts); + rmon_stats->hist[6] = le64_to_cpu(ps->mac_rx_1519_2047_oct_pkts); + rmon_stats->hist[7] = le64_to_cpu(ps->mac_rx_2048_4095_oct_pkts); + rmon_stats->hist[8] = le64_to_cpu(ps->mac_rx_4096_8191_oct_pkts); + rmon_stats->hist[9] = le64_to_cpu(ps->mac_rx_8192_9216_oct_pkts); + rmon_stats->hist[10] = le64_to_cpu(ps->mac_rx_9217_12287_oct_pkts); + rmon_stats->hist[10] += le64_to_cpu(ps->mac_rx_12288_16383_oct_pkts); + + rmon_stats->hist_tx[0] = le64_to_cpu(ps->mac_tx_64_oct_pkts); + rmon_stats->hist_tx[1] = le64_to_cpu(ps->mac_tx_65_127_oct_pkts); + rmon_stats->hist_tx[2] = le64_to_cpu(ps->mac_tx_128_255_oct_pkts); + rmon_stats->hist_tx[3] = le64_to_cpu(ps->mac_tx_256_511_oct_pkts); + rmon_stats->hist_tx[4] = le64_to_cpu(ps->mac_tx_512_1023_oct_pkts); + rmon_stats->hist_tx[5] = le64_to_cpu(ps->mac_tx_1024_1518_oct_pkts); + rmon_stats->hist_tx[6] = le64_to_cpu(ps->mac_tx_1519_2047_oct_pkts); + rmon_stats->hist_tx[7] = le64_to_cpu(ps->mac_tx_2048_4095_oct_pkts); + rmon_stats->hist_tx[8] = le64_to_cpu(ps->mac_tx_4096_8191_oct_pkts); + rmon_stats->hist_tx[9] = le64_to_cpu(ps->mac_tx_8192_9216_oct_pkts); + rmon_stats->hist_tx[10] = le64_to_cpu(ps->mac_tx_9217_12287_oct_pkts); + rmon_stats->hist_tx[10] += le64_to_cpu(ps->mac_tx_12288_16383_oct_pkts); + + *ranges = hinic3_rmon_ranges; + + kfree(ps); + return; + +get_rmon_stats_err: + *ranges = NULL; +} + +static void hinic3_get_pause_stats(struct net_device *netdev, + struct ethtool_pause_stats *pause_stats) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct mag_cmd_port_stats *ps; + int err; + + ps = kmalloc_obj(*ps); + if (!ps) + return; + + err = hinic3_get_phy_port_stats(nic_dev->hwdev, ps); + if (err) { + kfree(ps); + netdev_err_once(netdev, + "Failed to get eth pause stats from fw\n"); + return; + } + + pause_stats->tx_pause_frames = le64_to_cpu(ps->mac_tx_pause_pkts); + pause_stats->rx_pause_frames = le64_to_cpu(ps->mac_rx_pause_pkts); + + kfree(ps); +} + static const struct ethtool_ops hinic3_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_PKT_RATE_RX_USECS, @@ -674,9 +867,32 @@ static const struct ethtool_ops hinic3_ethtool_ops = { .get_strings = hinic3_get_strings, .get_sset_count = hinic3_get_sset_count, .get_ethtool_stats = hinic3_get_ethtool_stats, + .get_eth_phy_stats = hinic3_get_eth_phy_stats, + .get_eth_mac_stats = hinic3_get_eth_mac_stats, + .get_eth_ctrl_stats = hinic3_get_eth_ctrl_stats, + .get_rmon_stats = hinic3_get_rmon_stats, + .get_pause_stats = hinic3_get_pause_stats, +}; + +static const struct ethtool_ops hinic3vf_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_PKT_RATE_RX_USECS, + .get_link_ksettings = hinic3_get_link_ksettings, + .get_drvinfo = hinic3_get_drvinfo, + .get_msglevel = hinic3_get_msglevel, + .set_msglevel = hinic3_set_msglevel, + .get_link = ethtool_op_get_link, + .get_strings = hinic3_get_strings, + .get_sset_count = hinic3_get_sset_count, + .get_ethtool_stats = hinic3_get_ethtool_stats, }; void hinic3_set_ethtool_ops(struct net_device *netdev) { - netdev->ethtool_ops = &hinic3_ethtool_ops; + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + + if (!HINIC3_IS_VF(nic_dev->hwdev)) + netdev->ethtool_ops = &hinic3_ethtool_ops; + else + netdev->ethtool_ops = &hinic3vf_ethtool_ops; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2) 2026-12-04 4:08 ` [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2) Fan Gong @ 2026-12-05 4:17 ` netdev-bot+sashiko 0 siblings, 0 replies; 9+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 4:17 UTC (permalink / raw) To: gongfan1 Cc: wudi234, tengpeisen, netdev, davem, edumazet, kuba, pabeni, horms, andrew+netdev, ioana.ciornei, maxime.chevallier, mohsin.bashr, dimitri.daskalakis1, hramamurthy, larysa.zaremba, vadim.fedorenko, linux-kernel, linux-doc, zhoushuai28, wulike1 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message does not mention a structural and behavioural change. -- hinic3: Add ethtool statistic ops part(2/2) This commit adds five standard ethtool statistics callbacks to hinic3 (eth-phy, eth-mac, eth-ctrl, rmon and pause). Each one reads the physical port counters from firmware with hinic3_get_phy_port_stats(). The commit also adds a separate VF ethtool_ops table and selects between the PF and VF tables in hinic3_set_ethtool_ops(). > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c > index 0ec5d7f21e098..1a62668a65f77 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c [ ... ] > @@ -674,9 +867,32 @@ static const struct ethtool_ops hinic3_ethtool_ops = { > .get_strings = hinic3_get_strings, > .get_sset_count = hinic3_get_sset_count, > .get_ethtool_stats = hinic3_get_ethtool_stats, > + .get_eth_phy_stats = hinic3_get_eth_phy_stats, > + .get_eth_mac_stats = hinic3_get_eth_mac_stats, > + .get_eth_ctrl_stats = hinic3_get_eth_ctrl_stats, > + .get_rmon_stats = hinic3_get_rmon_stats, > + .get_pause_stats = hinic3_get_pause_stats, > +}; > + > +static const struct ethtool_ops hinic3vf_ethtool_ops = { > + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | > + ETHTOOL_COALESCE_PKT_RATE_RX_USECS, > + .get_link_ksettings = hinic3_get_link_ksettings, > + .get_drvinfo = hinic3_get_drvinfo, > + .get_msglevel = hinic3_get_msglevel, > + .set_msglevel = hinic3_set_msglevel, > + .get_link = ethtool_op_get_link, > + .get_strings = hinic3_get_strings, > + .get_sset_count = hinic3_get_sset_count, > + .get_ethtool_stats = hinic3_get_ethtool_stats, > }; > > void hinic3_set_ethtool_ops(struct net_device *netdev) > { > - netdev->ethtool_ops = &hinic3_ethtool_ops; > + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); > + > + if (!HINIC3_IS_VF(nic_dev->hwdev)) > + netdev->ethtool_ops = &hinic3_ethtool_ops; > + else > + netdev->ethtool_ops = &hinic3vf_ethtool_ops; > } [Severity: Low] This isn't a bug, but could the commit message describe the PF/VF split? The commit message only says: This commit adds five standard ethtool statistics callbacks to the hinic3 driver: get_eth_phy_stats, get_eth_mac_stats, get_eth_ctrl_stats, get_rmon_stats and get_pause_stats. Each callback reads the physical port counters from firmware via hinic3_get_phy_port_stats() and copies them into the standard ethtool structures. The patch also does two other things: - It adds hinic3vf_ethtool_ops, which is mostly a copy of hinic3_ethtool_ops. - hinic3_set_ethtool_ops() now chooses between the two tables based on HINIC3_IS_VF(). So VF netdevs get none of the new eth-phy, eth-mac, eth-ctrl, rmon or pause stats groups. The exclusion looks intentional. It matches the !HINIC3_IS_VF() check around the port stats in hinic3_get_ethtool_stats(), presumably because VFs cannot query the physical port counters. The driver now keeps two ops tables that have to stay in sync. Any op added only to hinic3_ethtool_ops will be missing on VFs without warning. The later patch in this series, "hinic3: Add ethtool pause param ops", adds get/set_pauseparam only to the PF table. That commit message does not explain the split either. Would it help to say in the commit message that VFs are excluded on purpose, and why? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796348433.git.gongfan1%40huawei.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next v19 3/4] hinic3: Add per-queue netdev-genl stats 2026-12-04 4:08 [PATCH net-next v19 0/4] net: hinic3: Support ethtool ops Fan Gong 2026-12-04 4:08 ` [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) Fan Gong 2026-12-04 4:08 ` [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2) Fan Gong @ 2026-12-04 4:08 ` Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 2026-12-04 4:08 ` [PATCH net-next v19 4/4] hinic3: Add ethtool pause param ops Fan Gong 3 siblings, 1 reply; 9+ messages in thread From: Fan Gong @ 2026-12-04 4:08 UTC (permalink / raw) To: Fan Gong, Wu Di, Teng Peisen, netdev, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn, Ioana Ciornei, Maxime Chevallier, Mohsin Bashir, Dimitri Daskalakis, Harshitha Ramamurthy, Larysa Zaremba, Vadim Fedorenko Cc: linux-kernel, linux-doc, Zhou Shuai, Wu Like This commit adds netdev_stat_ops to the hinic3 driver. It implements get_queue_stats_rx, get_queue_stats_tx and get_base_stats, so per-queue and device-level counters are exported through the netdev-genl qstats interface. Map busy to tx-stop, csum_errors to rx-csum-bad, alloc_fail to rx-alloc-fail. get_base_stats() sums the queues between netdev->real_num_{rx,tx}_queues and nic_dev->max_qps, matching the range the core does not sum itself. ./cli.py --spec netlink/specs/netdev.yaml\ --dump qstats-get --json '{"ifindex": 30}' [{'ifindex': 30, 'rx-alloc-fail': 0, 'rx-bytes': 13194720024, 'rx-csum-bad': 0, 'rx-packets': 10874477, 'tx-bytes': 150086739354, 'tx-hw-gso-bytes': 143674451028, 'tx-hw-gso-packets': 2261382, 'tx-hw-gso-wire-bytes': 150067172880, 'tx-hw-gso-wire-packets': 99120804, 'tx-packets': 99315841, 'tx-stop': 0, 'tx-wake': 0}] Co-developed-by: Wu Di <wudi234@huawei.com> Signed-off-by: Wu Di <wudi234@huawei.com> Co-developed-by: Teng Peisen <tengpeisen@huawei.com> Signed-off-by: Teng Peisen <tengpeisen@huawei.com> Co-developed-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> --- .../huawei/hinic3/hinic3_netdev_ops.c | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c index 621d8b12e247..63eb4189e319 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c @@ -5,6 +5,7 @@ #include <linux/if_vlan.h> #include <linux/netdevice.h> #include <net/vxlan.h> +#include <net/netdev_queues.h> #include "hinic3_hwif.h" #include "hinic3_nic_cfg.h" @@ -857,7 +858,112 @@ static const struct net_device_ops hinic3_netdev_ops = { .ndo_start_xmit = hinic3_xmit_frame, }; +static void hinic3_get_queue_stats_rx(struct net_device *netdev, int i, + struct netdev_queue_stats_rx *stats_rx) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct hinic3_rxq_stats *rxq_stats; + struct hinic3_rxq *rxq; + unsigned int start; + + if (unlikely(i < 0 || i >= nic_dev->max_qps)) + return; + + rxq = &nic_dev->rxqs[i]; + rxq_stats = &rxq->rxq_stats; + do { + start = u64_stats_fetch_begin(&rxq_stats->syncp); + stats_rx->bytes = rxq_stats->bytes; + stats_rx->packets = rxq_stats->packets; + stats_rx->csum_bad = rxq_stats->csum_errors; + stats_rx->alloc_fail = rxq_stats->alloc_fail; + } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); +} + +static void hinic3_get_queue_stats_tx(struct net_device *netdev, int i, + struct netdev_queue_stats_tx *stats_tx) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct hinic3_txq_stats *txq_stats; + struct hinic3_txq *txq; + unsigned int start; + + if (unlikely(i < 0 || i >= nic_dev->max_qps)) + return; + + txq = &nic_dev->txqs[i]; + txq_stats = &txq->txq_stats; + do { + start = u64_stats_fetch_begin(&txq_stats->syncp); + stats_tx->bytes = txq_stats->bytes; + stats_tx->packets = txq_stats->packets; + stats_tx->stop = txq_stats->busy; + stats_tx->hw_gso_wire_packets = txq_stats->gso_wire_packets; + stats_tx->hw_gso_wire_bytes = txq_stats->gso_wire_bytes; + stats_tx->hw_gso_packets = txq_stats->gso_packets; + stats_tx->hw_gso_bytes = txq_stats->gso_bytes; + stats_tx->wake = txq_stats->wake; + } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); +} + +static void hinic3_get_base_stats(struct net_device *netdev, + struct netdev_queue_stats_rx *stats_rx, + struct netdev_queue_stats_tx *stats_tx) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + int i; + + stats_rx->bytes = 0; + stats_rx->packets = 0; + stats_rx->csum_bad = 0; + stats_rx->alloc_fail = 0; + stats_tx->bytes = 0; + stats_tx->packets = 0; + stats_tx->stop = 0; + stats_tx->hw_gso_wire_packets = 0; + stats_tx->hw_gso_wire_bytes = 0; + stats_tx->hw_gso_packets = 0; + stats_tx->hw_gso_bytes = 0; + stats_tx->wake = 0; + + /* Match the core: the base range starts at the active queue + * count, not at q_params.num_qps, which can lag behind. + */ + for (i = netdev->real_num_rx_queues; i < nic_dev->max_qps; i++) { + struct netdev_queue_stats_rx rx = {0}; + + hinic3_get_queue_stats_rx(netdev, i, &rx); + + stats_rx->bytes += rx.bytes; + stats_rx->packets += rx.packets; + stats_rx->csum_bad += rx.csum_bad; + stats_rx->alloc_fail += rx.alloc_fail; + } + + for (i = netdev->real_num_tx_queues; i < nic_dev->max_qps; i++) { + struct netdev_queue_stats_tx tx = {0}; + + hinic3_get_queue_stats_tx(netdev, i, &tx); + + stats_tx->bytes += tx.bytes; + stats_tx->packets += tx.packets; + stats_tx->stop += tx.stop; + stats_tx->hw_gso_wire_packets += tx.hw_gso_wire_packets; + stats_tx->hw_gso_wire_bytes += tx.hw_gso_wire_bytes; + stats_tx->hw_gso_packets += tx.hw_gso_packets; + stats_tx->hw_gso_bytes += tx.hw_gso_bytes; + stats_tx->wake += tx.wake; + } +} + +static const struct netdev_stat_ops hinic3_stat_ops = { + .get_queue_stats_rx = hinic3_get_queue_stats_rx, + .get_queue_stats_tx = hinic3_get_queue_stats_tx, + .get_base_stats = hinic3_get_base_stats, +}; + void hinic3_set_netdev_ops(struct net_device *netdev) { netdev->netdev_ops = &hinic3_netdev_ops; + netdev->stat_ops = &hinic3_stat_ops; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v19 3/4] hinic3: Add per-queue netdev-genl stats 2026-12-04 4:08 ` [PATCH net-next v19 3/4] hinic3: Add per-queue netdev-genl stats Fan Gong @ 2026-12-05 4:17 ` netdev-bot+sashiko 0 siblings, 0 replies; 9+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 4:17 UTC (permalink / raw) To: gongfan1 Cc: wudi234, tengpeisen, netdev, davem, edumazet, kuba, pabeni, horms, andrew+netdev, ioana.ciornei, maxime.chevallier, mohsin.bashr, dimitri.daskalakis1, hramamurthy, larysa.zaremba, vadim.fedorenko, linux-kernel, linux-doc, zhoushuai28, wulike1 Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 3 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] hinic3: stale free_wqebb in hinic3_send_one_skb() causes TX queue stall - [Medium] TX wire-byte accounting is wrong for VXLAN (UDP-tunnel) TSO skbs, and this patch exports the wrong values through the netdev-genl… - [Medium] Under LRO, the RX counters exported as qstats `rx-packets` and `rx-bytes` follow different rules. - [Medium] hinic3: rx-bytes undercounts coalesced LRO headers in hinic3_rx_poll() - [Low] hinic3: hinic3_get_base_stats() duplicates netdev_stat_queue_sum() -- hinic3: Add per-queue netdev-genl stats This commit adds netdev_stat_ops to the hinic3 driver. It implements get_queue_stats_rx, get_queue_stats_tx and get_base_stats, so per-queue and device-level counters are exported through the netdev-genl qstats interface. > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c > index 621d8b12e247e..63eb4189e319a 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c [ ... ] > @@ -857,7 +858,112 @@ static const struct net_device_ops hinic3_netdev_ops = { > .ndo_start_xmit = hinic3_xmit_frame, > }; > > +static void hinic3_get_queue_stats_rx(struct net_device *netdev, int i, > + struct netdev_queue_stats_rx *stats_rx) > +{ [ ... ] > + do { > + start = u64_stats_fetch_begin(&rxq_stats->syncp); > + stats_rx->bytes = rxq_stats->bytes; > + stats_rx->packets = rxq_stats->packets; [Severity: Medium] With hardware LRO active, rx-bytes here no longer matches rx-packets. The packet count is per wire segment, but the byte count is for the coalesced buffer. For an LRO CQE, hinic3_rx_poll() adds num_lro to rx_packets but only adds pkt_len to rx_bytes: num_lro = RQ_CQE_STATUS_GET(status, NUM_LRO); if (num_lro) { num_wqe += hinic3_get_sge_num(rxq, pkt_len); rx_packets += num_lro; } else { rx_packets++; } rx_bytes += pkt_len; pkt_len is the length of the merged skb built by hinic3_fetch_rx_buffer(). That skb has a single Ethernet/IP/TCP header in front of the coalesced payload. hinic3_lro_set_gso_params() computes gso_size by dividing that payload across num_lro segments. The (num_lro - 1) headers that were on the wire are never counted. netdev.yaml defines rx-packets as wire packets and rx-bytes as the bytes of those packets. Once this patch exports both as qstats, the two counters disagree with each other. They also disagree with the TX side, where hinic3_tx_poll() adds (gso_segs - 1) * hdr_len back. The same numbers reach ndo_get_stats64 as well. The older hinic driver handles this in hinic_rx.c by adding (num_lro - 1) * LRO_PKT_HDR_LEN(cqe) to rx_bytes. hinic3_rx.c already defines HINIC3_LRO_PKT_HDR_LEN() but never uses it. Should rx_bytes do the same here for LRO CQEs? Or is there a reason to treat pkt_len as the wire length? If the macro does get used, note that it appears to read cqe->offload_type without a le32_to_cpu() conversion. That would need fixing for big-endian hosts. The accounting was added earlier in this series, in "hinic3: Add ethtool statistic ops part(1/2)". This patch is what makes it part of the qstats uAPI. [Severity: Medium] With LRO enabled, do rx-packets and rx-bytes end up counting different things here? hinic3_rx_poll() counts packets per wire segment, but it counts bytes as the length of the coalesced buffer: drivers/net/ethernet/huawei/hinic3/hinic3_rx.c:hinic3_rx_poll() { ... num_lro = RQ_CQE_STATUS_GET(status, NUM_LRO); if (num_lro) { num_wqe += hinic3_get_sge_num(rxq, pkt_len); rx_packets += num_lro; } else { rx_packets++; } rx_bytes += pkt_len; ... } The (num_lro - 1) repeated L2/L3/L4 headers are never added back. The netdev.yaml spec defines rx-packets as "Number of wire packets", and its definition of rx-bytes points back to rx-packets. So the byte count should match the wire packets being counted. The driver already defines HINIC3_LRO_PKT_HDR_LEN(cqe), which is 66 bytes for IPv4 and 86 for IPv6, but the byte accounting never uses it. The TX side in hinic3_tx_poll() does add the repeated headers back: wire_len += (gso_segs - 1) * hdr_len; Should the RX byte counter also include the per-segment headers, so that RX and TX use the same semantics in qstats? This accounting was added earlier in this series, in "hinic3: Add ethtool statistic ops part(1/2)". This patch exports it through the qstats uAPI as rx-bytes and rx-packets. > + stats_rx->csum_bad = rxq_stats->csum_errors; > + stats_rx->alloc_fail = rxq_stats->alloc_fail; > + } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); > +} > + > +static void hinic3_get_queue_stats_tx(struct net_device *netdev, int i, > + struct netdev_queue_stats_tx *stats_tx) > +{ [ ... ] > + do { > + start = u64_stats_fetch_begin(&txq_stats->syncp); > + stats_tx->bytes = txq_stats->bytes; > + stats_tx->packets = txq_stats->packets; > + stats_tx->stop = txq_stats->busy; > + stats_tx->hw_gso_wire_packets = txq_stats->gso_wire_packets; > + stats_tx->hw_gso_wire_bytes = txq_stats->gso_wire_bytes; [Severity: High] This line only reads busy, but it exports txq_stats->busy as the standard tx-stop counter. The code that increments busy was added earlier in this series, in "hinic3: Add ethtool statistic ops part(1/2)", and it looks like it can wedge a TX queue. hinic3_send_one_skb() now copies the free WQEBB count into a local and passes that local to the stop helpers: free_wqebb = hinic3_wq_free_wqebbs(&txq->sq->wq); if (unlikely(free_wqebb < wqebb_cnt)) { ... if (!netif_subqueue_try_stop(netdev, txq->sq->q_id, free_wqebb, txq->tx_start_thrs)) { netif_txq_try_stop() and netif_txq_maybe_stop() stop the queue, issue smp_mb__after_atomic(), and then evaluate get_desc a second time. That second check catches completions that raced with the stop. The kerneldoc in include/net/netdev_queues.h requires get_desc to be an expression that returns up-to-date information each time it is evaluated. With a cached u16, the recheck compares the same value that just failed the threshold. It can never see space freed by hinic3_tx_poll(). Consider this sequence: CPU0 (hinic3_send_one_skb) CPU1 (hinic3_tx_poll) reads free_wqebb < wqebb_cnt reclaims all in-flight WQEBBs netif_subqueue_completed_wake() sees queue not stopped, no wake netif_subqueue_try_stop() stops queue, barrier recheck uses stale free_wqebb busy++, return NETDEV_TX_BUSY The ring is now empty and stopped, so no completion interrupt will come to wake it. hinic3_tx_timeout() only sets HINIC3_EVENT_WORK_TX_TIMEOUT when sw_pi != hw_ci, so the watchdog does not recover an empty ring either. The queue stays stopped for good. The netif_subqueue_maybe_stop() call at the end of hinic3_send_one_skb() has the same problem. It can stop the queue and bump busy spuriously. Before this series, both calls passed hinic3_wq_free_wqebbs(&txq->sq->wq) directly. The busy counter is already driven by the return value of the macros, so the local copy does not seem to be needed for that. Was there another reason to cache it, or can both calls go back to evaluating hinic3_wq_free_wqebbs() inline? [Severity: Medium] Are tx-bytes and tx-hw-gso-wire-bytes correct for VXLAN TSO skbs? When HINIC3_NIC_F_VXLAN_OFFLOAD is supported, hinic3_netdev_feature_init() enables NETIF_F_GSO_UDP_TUNNEL and NETIF_F_GSO_UDP_TUNNEL_CSUM. For encapsulated skbs, hinic3_tso() then tells the hardware to segment on the inner headers: drivers/net/ethernet/huawei/hinic3/hinic3_tx.c:hinic3_tso() { ... ip.hdr = skb_inner_network_header(skb); l4.hdr = skb_inner_transport_header(skb); ... } As a result, the whole header stack is repeated on every segment. That is the outer Eth/IP/UDP/VXLAN headers plus the inner Eth/IP/TCP headers. Tunnel TSO skbs also carry SKB_GSO_TCPV4/6, so hinic3_tx_poll() takes the TCP branch for them: drivers/net/ethernet/huawei/hinic3/hinic3_tx.c:hinic3_tx_poll() { ... if (skb_shinfo(tx_info->skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { hdr_len = skb_transport_offset(tx_info->skb) + tcp_hdrlen(tx_info->skb); wire_len += (gso_segs - 1) * hdr_len; } ... } For an encapsulated skb, the transport header is the outer UDP header. tcp_hdrlen() reads the doff nibble at byte 12 of that header, which is the most significant VNI byte of the VXLAN header. For any VNI below 2^20, doff is 0, so hdr_len is only the outer Eth+IP length (about 34 bytes). The header actually repeated per segment is about 104 bytes or more. For larger VNIs the result is effectively arbitrary, anywhere from 0 to 60 bytes. When skb->encapsulation is set, should the per-segment header length be skb_inner_transport_offset() + inner_tcp_hdrlen() instead? That would match what hinic3_tso() programs into the hardware. This accounting was added earlier in this series, in "hinic3: Add ethtool statistic ops part(1/2)". This patch exports txq_stats->bytes and txq_stats->gso_wire_bytes directly as the standard tx-bytes and tx-hw-gso-wire-bytes qstats counters. > + stats_tx->hw_gso_packets = txq_stats->gso_packets; > + stats_tx->hw_gso_bytes = txq_stats->gso_bytes; > + stats_tx->wake = txq_stats->wake; > + } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); > +} [ ... ] > @@ -857,7 +858,112 @@ static const struct net_device_ops hinic3_netdev_ops = { > .ndo_start_xmit = hinic3_xmit_frame, > }; > > +static void hinic3_get_queue_stats_rx(struct net_device *netdev, int i, > + struct netdev_queue_stats_rx *stats_rx) > +{ > + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); > + struct hinic3_rxq_stats *rxq_stats; > + struct hinic3_rxq *rxq; > + unsigned int start; > + > + if (unlikely(i < 0 || i >= nic_dev->max_qps)) > + return; > + > + rxq = &nic_dev->rxqs[i]; > + rxq_stats = &rxq->rxq_stats; > + do { > + start = u64_stats_fetch_begin(&rxq_stats->syncp); > + stats_rx->bytes = rxq_stats->bytes; > + stats_rx->packets = rxq_stats->packets; > + stats_rx->csum_bad = rxq_stats->csum_errors; > + stats_rx->alloc_fail = rxq_stats->alloc_fail; > + } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); > +} > + > +static void hinic3_get_queue_stats_tx(struct net_device *netdev, int i, > + struct netdev_queue_stats_tx *stats_tx) > +{ > + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); > + struct hinic3_txq_stats *txq_stats; > + struct hinic3_txq *txq; > + unsigned int start; > + > + if (unlikely(i < 0 || i >= nic_dev->max_qps)) > + return; > + > + txq = &nic_dev->txqs[i]; > + txq_stats = &txq->txq_stats; > + do { > + start = u64_stats_fetch_begin(&txq_stats->syncp); > + stats_tx->bytes = txq_stats->bytes; > + stats_tx->packets = txq_stats->packets; > + stats_tx->stop = txq_stats->busy; > + stats_tx->hw_gso_wire_packets = txq_stats->gso_wire_packets; > + stats_tx->hw_gso_wire_bytes = txq_stats->gso_wire_bytes; > + stats_tx->hw_gso_packets = txq_stats->gso_packets; > + stats_tx->hw_gso_bytes = txq_stats->gso_bytes; > + stats_tx->wake = txq_stats->wake; > + } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); > +} > + > +static void hinic3_get_base_stats(struct net_device *netdev, > + struct netdev_queue_stats_rx *stats_rx, > + struct netdev_queue_stats_tx *stats_tx) > +{ > + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); > + int i; > + > + stats_rx->bytes = 0; > + stats_rx->packets = 0; > + stats_rx->csum_bad = 0; > + stats_rx->alloc_fail = 0; > + stats_tx->bytes = 0; > + stats_tx->packets = 0; > + stats_tx->stop = 0; > + stats_tx->hw_gso_wire_packets = 0; > + stats_tx->hw_gso_wire_bytes = 0; > + stats_tx->hw_gso_packets = 0; > + stats_tx->hw_gso_bytes = 0; > + stats_tx->wake = 0; > + > + /* Match the core: the base range starts at the active queue > + * count, not at q_params.num_qps, which can lag behind. > + */ > + for (i = netdev->real_num_rx_queues; i < nic_dev->max_qps; i++) { > + struct netdev_queue_stats_rx rx = {0}; > + > + hinic3_get_queue_stats_rx(netdev, i, &rx); > + > + stats_rx->bytes += rx.bytes; > + stats_rx->packets += rx.packets; > + stats_rx->csum_bad += rx.csum_bad; > + stats_rx->alloc_fail += rx.alloc_fail; > + } > + > + for (i = netdev->real_num_tx_queues; i < nic_dev->max_qps; i++) { > + struct netdev_queue_stats_tx tx = {0}; > + > + hinic3_get_queue_stats_tx(netdev, i, &tx); > + > + stats_tx->bytes += tx.bytes; > + stats_tx->packets += tx.packets; > + stats_tx->stop += tx.stop; > + stats_tx->hw_gso_wire_packets += tx.hw_gso_wire_packets; > + stats_tx->hw_gso_wire_bytes += tx.hw_gso_wire_bytes; > + stats_tx->hw_gso_packets += tx.hw_gso_packets; > + stats_tx->hw_gso_bytes += tx.hw_gso_bytes; > + stats_tx->wake += tx.wake; > + } > +} > + > +static const struct netdev_stat_ops hinic3_stat_ops = { > + .get_queue_stats_rx = hinic3_get_queue_stats_rx, > + .get_queue_stats_tx = hinic3_get_queue_stats_tx, > + .get_base_stats = hinic3_get_base_stats, > +}; > + > void hinic3_set_netdev_ops(struct net_device *netdev) > { > netdev->netdev_ops = &hinic3_netdev_ops; > + netdev->stat_ops = &hinic3_stat_ops; > } [Severity: Low] These two loops open-code netdev_stat_queue_sum(). The core exports that helper from net/core/netdev-genl.c for this exact case: a .get_base_stats callback that has to add in the queues the core does not iterate itself. For each index in the given ranges, it calls the driver's get_queue_stats_rx/tx and adds every field the driver filled in. Fields left at NETDEV_STAT_NOT_SET are skipped. The twelve fields are already zeroed above, so both loops could be replaced by a single call: netdev_stat_queue_sum(netdev, netdev->real_num_rx_queues, nic_dev->max_qps, stats_rx, netdev->real_num_tx_queues, nic_dev->max_qps, stats_tx); As written, every counter appears three times: in the per-queue getter, in the zeroing block, and in the summing loop. The next counter added to hinic3_get_queue_stats_rx() or hinic3_get_queue_stats_tx() can easily be missed here, and the base stats would then silently drift from the per-queue values. virtio_net already uses the helper this way in its get_base_stats. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796348433.git.gongfan1%40huawei.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next v19 4/4] hinic3: Add ethtool pause param ops 2026-12-04 4:08 [PATCH net-next v19 0/4] net: hinic3: Support ethtool ops Fan Gong ` (2 preceding siblings ...) 2026-12-04 4:08 ` [PATCH net-next v19 3/4] hinic3: Add per-queue netdev-genl stats Fan Gong @ 2026-12-04 4:08 ` Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 3 siblings, 1 reply; 9+ messages in thread From: Fan Gong @ 2026-12-04 4:08 UTC (permalink / raw) To: Fan Gong, Wu Di, Teng Peisen, netdev, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn, Ioana Ciornei, Maxime Chevallier, Mohsin Bashir, Dimitri Daskalakis, Harshitha Ramamurthy, Larysa Zaremba, Vadim Fedorenko Cc: linux-kernel, linux-doc, Zhou Shuai, Wu Like Add .get_pauseparam and .set_pauseparam callbacks to support reading and configuring port pause parameters. Also initialize nic_cfg.cfg_mutex and use it to protect the cached pause state, and skip the pause query for VF during probe. The getter reports the firmware values whenever the query succeeds and falls back to the cached state on error. The setter preserves the existing auto_neg because pause autonegotiation is not user configurable. Co-developed-by: Wu Di <wudi234@huawei.com> Signed-off-by: Wu Di <wudi234@huawei.com> Co-developed-by: Teng Peisen <tengpeisen@huawei.com> Signed-off-by: Teng Peisen <tengpeisen@huawei.com> Co-developed-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Mingfa Kang <kangmingfa1@huawei.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> --- .../ethernet/huawei/hinic3/hinic3_ethtool.c | 61 +++++++++++++++++++ .../net/ethernet/huawei/hinic3/hinic3_main.c | 8 +++ .../ethernet/huawei/hinic3/hinic3_nic_cfg.c | 7 +++ .../ethernet/huawei/hinic3/hinic3_nic_cfg.h | 6 +- .../ethernet/huawei/hinic3/hinic3_nic_dev.h | 3 + 5 files changed, 83 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c index 1a62668a65f7..f27cd0b2d9ac 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c @@ -856,6 +856,65 @@ static void hinic3_get_pause_stats(struct net_device *netdev, kfree(ps); } +static void hinic3_get_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pause) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct hinic3_nic_pause_config nic_pause = {}; + int err; + + err = hinic3_get_pause_info(nic_dev, &nic_pause); + if (!err) { + pause->autoneg = nic_pause.auto_neg; + pause->rx_pause = nic_pause.rx_pause; + pause->tx_pause = nic_pause.tx_pause; + } else { + mutex_lock(&nic_dev->nic_cfg.cfg_mutex); + pause->autoneg = nic_dev->nic_cfg.nic_pause.auto_neg; + pause->rx_pause = nic_dev->nic_cfg.nic_pause.rx_pause; + pause->tx_pause = nic_dev->nic_cfg.nic_pause.tx_pause; + mutex_unlock(&nic_dev->nic_cfg.cfg_mutex); + } +} + +static int hinic3_set_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pause) +{ + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); + struct hinic3_nic_pause_config nic_pause = {}; + struct hinic3_nic_pause_config cur = {}; + int err; + + nic_pause.rx_pause = !!pause->rx_pause; + nic_pause.tx_pause = !!pause->tx_pause; + + mutex_lock(&nic_dev->nic_cfg.cfg_mutex); + + if (!hinic3_get_pause_info(nic_dev, &cur)) + nic_pause.auto_neg = cur.auto_neg; + else + nic_pause.auto_neg = nic_dev->nic_cfg.nic_pause.auto_neg; + /* Pause autoneg is not user-configurable. Reject an explicit + * change instead of silently ignoring it. + */ + if (pause->autoneg != nic_pause.auto_neg) { + mutex_unlock(&nic_dev->nic_cfg.cfg_mutex); + return -EOPNOTSUPP; + } + + err = hinic3_set_pause_info(nic_dev, &nic_pause); + if (err) { + netdev_err_once(netdev, "Failed to set pauseparam\n"); + } else { + nic_dev->nic_cfg.nic_pause.auto_neg = nic_pause.auto_neg; + nic_dev->nic_cfg.nic_pause.rx_pause = nic_pause.rx_pause; + nic_dev->nic_cfg.nic_pause.tx_pause = nic_pause.tx_pause; + } + mutex_unlock(&nic_dev->nic_cfg.cfg_mutex); + + return err; +} + static const struct ethtool_ops hinic3_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_PKT_RATE_RX_USECS, @@ -872,6 +931,8 @@ static const struct ethtool_ops hinic3_ethtool_ops = { .get_eth_ctrl_stats = hinic3_get_eth_ctrl_stats, .get_rmon_stats = hinic3_get_rmon_stats, .get_pause_stats = hinic3_get_pause_stats, + .get_pauseparam = hinic3_get_pauseparam, + .set_pauseparam = hinic3_set_pauseparam, }; static const struct ethtool_ops hinic3vf_ethtool_ops = { diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c index a288957a9412..d1469d67b55d 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c @@ -240,10 +240,18 @@ static int hinic3_sw_init(struct net_device *netdev) int err; mutex_init(&nic_dev->port_state_mutex); + mutex_init(&nic_dev->nic_cfg.cfg_mutex); nic_dev->q_params.sq_depth = HINIC3_SQ_DEPTH; nic_dev->q_params.rq_depth = HINIC3_RQ_DEPTH; + if (!HINIC3_IS_VF(hwdev)) { + err = hinic3_get_pause_info(nic_dev, + &nic_dev->nic_cfg.nic_pause); + if (err) + return err; + } + hinic3_try_to_enable_rss(netdev); if (HINIC3_IS_VF(hwdev)) { diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c index e4a3fa6fb8db..b5c696fe6cdf 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c @@ -739,6 +739,13 @@ int hinic3_get_pause_info(struct hinic3_nic_dev *nic_dev, nic_pause); } +int hinic3_set_pause_info(struct hinic3_nic_dev *nic_dev, + struct hinic3_nic_pause_config *nic_pause) +{ + return hinic3_cfg_hw_pause(nic_dev->hwdev, MGMT_MSG_CMD_OP_SET, + nic_pause); +} + int hinic3_get_vport_stats(struct hinic3_hwdev *hwdev, u16 func_id, struct l2nic_vport_stats *stats) { diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h index bcfdc8c7367d..9b498a539f81 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h @@ -268,8 +268,8 @@ struct hinic3_nic_pause_config { }; struct hinic3_nic_cfg { - /* Valid when pfc is disabled */ - bool pause_set; + /* lock for getting nic cfg */ + struct mutex cfg_mutex; struct hinic3_nic_pause_config nic_pause; u8 pfc_en; @@ -318,6 +318,8 @@ int hinic3_del_vlan(struct hinic3_hwdev *hwdev, u16 vlan_id, u16 func_id); int hinic3_get_pause_info(struct hinic3_nic_dev *nic_dev, struct hinic3_nic_pause_config *nic_pause); +int hinic3_set_pause_info(struct hinic3_nic_dev *nic_dev, + struct hinic3_nic_pause_config *nic_pause); int hinic3_get_vport_stats(struct hinic3_hwdev *hwdev, u16 func_id, struct l2nic_vport_stats *stats); diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_dev.h b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_dev.h index 5d6710f13b2c..55bad30cc34f 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_dev.h +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_dev.h @@ -10,6 +10,7 @@ #include "hinic3_hw_cfg.h" #include "hinic3_hwdev.h" #include "hinic3_mgmt_interface.h" +#include "hinic3_nic_cfg.h" #define HINIC3_VLAN_BITMAP_BYTE_SIZE(nic_dev) (sizeof(*(nic_dev)->vlan_bitmap)) #define HINIC3_VLAN_BITMAP_SIZE(nic_dev) \ @@ -141,6 +142,8 @@ struct hinic3_nic_dev { /* flag bits defined by hinic3_event_work_flags */ unsigned long event_flag; bool link_status_up; + + struct hinic3_nic_cfg nic_cfg; }; void hinic3_set_netdev_ops(struct net_device *netdev); -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v19 4/4] hinic3: Add ethtool pause param ops 2026-12-04 4:08 ` [PATCH net-next v19 4/4] hinic3: Add ethtool pause param ops Fan Gong @ 2026-12-05 4:17 ` netdev-bot+sashiko 0 siblings, 0 replies; 9+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 4:17 UTC (permalink / raw) To: gongfan1 Cc: wudi234, tengpeisen, netdev, davem, edumazet, kuba, pabeni, horms, andrew+netdev, ioana.ciornei, maxime.chevallier, mohsin.bashr, dimitri.daskalakis1, hramamurthy, larysa.zaremba, vadim.fedorenko, linux-kernel, linux-doc, zhoushuai28, wulike1 Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 3 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The patch makes PF probe fail whenever the firmware pause query fails. - [Low] The commit message does not match the code. - [Low] hinic3_set_pauseparam() normalizes rx_pause/tx_pause with `!!` but compares the raw uAPI `pause->autoneg` (__u32, where any non-zero… - [Low] The new field comment in struct hinic3_nic_cfg (hinic3_nic_cfg.h:271) says cfg_mutex is the 'lock for getting nic… -- hinic3: Add ethtool pause param ops This commit adds .get_pauseparam and .set_pauseparam ethtool callbacks to the hinic3 PF driver, using a new hinic3_set_pause_info() helper. It also adds a nic_cfg member with a cfg_mutex to struct hinic3_nic_dev. During PF probe it queries the firmware pause state to fill a cache. > Also initialize nic_cfg.cfg_mutex and use it to protect the cached pause > state, and skip the pause query for VF during probe. > > The getter reports the firmware values whenever the query succeeds and > falls back to the cached state on error. The setter preserves the > existing auto_neg because pause autonegotiation is not user > configurable. [Severity: Low] Does this description match what hinic3_set_pauseparam() does? "The setter preserves the existing auto_neg" reads as if a request with a different autoneg value is accepted and autoneg is simply left alone. The code rejects such a request instead: if (pause->autoneg != nic_pause.auto_neg) { mutex_unlock(&nic_dev->nic_cfg.cfg_mutex); return -EOPNOTSUPP; } The comment above that check says it does this "instead of silently ignoring it". So a request whose autoneg doesn't match the current value fails, and the rx/tx change is not applied. "initialize nic_cfg.cfg_mutex" also suggests the field already exists. In the parent commit, struct hinic3_nic_dev has no nic_cfg member, and struct hinic3_nic_cfg has bool pause_set but no cfg_mutex. This patch adds the nic_cfg member, removes pause_set and adds cfg_mutex. Could the commit message describe the -EOPNOTSUPP behavior and these struct changes? > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c > index 1a62668a65f77..f27cd0b2d9acf 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c [ ... ] > +static int hinic3_set_pauseparam(struct net_device *netdev, > + struct ethtool_pauseparam *pause) > +{ > + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev); > + struct hinic3_nic_pause_config nic_pause = {}; > + struct hinic3_nic_pause_config cur = {}; > + int err; > + > + nic_pause.rx_pause = !!pause->rx_pause; > + nic_pause.tx_pause = !!pause->tx_pause; > + > + mutex_lock(&nic_dev->nic_cfg.cfg_mutex); > + > + if (!hinic3_get_pause_info(nic_dev, &cur)) > + nic_pause.auto_neg = cur.auto_neg; > + else > + nic_pause.auto_neg = nic_dev->nic_cfg.nic_pause.auto_neg; > + /* Pause autoneg is not user-configurable. Reject an explicit > + * change instead of silently ignoring it. > + */ > + if (pause->autoneg != nic_pause.auto_neg) { [Severity: Low] rx_pause and tx_pause are normalized with !!, but pause->autoneg (a __u32 where any non-zero value means enabled) is compared raw against the firmware u8. Can this reject a request that only asks for the current autoneg state? The ETHTOOL_SPAUSEPARAM ioctl path passes the user struct through without normalizing it: net/ethtool/ioctl.c:ethtool_set_pauseparam() { ... if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) return -EFAULT; ret = dev->ethtool_ops->set_pauseparam(dev, &pauseparam); ... } An ioctl caller that passes autoneg=2 while firmware reports 1 would get -EOPNOTSUPP, and its rx/tx pause change would be refused. The same thing happens if firmware ever reports an auto_neg value other than 0 or 1 and userspace asks for autoneg on. The netlink path isn't affected, because ethnl_update_bool32() keeps the raw value when the new one is logically equal. hinic3_get_pauseparam() also copies the raw firmware or cached byte into the uAPI struct: pause->autoneg = nic_pause.auto_neg; Would comparing !!pause->autoneg with !!nic_pause.auto_neg, and reporting !!auto_neg in the getter, avoid this? [ ... ] > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c > index a288957a94123..d1469d67b55dc 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c > @@ -240,10 +240,18 @@ static int hinic3_sw_init(struct net_device *netdev) > int err; > > mutex_init(&nic_dev->port_state_mutex); > + mutex_init(&nic_dev->nic_cfg.cfg_mutex); > > nic_dev->q_params.sq_depth = HINIC3_SQ_DEPTH; > nic_dev->q_params.rq_depth = HINIC3_RQ_DEPTH; > > + if (!HINIC3_IS_VF(hwdev)) { > + err = hinic3_get_pause_info(nic_dev, > + &nic_dev->nic_cfg.nic_pause); > + if (err) > + return err; > + } [Severity: Medium] Should a failed pause query make PF probe fail here? hinic3_cfg_hw_pause() turns any mailbox error, and any non-zero firmware status including MGMT_STATUS_CMD_UNSUPPORTED, into -EFAULT: if (err || pause_info.msg_head.status) { ... return -EFAULT; } That error goes back through hinic3_nic_probe()->hinic3_sw_init(), and hinic3_nic_probe() handles it like this: err = hinic3_sw_init(netdev); if (err) goto err_free_nic_io; So the PF netdev is never registered. The value read here only fills the nic_cfg.nic_pause cache. That cache is read in only two places, and both run after a runtime firmware query has already failed: - the fallback branch of hinic3_get_pauseparam() - the auto_neg selection in hinic3_set_pauseparam() The commit message also says the getter "falls back to the cached state on error", which suggests this query is expected to fail sometimes. Before this patch, the same failure only affected the pause part of get_link_ksettings, and probe still succeeded. Other L2NIC commands in the driver, such as hinic3_set_force_pkt_drop() and hinic3_set_rss_type(), already tolerate CMD_UNSUPPORTED. Would it be better to warn and continue with the zeroed cache? > hinic3_try_to_enable_rss(netdev); > > if (HINIC3_IS_VF(hwdev)) { [ ... ] > diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h > index bcfdc8c7367d0..9b498a539f818 100644 > --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h > +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.h > @@ -268,8 +268,8 @@ struct hinic3_nic_pause_config { > }; > > struct hinic3_nic_cfg { > - /* Valid when pfc is disabled */ > - bool pause_set; > + /* lock for getting nic cfg */ > + struct mutex cfg_mutex; [Severity: Low] This isn't a bug, but is "lock for getting nic cfg" accurate? hinic3_set_pauseparam() holds cfg_mutex across the firmware GET, the autoneg check, the firmware SET and the update of nic_cfg.nic_pause. hinic3_get_pauseparam() takes it only on the fallback path that reads the cache. The successful firmware query path doesn't take it at all. Could the comment say that the mutex protects the cached nic_cfg.nic_pause and serializes pause configuration updates? > struct hinic3_nic_pause_config nic_pause; > > u8 pfc_en; [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796348433.git.gongfan1%40huawei.com ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-12-05 4:18 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-04 4:08 [PATCH net-next v19 0/4] net: hinic3: Support ethtool ops Fan Gong 2026-12-04 4:08 ` [PATCH net-next v19 1/4] hinic3: Add ethtool statistic ops part(1/2) Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 2026-12-04 4:08 ` [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2) Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 2026-12-04 4:08 ` [PATCH net-next v19 3/4] hinic3: Add per-queue netdev-genl stats Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko 2026-12-04 4:08 ` [PATCH net-next v19 4/4] hinic3: Add ethtool pause param ops Fan Gong 2026-12-05 4:17 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox