mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 18:12:25 -04:00
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>
This commit is contained in:
committed by
Jakub Kicinski
parent
2e5af6b2ae
commit
a3ad653c91
@@ -72,7 +72,7 @@ int wx_get_sset_count(struct net_device *netdev, int sset)
|
||||
|
||||
switch (sset) {
|
||||
case ETH_SS_STATS:
|
||||
return (wx->mac.type == wx_mac_sp) ?
|
||||
return (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) ?
|
||||
WX_STATS_LEN + WX_FDIR_STATS_LEN : WX_STATS_LEN;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
@@ -90,7 +90,7 @@ void wx_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
|
||||
case ETH_SS_STATS:
|
||||
for (i = 0; i < WX_GLOBAL_STATS_LEN; i++)
|
||||
ethtool_puts(&p, wx_gstrings_stats[i].stat_string);
|
||||
if (wx->mac.type == wx_mac_sp) {
|
||||
if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) {
|
||||
for (i = 0; i < WX_FDIR_STATS_LEN; i++)
|
||||
ethtool_puts(&p, wx_gstrings_fdir_stats[i].stat_string);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void wx_get_ethtool_stats(struct net_device *netdev,
|
||||
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
|
||||
}
|
||||
|
||||
if (wx->mac.type == wx_mac_sp) {
|
||||
if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) {
|
||||
for (k = 0; k < WX_FDIR_STATS_LEN; k++) {
|
||||
p = (char *)wx + wx_gstrings_fdir_stats[k].stat_offset;
|
||||
data[i++] = *(u64 *)p;
|
||||
@@ -199,7 +199,7 @@ void wx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info)
|
||||
unsigned int stats_len = WX_STATS_LEN;
|
||||
struct wx *wx = netdev_priv(netdev);
|
||||
|
||||
if (wx->mac.type == wx_mac_sp)
|
||||
if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags))
|
||||
stats_len += WX_FDIR_STATS_LEN;
|
||||
|
||||
strscpy(info->driver, wx->driver_name, sizeof(info->driver));
|
||||
|
||||
@@ -1861,7 +1861,7 @@ void wx_configure_rx(struct wx *wx)
|
||||
/* enable hw crc stripping */
|
||||
wr32m(wx, WX_RSC_CTL, WX_RSC_CTL_CRC_STRIP, WX_RSC_CTL_CRC_STRIP);
|
||||
|
||||
if (wx->mac.type == wx_mac_sp) {
|
||||
if (test_bit(WX_FLAG_RSC_CAPABLE, wx->flags)) {
|
||||
u32 psrctl;
|
||||
|
||||
/* RSC Setup */
|
||||
@@ -2513,7 +2513,7 @@ void wx_update_stats(struct wx *wx)
|
||||
hwstats->b2ogprc += rd32(wx, WX_RDM_BMC2OS_CNT);
|
||||
hwstats->rdmdrop += rd32(wx, WX_RDM_DRP_PKT);
|
||||
|
||||
if (wx->mac.type == wx_mac_sp) {
|
||||
if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)) {
|
||||
hwstats->fdirmatch += rd32(wx, WX_RDB_FDIR_MATCH);
|
||||
hwstats->fdirmiss += rd32(wx, WX_RDB_FDIR_MISS);
|
||||
}
|
||||
|
||||
@@ -1112,6 +1112,7 @@ enum wx_pf_flags {
|
||||
WX_FLAG_FDIR_CAPABLE,
|
||||
WX_FLAG_FDIR_HASH,
|
||||
WX_FLAG_FDIR_PERFECT,
|
||||
WX_FLAG_RSC_CAPABLE,
|
||||
WX_FLAG_RX_HWTSTAMP_ENABLED,
|
||||
WX_FLAG_RX_HWTSTAMP_IN_REGISTER,
|
||||
WX_FLAG_PTP_PPS_ENABLED,
|
||||
|
||||
@@ -298,6 +298,8 @@ static int txgbe_sw_init(struct wx *wx)
|
||||
wx->atr = txgbe_atr;
|
||||
wx->configure_fdir = txgbe_configure_fdir;
|
||||
|
||||
set_bit(WX_FLAG_RSC_CAPABLE, wx->flags);
|
||||
|
||||
/* enable itr by default in dynamic mode */
|
||||
wx->rx_itr_setting = 1;
|
||||
wx->tx_itr_setting = 1;
|
||||
|
||||
Reference in New Issue
Block a user