[PATCH net-next v13 0/3] net: hinic3: PF initialization
Fan Gong <[email protected]>
| Newsgroups | gmane.linux.documentation,gmane.linux.network,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
Add 10 ethtool ops for information of coalesce and eth data. Add MTU size validation Config netdev watchdog timeout. Remove unneed coalesce parameters. Changes: PATCH 03 V01: https://lore.kernel.org/netdev/[email protected]/ * Add rmon/pause/phy/mac/ctrl stats (Ioana Ciornei) PATCH 03 V02: https://lore.kernel.org/netdev/[email protected]/ * 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) * Remove OutOfRangeLengthField, FrameToolong and InRangeLengthErrors (Ioana Ciornei) * Remove redundant mtu commit (Maxime Chevialler) PATCH 03 V03: https://lore.kernel.org/netdev/[email protected]/ * 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/[email protected]/ * Remove restore_drop_sge in hinic3_rx_queue_stats (AI review) * Remove hinic3_nic_stats (AI review) * 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) PATCH 03 V05: https://lore.kernel.org/netdev/[email protected]/ * Clear HINIC3_CHANGE_RES_INVALID bit in error handling (AI review) * Use low >= high to avoid low=high in is_coalesce_legal (AI review) * 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) PATCH 03 V06: https://lore.kernel.org/netdev/[email protected]/ * 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/[email protected]/ * Remove the trailing '\n' in NL_SET_ERR_MSG* (Jakub Kicinski) PATCH 03 V08: https://lore.kernel.org/netdev/[email protected]/ * 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/[email protected]/ * 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/[email protected]/ * Unify 3 mutex in struct hinic3_nic_dev: port_state_mutex, change_res_mutex, coal_lock. * Correct copy-paste error in hinic3_get_ringparam() (AI Review and 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) * Use rxq->q_mask instead of rxq->q_depth - 1 in hinic3_configure_rxqs() (Dimitri Daskalakis) * 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) * 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) * Implement dedicated get_rx_ring_count ethtool operation (Dimitri Daskalakis) * 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/[email protected]/ * 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/[email protected]/ * 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: * 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) Fan Gong (3): hinic3: Add ethtool statistic ops hinic3: Add ethtool coalesce ops hinic3: Remove unneeded coalesce parameters .../ethernet/huawei/hinic3/hinic3_ethtool.c | 786 +++++++++++++++++- .../ethernet/huawei/hinic3/hinic3_hw_intf.h | 11 + .../net/ethernet/huawei/hinic3/hinic3_irq.c | 8 +- .../net/ethernet/huawei/hinic3/hinic3_main.c | 4 +- .../huawei/hinic3/hinic3_mgmt_interface.h | 37 + .../huawei/hinic3/hinic3_netdev_ops.c | 4 +- .../ethernet/huawei/hinic3/hinic3_nic_cfg.c | 64 ++ .../ethernet/huawei/hinic3/hinic3_nic_cfg.h | 109 +++ .../ethernet/huawei/hinic3/hinic3_nic_dev.h | 6 +- .../net/ethernet/huawei/hinic3/hinic3_rx.c | 73 +- .../net/ethernet/huawei/hinic3/hinic3_rx.h | 18 +- .../net/ethernet/huawei/hinic3/hinic3_tx.c | 68 +- .../net/ethernet/huawei/hinic3/hinic3_tx.h | 4 +- 13 files changed, 1160 insertions(+), 32 deletions(-) base-commit: ce6b4d3216b63f902bb8e9695ee6c10c83415f65 -- 2.54.0