-
Notifications
You must be signed in to change notification settings - Fork 94
[WIP] [Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Wangxun] merge upstream v6.7rc1-v6.8rc1 wangxun patches #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-6.6.y
Are you sure you want to change the base?
[WIP] [Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Wangxun] merge upstream v6.7rc1-v6.8rc1 wangxun patches #833
Conversation
ANBZ: #8484 commit 87e839c upstream. in some bonding mode, service need to change mac when netif is running. Wangxun netdev add IFF_LIVE_ADDR_CHANGE priv_flag to support it. Signed-off-by: duanqiangwen <duanqiangwen@net-swift.com> Link: https://lore.kernel.org/r/20231206095044.17844-1-duanqiangwen@net-swift.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
ANBZ: #8484 commit 46b92e1 upstream Implement update and clear Rx/Tx statistics. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20231011091906.70486-2-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit f557524 upstream. Move similar code of accessing MDIO bus from txgbe/ngbe to libwx. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Link: https://lore.kernel.org/r/20230912031424.721386-1-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 9224ade upstream. Support to show ethtool statistics. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20231011091906.70486-3-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 0a2714d upstream. Support to show ethtool statistics. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20231011091906.70486-4-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 48e4428 upstream. Since PBA info can be read from lspci, delete txgbe_read_pba_string() and the prints. In addition, delete the redundant MAC address printing. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20231017100635.154967-1-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit e8e138c upstream. For the following implementation, add struct phylink and phylink_config to wx structure. Add the helper function for converting phylink to wx, implement ethtool ksetting and nway reset in libwx. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20240103020854.1656604-2-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 4491c60 upstream. Convert txgbe to use phylink and phylink_config added in libwx. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20231222101639.1499997-3-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit bc2426d upstream. Implement phylink in ngbe driver, to handle phy uniformly for Wangxun ethernet devices. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20240103020854.1656604-4-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 2fe2ca0 upstream. Add support to set pause params with ethtool -A and get pause params with ethtool -a, for ethernet driver txgbe and ngbe. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20240103020854.1656604-5-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 883b598 upstream. Support to query RX/TX depth with ethtool -g, and change RX/TX depth with ethtool -G. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20231212080438.1361308-6-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 4ac2d9d upstream. Support to show RX/TX coalesce with ethtool -c and set RX/TX coalesce with ethtool -C. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20240103020854.1656604-7-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit b746dc6 Add support to get and set msglevel for driver txgbe and ngbe. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20240103020854.1656604-9-jiawenwu@trustnetic.com Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit b3739fb upstream. The ngbe driver needs phylink: arm-linux-gnueabi-ld: drivers/net/ethernet/wangxun/libwx/wx_ethtool.o: in function `wx_nway_reset': wx_ethtool.c:(.text+0x458): undefined reference to `phylink_ethtool_nway_reset' arm-linux-gnueabi-ld: drivers/net/ethernet/wangxun/ngbe/ngbe_main.o: in function `ngbe_remove': ngbe_main.c:(.text+0x7c): undefined reference to `phylink_destroy' arm-linux-gnueabi-ld: drivers/net/ethernet/wangxun/ngbe/ngbe_main.o: in function `ngbe_open': ngbe_main.c:(.text+0xf90): undefined reference to `phylink_connect_phy' arm-linux-gnueabi-ld: drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.o: in function `ngbe_mdio_init': ngbe_mdio.c:(.text+0x314): undefined reference to `phylink_create' Add the missing Kconfig description for this. Fixes: bc2426d ("net: ngbe: convert phylib to phylink") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20240111162828.68564-1-arnd@kernel.org Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
ANBZ: #8484 commit 907ee66 stream. W=1 builds now warn if module is built without a MODULE_DESCRIPTION(). Add a description to Wangxun's common code lib. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/all/20240111193311.4152859-1-kuba@kernel.org Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com>
Reviewer's GuideThis merge incorporates upstream v6.7rc1–v6.8rc1 Wangxun patches by consolidating MDIO operations into a shared library, adopting the Phylink framework, centralizing ethtool functionality, implementing precise flow-control thresholds, extending hardware statistics, and enabling dynamic ring resizing across ngbe and txgbe drivers. Sequence Diagram: MDIO Read C45 Operation via libwxsequenceDiagram
participant D as "Driver (ngbe/txgbe)"
participant LHW as "libwx (wx_hw.c)"
participant HWReg as "Hardware (NIC Registers)"
D->>LHW: wx_phy_read_reg_mdi_c45(bus, phy_addr, devnum, regnum)
LHW->>HWReg: wr32(wx, WX_MDIO_CLAUSE_SELECT, 0)
LHW->>LHW: wx_phy_read_reg_mdi(bus, phy_addr, devnum, regnum) // Internal call
LHW->>HWReg: wr32(wx, WX_MSCA, address_command)
LHW->>HWReg: wr32(wx, WX_MSCC, read_command | WX_MSCC_BUSY)
loop Poll for completion
LHW->>HWReg: val = rd32(wx, WX_MSCC)
end
LHW->>HWReg: data = rd32(wx, WX_MSCC)
LHW-->>D: return data
Sequence Diagram: Phylink Link Up Event and Flow Control ConfigurationsequenceDiagram
participant PHYEvent as "PHY Event / Driver IRQ"
participant DRV as "Driver (e.g., txgbe)"
participant PL as "Phylink Framework"
participant MacOps as "Driver MAC Ops (e.g., txgbe_mac_link_up)"
participant LHW as "libwx (wx_hw.c)"
participant HWReg as "Hardware (NIC Registers)"
PHYEvent->>DRV: Link status change detected (e.g. interrupt)
DRV->>PL: phylink_mac_change(wx->phylink, link_is_up=true)
PL->>MacOps: mac_ops->mac_link_up(config, phy, mode, interface, speed, duplex, tx_pause, rx_pause)
MacOps->>LHW: wx_fc_enable(wx, tx_pause, rx_pause)
LHW->>HWReg: Configure Flow Control registers (e.g., WX_MAC_RX_FLOW_CTRL, WX_RDB_RFCC)
MacOps->>HWReg: Configure MAC Speed/Duplex registers (e.g., WX_MAC_TX_CFG)
MacOps-->>PL: Return
PL-->>DRV: Return
Sequence Diagram: Dynamic Ring Resizing via EthtoolsequenceDiagram
actor User as "User/Admin"
participant EthtoolApp as "Ethtool (userspace)"
participant Kernel as "Kernel (Netlink/Ethtool Ops)"
participant DriverEthOps as "Driver Ethtool (e.g., txgbe_set_ringparam)"
participant DriverStateMgmt as "Driver State Mgmt (e.g., txgbe_down/up)"
participant LibWxLib as "libwx (wx_lib.c)"
participant HWNIC as "Hardware (NIC)"
User->>EthtoolApp: ethtool -G <dev> rx <N> tx <M>
EthtoolApp->>Kernel: Set Ring Parameters (ioctl/netlink)
Kernel->>DriverEthOps: ethtool_ops->set_ringparam(netdev, ring_params)
DriverEthOps->>DriverStateMgmt: driver_down(wx)
DriverStateMgmt->>HWNIC: Disable DMA, etc.
DriverStateMgmt->>LibWxLib: wx_clean_all_tx_rings(wx) / wx_clean_all_rx_rings(wx)
DriverEthOps->>LibWxLib: wx_set_ring(wx, new_tx_count, new_rx_count, temp_buffer)
LibWxLib->>LibWxLib: Free old resources, Allocate new Tx/Rx resources (descriptors)
LibWxLib->>DriverEthOps: Ring counts updated in wx struct
DriverEthOps->>DriverStateMgmt: driver_up(wx) // (includes wx_configure)
DriverStateMgmt->>HWNIC: Configure & Enable DMA with new ring params
DriverStateMgmt->>LibWxLib: Initialize new rings (part of wx_configure flow)
DriverEthOps-->>Kernel: Return success
Kernel-->>EthtoolApp: Return
EthtoolApp-->>User: Output
Class Diagram: Core Data Structures and libwx ModulesclassDiagram
direction LR
class wx {
+wx_fc_info fc
+struct phylink* phylink
+struct phylink_config phylink_config
+wx_hw_stats stats
+u64 tx_busy
+u64 non_eop_descs
+u64 restart_queue
+u64 hw_csum_rx_good
+u64 hw_csum_rx_error
+u64 alloc_rx_buff_failed
+struct wx_ring* rx_ring[]
+struct wx_ring* tx_ring[]
+u32 rx_ring_count
+u32 tx_ring_count
+net_device* netdev
+pci_dev* pdev
+...
}
class wx_fc_info {
+u32 high_water
+u32 low_water
}
class wx_hw_stats {
+u64 gprc
+u64 gptc
+u64 gorc
+u64 gotc
+u64 crcerrs
+u64 rlec
+u64 qmprc
+...
}
class wx_ring {
+u32 count
+wx_queue_stats stats
+wx_tx_queue_stats tx_stats
+wx_rx_queue_stats rx_stats
+net_device* netdev
+...
}
class wx_queue_stats {
+u64 packets
+u64 bytes
}
class wx_tx_queue_stats {
+u64 restart_queue
+u64 tx_busy
}
class wx_rx_queue_stats {
+u64 non_eop_descs
+u64 csum_good_cnt
+u64 csum_err
+u64 alloc_rx_buff_failed
}
class phylink {
<<External Struct>>
}
class phylink_config {
<<External Struct>>
}
class txgbe_driver_specifics {
<<Struct txgbe>>
+wx* wx_handle
# field 'phylink' removed
}
wx "1" *-- "1" wx_fc_info : fc
wx "1" *-- "1" wx_hw_stats : stats
wx "1" *-- "1" phylink_config : phylink_config
wx "1" *-- "0..1" phylink : phylink
wx "1" o-- "*" wx_ring : rings
wx_ring "1" *-- "1" wx_queue_stats : stats
wx_ring "1" .. "1" wx_tx_queue_stats : tx_stats (union member)
wx_ring "1" .. "1" wx_rx_queue_stats : rx_stats (union member)
class LibWx_Hw {
<<Library Functions>>
+wx_phy_read_reg_mdi_c45(bus, phy_addr, devnum, regnum)
+wx_phy_write_reg_mdi_c45(bus, phy_addr, devnum, regnum, value)
+wx_fc_enable(wx, tx_pause, rx_pause)
+wx_update_stats(wx)
+wx_clear_hw_cntrs(wx)
+wx_pbthresh_setup(wx)
}
class LibWx_Ethtool {
<<Library Functions>>
+wx_get_sset_count(netdev, sset)
+wx_get_strings(netdev, stringset, data)
+wx_get_ethtool_stats(netdev, stats, data)
+wx_get_link_ksettings(netdev, cmd)
+wx_set_link_ksettings(netdev, cmd)
+wx_get_ringparam(netdev, ring, kernel_ring, extack)
+wx_get_coalesce(netdev, ec, kernel_coal, extack)
+wx_set_coalesce(netdev, ec, kernel_coal, extack)
}
class LibWx_Lib {
<<Library Functions>>
+wx_set_ring(wx, new_tx_count, new_rx_count, temp_ring)
+wx_write_eitr(q_vector)
+wx_clean_rx_irq(q_vector, budget) // Modified to update rx_stats
+wx_xmit_frame_ring(skb, netdev) // Modified to update tx_stats
}
wx -- LibWx_Hw : uses
wx -- LibWx_Ethtool : uses
wx -- LibWx_Lib : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR merges upstream patches for the wangxun network drivers (txgbe, ngbe, and shared libwx components) from v6.7rc1 to v6.8rc1. Key changes include removal of legacy PBA string functions, a refactor to consistently use phylink for PHY management and MDIO operations, and updates to ethtool ring parameter operations.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | Removed legacy macro definitions and inline conversion functions; added declarations for txgbe_up/down. |
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | Updated usage from netdev_priv-based access to phylink_to_wx for PHY-related operations. |
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | Adjustments in start/stop routines now use wx->phylink; removed redundant variable assignments. |
drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c | Dropped outdated PBA reading functions and added calls for clearing hardware counters. |
drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.c | Replaced local MDIO read/write implementations with calls to new wx_phy_read/write_reg APIs. |
drivers/net/ethernet/wangxun/libwx/wx_lib.c | Introduced wx_set_ring for re-allocation of ring resources using a temporary buffer. |
drivers/net/ethernet/wangxun/Kconfig | Updated dependency from PHYLIB to PHYLINK. |
Comments suppressed due to low confidence (2)
drivers/net/ethernet/wangxun/libwx/wx_lib.c:2688
- [nitpick] Consider adding a clarifying comment in wx_set_ring() to explain that the temporary buffer is used for both TX and RX ring updates to ensure atomicity, which will improve maintainability.
memcpy(&temp_ring[i], wx->tx_ring[i], sizeof(struct wx_ring));
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c:47
- [nitpick] Ensure that the use of kvmalloc_array for allocating the temporary ring buffer is appropriate for all target architectures and that the subsequent resource update and cleanup paths are robust in case of failure.
temp_ring = kvmalloc_array(i, sizeof(struct wx_ring), GFP_KERNEL);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Avenger-285714 - I've reviewed your changes - here's some feedback:
- Ensure that the phylink instance is destroyed on all error paths in ngbe_probe to avoid leaking phylink resources if early initialization fails.
- The ring‐resize logic in txgbe and ngbe is nearly identical—consider refactoring it into a common helper in libwx rather than duplicating memcpy-based ring copies in each driver.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ANBZ: #9013 commit 937d46e upstream. Add support to get RX/TX queue number with ethtool -l, and set RX/TX queue number with ethtool -L. Since interrupts need to be rescheduled, adjust the allocation of msix enties. Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Link: https://lore.kernel.org/all/20240103020854.1656604-8-jiawenwu@trustnetic.com Signed-off-by: David S. Miller <davem@davemloft.net>
ANBZ: #9013 commit 69197df upstream. driver needs queue msix vectors and one misc irq vector, but only queue vectors need irq affinity. when num_online_cpus is less than chip max msix vectors, driver will acquire (num_online_cpus + 1) vecotrs, and call pci_alloc_irq_vectors_affinity functions with affinity params without setting pre_vectors or post_vectors, it will cause return error code -ENOSPC. Misc irq vector is vector 0, driver need to set affinity params .pre_vectors = 1. Fixes: 3f70318 ("net: libwx: Add irq flow functions") Signed-off-by: Duanqiang Wen <duanqiangwen@net-swift.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Merge upstream v6.7rc1–v6.8rc1 Wangxun Ethernet patches into Deepin kernel, refactoring MDIO support to C45, integrating Phylink in txgbe/ngbe drivers, enabling dynamic ring resizing via ethtool, and centralizing flow-control and statistics in libwx.
- Convert legacy MDIO read/write and part-number code to shared libwx implementations
- Integrate Phylink framework for MAC/PHY handling and remove netdev_to_txgbe helper
- Add ethtool ringparam, channels, and setup_tc support; enable RSS by default
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
txgbe/txgbe_type.h | Remove old PBA constants; update interrupt macros; declare txgbe_up/down and setup_tc |
txgbe/txgbe_phy.c | Switch netdev_priv to phylink_to_wx; use wx_phy_* for MDIO C45; adjust irq logic |
txgbe/txgbe_main.c | Implement txgbe_down/up; add setup_tc; enable RSS and live-MAC changes |
txgbe/txgbe_hw.h & txgbe_hw.c | Remove txgbe_read_pba_string API; clear hardware counters on reset |
txgbe/txgbe_ethtool.c | Add ringparam and channels handlers; delegate ops to wx_* helpers |
ngbe/ngbe_type.h | Mirror txgbe interrupt and RSS updates; declare ngbe_up/down/setup_tc |
ngbe/ngbe_mdio.{h,c} | Drop legacy MDIO C22/C45; use wx_phy_* implementations |
ngbe/ngbe_main.c | Integrate phylink_create/stop/start; add setup_tc; enable RSS/live-MAC |
ngbe/ngbe_hw.c | Clear hardware counters after reset |
ngbe/ngbe_ethtool.c | Add ringparam and channels ethtool support |
libwx/wx_type.h, wx_lib.{h,c}, wx_hw.h, wx_ethtool.h | Expand statistics, flow-control, RSS, ring features, and ethtool API surface |
Kconfig | Replace PHYLIB select with PHYLINK |
Comments suppressed due to low confidence (3)
drivers/net/ethernet/wangxun/libwx/wx_type.h:392
- [nitpick] The macro name WX_B2BT is not immediately clear (bytes to bit-times?). Consider a more descriptive name like WX_BYTES_TO_BITTIMES.
#define WX_B2BT(BT) ((BT) * 8)
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c:518
- The new txgbe_setup_tc routine affects queue and interrupt reinitialization but lacks unit or integration tests. Consider adding tests to verify behavior for different tc values.
int txgbe_setup_tc(struct net_device *dev, u8 tc)
drivers/net/ethernet/wangxun/Kconfig:29
- [nitpick] You’ve switched from PHYLIB to PHYLINK in Kconfig but the help text still references legacy MDIO behavior. Update documentation to reflect Phylink requirements.
select PHYLINK
/* Calculate delay value in bit times */ | ||
#define WX_DV(_max_frame_link, _max_frame_tc) \ | ||
((36 * (WX_B2BT(_max_frame_link) + WX_PFC_D + \ | ||
(2 * WX_CABLE_DC) + (2 * WX_ID) + WX_HD) / 25 + 1) + \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The WX_DV macro uses several magic constants (36, 25, etc.) without explanation. Extract these values into named constants or add comments to clarify their origin.
/* Calculate delay value in bit times */ | |
#define WX_DV(_max_frame_link, _max_frame_tc) \ | |
((36 * (WX_B2BT(_max_frame_link) + WX_PFC_D + \ | |
(2 * WX_CABLE_DC) + (2 * WX_ID) + WX_HD) / 25 + 1) + \ | |
/* Constants for delay value calculation */ | |
#define WX_DV_SCALE_FACTOR 36 /* Scaling factor for delay calculation */ | |
#define WX_DV_DIVISOR 25 /* Divisor for delay calculation */ | |
/* Calculate delay value in bit times */ | |
#define WX_DV(_max_frame_link, _max_frame_tc) \ | |
((WX_DV_SCALE_FACTOR * (WX_B2BT(_max_frame_link) + WX_PFC_D + \ | |
(2 * WX_CABLE_DC) + (2 * WX_ID) + WX_HD) / WX_DV_DIVISOR + 1) + \ |
Copilot uses AI. Check for mistakes.
struct txgbe *txgbe = netdev_to_txgbe(netdev); | ||
struct wx *wx = netdev_priv(netdev); | ||
u32 new_rx_count, new_tx_count; | ||
struct wx_ring *temp_ring; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Allocate temp_ring using sizeof(*temp_ring) instead of sizeof(struct wx_ring) for consistency and to avoid type mismatches if the type changes.
Copilot uses AI. Check for mistakes.
@@ -41,14 +44,92 @@ static int ngbe_set_wol(struct net_device *netdev, | |||
return 0; | |||
} | |||
|
|||
static int ngbe_set_ringparam(struct net_device *netdev, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The ngbe_set_ringparam implementation largely duplicates the txgbe_set_ringparam logic. Consider refactoring common behavior into libwx or a shared helper.
Copilot uses AI. Check for mistakes.
@@ -422,6 +422,7 @@ static bool wx_is_non_eop(struct wx_ring *rx_ring, | |||
return false; | |||
|
|||
rx_ring->rx_buffer_info[ntc].skb = skb; | |||
rx_ring->rx_stats.non_eop_descs++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating per-ring stats without synchronization may race with readers. Consider using atomic counters or u64_stats_update_begin/end to protect these increments.
Copilot uses AI. Check for mistakes.
girq->parents[0] = wx->msix_entries[wx->num_q_vectors].vector; | ||
|
||
/* now only suuported on MSI-X interrupt */ | ||
if (!wx->msix_entry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Returning -EPERM when MSI-X isn’t in use may be misleading; consider -ENODEV or -ENOTSUPP to indicate unsupported configuration.
Copilot uses AI. Check for mistakes.
[Part 1]
bugzilla: https://bugzilla.openanolis.cn/show_bug.cgi?id=8484
merge upstream all v6.7rc1-v6.8rc1 wangxun patches and one patch from out of box drivers.patch list below:
Alread merged(17):
907ee66:"net: fill in MODULE_DESCRIPTION()s for wx_lib"
b3739fb:"wangxunx: select CONFIG_PHYLINK where needed"
b746dc6:"net: wangxun: add ethtool_ops for msglevel"
4ac2d9d:"net: wangxun: add coalesce options support"
883b598:"net: wangxun: add ethtool_ops for ring parameters"
2fe2ca0:"net: wangxun: add flow control support"
bc2426d:"net: ngbe: convert phylib to phylink"
4491c60:"net: txgbe: use phylink bits added in libwx"
e8e138c:"net: libwx: add phylink to libwx"
48e4428:"net: wangxun: remove redundant kernel log"
0a2714d:"net: ngbe: add ethtool stats support"
9224ade:"net: txgbe: add ethtool stats support"
f557524:"net: wangxun: move MDIO bus implementation to the library"
738b54b:"net: libwx: fix memory leak on free page"
46b92e1:"net: libwx: support hardware statistics"
87e839c:"net: wangxun: fix changing mac failed when running"
1f1ddc4ffc90: "net: txgbe: fix clk_name exceed MAX_DEV_ID limits"
(deepin: Drop 738b54b:"net: libwx: fix memory leak on free page" because of merged before.)
driver patch:
0580152a7bfd: "net: txgbe: fix i2c dev name cannot match clkdev"
(deepin: Drop 0580152a7bfd: "net: txgbe: fix i2c dev name cannot match clkdev" because it has been reverted upstream.)
Link: https://gitee.com/anolis/cloud-kernel/pulls/2984
[Part 2]
backport upstream wangxun related patches from mainline to fix i2c_designware bugs.
Link: https://gitee.com/anolis/cloud-kernel/pulls/3172
Summary by Sourcery
Merge upstream v6.7rc1–v6.8rc1 Wangxun Ethernet patches and add one driver fix: update common library, introduce Clause-22/45 MDIO support, integrate Phylink in ngbe/txgbe drivers, implement flow control watermarks, enhance ethtool operations (stats, ringparam, coalesce, msglevel), support dynamic ring resizing, and refine hardware stats handling
New Features:
Bug Fixes:
Enhancements: