Skip to content

Commit 58f244b

Browse files
Jiawen Wukuba-moo
authored andcommitted
net: libwx: move rss_field to struct wx
For global RSS and multiple RSS scheme, the RSS type fields are defined identically in the registers. So they can be defined as the macros WX_RSS_FIELD_* to cleanup the codes. And to prepare for the RXFH support in the next patch, move the rss_field to struct wx. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Link: https://patch.msgid.link/20250926023843.34340-3-jiawenwu@trustnetic.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1be6db0 commit 58f244b

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

drivers/net/ethernet/wangxun/libwx/wx_hw.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,16 +2078,11 @@ void wx_config_rss_field(struct wx *wx)
20782078
{
20792079
u32 rss_field;
20802080

2081-
/* Global RSS and multiple RSS have the same type field */
2082-
rss_field = WX_RDB_RA_CTL_RSS_IPV4 |
2083-
WX_RDB_RA_CTL_RSS_IPV4_TCP |
2084-
WX_RDB_RA_CTL_RSS_IPV4_UDP |
2085-
WX_RDB_RA_CTL_RSS_IPV6 |
2086-
WX_RDB_RA_CTL_RSS_IPV6_TCP |
2087-
WX_RDB_RA_CTL_RSS_IPV6_UDP;
2088-
20892081
if (test_bit(WX_FLAG_SRIOV_ENABLED, wx->flags) &&
20902082
test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
2083+
rss_field = rd32(wx, WX_RDB_PL_CFG(wx->num_vfs));
2084+
rss_field &= ~WX_RDB_PL_CFG_RSS_MASK;
2085+
rss_field |= FIELD_PREP(WX_RDB_PL_CFG_RSS_MASK, wx->rss_flags);
20912086
wr32(wx, WX_RDB_PL_CFG(wx->num_vfs), rss_field);
20922087

20932088
/* Enable global RSS and multiple RSS to make the RSS
@@ -2097,6 +2092,9 @@ void wx_config_rss_field(struct wx *wx)
20972092
WX_RDB_RA_CTL_MULTI_RSS | WX_RDB_RA_CTL_RSS_EN,
20982093
WX_RDB_RA_CTL_MULTI_RSS | WX_RDB_RA_CTL_RSS_EN);
20992094
} else {
2095+
rss_field = rd32(wx, WX_RDB_RA_CTL);
2096+
rss_field &= ~WX_RDB_RA_CTL_RSS_MASK;
2097+
rss_field |= FIELD_PREP(WX_RDB_RA_CTL_RSS_MASK, wx->rss_flags);
21002098
wr32(wx, WX_RDB_RA_CTL, rss_field);
21012099
}
21022100
}
@@ -2450,6 +2448,9 @@ int wx_sw_init(struct wx *wx)
24502448
wx_err(wx, "rss key allocation failed\n");
24512449
return err;
24522450
}
2451+
wx->rss_flags = WX_RSS_FIELD_IPV4 | WX_RSS_FIELD_IPV4_TCP |
2452+
WX_RSS_FIELD_IPV6 | WX_RSS_FIELD_IPV6_TCP |
2453+
WX_RSS_FIELD_IPV4_UDP | WX_RSS_FIELD_IPV6_UDP;
24532454

24542455
wx->mac_table = kcalloc(wx->mac.num_rar_entries,
24552456
sizeof(struct wx_mac_addr),

drivers/net/ethernet/wangxun/libwx/wx_type.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
#define WX_RDB_PL_CFG_TUN_TUNHDR BIT(4)
170170
#define WX_RDB_PL_CFG_TUN_OUTL2HDR BIT(5)
171171
#define WX_RDB_PL_CFG_RSS_EN BIT(24)
172+
#define WX_RDB_PL_CFG_RSS_MASK GENMASK(23, 16)
172173
#define WX_RDB_RSSTBL(_i) (0x19400 + ((_i) * 4))
173174
#define WX_RDB_RSSRK(_i) (0x19480 + ((_i) * 4))
174175
#define WX_RDB_RA_CTL 0x194F4
@@ -180,6 +181,7 @@
180181
#define WX_RDB_RA_CTL_RSS_IPV6_TCP BIT(21)
181182
#define WX_RDB_RA_CTL_RSS_IPV4_UDP BIT(22)
182183
#define WX_RDB_RA_CTL_RSS_IPV6_UDP BIT(23)
184+
#define WX_RDB_RA_CTL_RSS_MASK GENMASK(23, 16)
183185
#define WX_RDB_FDIR_MATCH 0x19558
184186
#define WX_RDB_FDIR_MISS 0x1955C
185187
/* VM RSS */
@@ -1197,6 +1199,15 @@ struct vf_macvlans {
11971199
u8 vf_macvlan[ETH_ALEN];
11981200
};
11991201

1202+
#define WX_RSS_FIELD_IPV4_TCP BIT(0)
1203+
#define WX_RSS_FIELD_IPV4 BIT(1)
1204+
#define WX_RSS_FIELD_IPV4_SCTP BIT(2)
1205+
#define WX_RSS_FIELD_IPV6_SCTP BIT(3)
1206+
#define WX_RSS_FIELD_IPV6_TCP BIT(4)
1207+
#define WX_RSS_FIELD_IPV6 BIT(5)
1208+
#define WX_RSS_FIELD_IPV4_UDP BIT(6)
1209+
#define WX_RSS_FIELD_IPV6_UDP BIT(7)
1210+
12001211
enum wx_pf_flags {
12011212
WX_FLAG_MULTI_64_FUNC,
12021213
WX_FLAG_SWFW_RING,
@@ -1307,6 +1318,7 @@ struct wx {
13071318
#define WX_MAX_RETA_ENTRIES 128
13081319
#define WX_RSS_INDIR_TBL_MAX 64
13091320
u8 rss_indir_tbl[WX_MAX_RETA_ENTRIES];
1321+
u8 rss_flags;
13101322
bool rss_enabled;
13111323
#define WX_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
13121324
u32 *rss_key;

0 commit comments

Comments
 (0)