Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: wangxun: Replace the judgement of MAC type with flags

Since device MAC types are constantly being added, the judgments of
wx->mac.type are complex. Try to convert the types to flags depending
on functions.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Link: https://patch.msgid.link/20250221065718.197544-2-jiawenwu@trustnetic.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jiawen Wu and committed by
Jakub Kicinski
a3ad653c 2e5af6b2

+9 -6
+4 -4
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
··· 72 72 73 73 switch (sset) { 74 74 case ETH_SS_STATS: 75 - return (wx->mac.type == wx_mac_sp) ? 75 + return (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) ? 76 76 WX_STATS_LEN + WX_FDIR_STATS_LEN : WX_STATS_LEN; 77 77 default: 78 78 return -EOPNOTSUPP; ··· 90 90 case ETH_SS_STATS: 91 91 for (i = 0; i < WX_GLOBAL_STATS_LEN; i++) 92 92 ethtool_puts(&p, wx_gstrings_stats[i].stat_string); 93 - if (wx->mac.type == wx_mac_sp) { 93 + if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) { 94 94 for (i = 0; i < WX_FDIR_STATS_LEN; i++) 95 95 ethtool_puts(&p, wx_gstrings_fdir_stats[i].stat_string); 96 96 } ··· 124 124 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 125 125 } 126 126 127 - if (wx->mac.type == wx_mac_sp) { 127 + if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) { 128 128 for (k = 0; k < WX_FDIR_STATS_LEN; k++) { 129 129 p = (char *)wx + wx_gstrings_fdir_stats[k].stat_offset; 130 130 data[i++] = *(u64 *)p; ··· 199 199 unsigned int stats_len = WX_STATS_LEN; 200 200 struct wx *wx = netdev_priv(netdev); 201 201 202 - if (wx->mac.type == wx_mac_sp) 202 + if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) 203 203 stats_len += WX_FDIR_STATS_LEN; 204 204 205 205 strscpy(info->driver, wx->driver_name, sizeof(info->driver));
+2 -2
drivers/net/ethernet/wangxun/libwx/wx_hw.c
··· 1861 1861 /* enable hw crc stripping */ 1862 1862 wr32m(wx, WX_RSC_CTL, WX_RSC_CTL_CRC_STRIP, WX_RSC_CTL_CRC_STRIP); 1863 1863 1864 - if (wx->mac.type == wx_mac_sp) { 1864 + if (test_bit(WX_FLAG_RSC_CAPABLE, wx->flags)) { 1865 1865 u32 psrctl; 1866 1866 1867 1867 /* RSC Setup */ ··· 2513 2513 hwstats->b2ogprc += rd32(wx, WX_RDM_BMC2OS_CNT); 2514 2514 hwstats->rdmdrop += rd32(wx, WX_RDM_DRP_PKT); 2515 2515 2516 - if (wx->mac.type == wx_mac_sp) { 2516 + if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) { 2517 2517 hwstats->fdirmatch += rd32(wx, WX_RDB_FDIR_MATCH); 2518 2518 hwstats->fdirmiss += rd32(wx, WX_RDB_FDIR_MISS); 2519 2519 }
+1
drivers/net/ethernet/wangxun/libwx/wx_type.h
··· 1112 1112 WX_FLAG_FDIR_CAPABLE, 1113 1113 WX_FLAG_FDIR_HASH, 1114 1114 WX_FLAG_FDIR_PERFECT, 1115 + WX_FLAG_RSC_CAPABLE, 1115 1116 WX_FLAG_RX_HWTSTAMP_ENABLED, 1116 1117 WX_FLAG_RX_HWTSTAMP_IN_REGISTER, 1117 1118 WX_FLAG_PTP_PPS_ENABLED,
+2
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
··· 298 298 wx->atr = txgbe_atr; 299 299 wx->configure_fdir = txgbe_configure_fdir; 300 300 301 + set_bit(WX_FLAG_RSC_CAPABLE, wx->flags); 302 + 301 303 /* enable itr by default in dynamic mode */ 302 304 wx->rx_itr_setting = 1; 303 305 wx->tx_itr_setting = 1;