Skip to content

Commit a55ff8e

Browse files
georgecherian81davem330
authored andcommitted
octeontx2-pf: Support to change VLAN based RSS hash options via ethtool
Add support to control rx-flow-hash based on VLAN. By default VLAN plus 4-tuple based hashing is enabled. Changes can be done runtime using ethtool To enable 2-tuple plus VLAN based flow distribution # ethtool -N <intf> rx-flow-hash <prot> sdv To enable 4-tuple plus VLAN based flow distribution # ethtool -N <intf> rx-flow-hash <prot> sdfnv Signed-off-by: George Cherian <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8f90036 commit a55ff8e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ int otx2_rss_init(struct otx2_nic *pfvf)
355355
rss->flowkey_cfg = rss->enable ? rss->flowkey_cfg :
356356
NIX_FLOW_KEY_TYPE_IPV4 | NIX_FLOW_KEY_TYPE_IPV6 |
357357
NIX_FLOW_KEY_TYPE_TCP | NIX_FLOW_KEY_TYPE_UDP |
358-
NIX_FLOW_KEY_TYPE_SCTP;
358+
NIX_FLOW_KEY_TYPE_SCTP | NIX_FLOW_KEY_TYPE_VLAN;
359359

360360
ret = otx2_set_flowkey_cfg(pfvf);
361361
if (ret)

drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ static int otx2_get_rss_hash_opts(struct otx2_nic *pfvf,
428428

429429
/* Mimimum is IPv4 and IPv6, SIP/DIP */
430430
nfc->data = RXH_IP_SRC | RXH_IP_DST;
431+
if (rss->flowkey_cfg & NIX_FLOW_KEY_TYPE_VLAN)
432+
nfc->data |= RXH_VLAN;
431433

432434
switch (nfc->flow_type) {
433435
case TCP_V4_FLOW:
@@ -477,6 +479,11 @@ static int otx2_set_rss_hash_opts(struct otx2_nic *pfvf,
477479
if (!(nfc->data & RXH_IP_SRC) || !(nfc->data & RXH_IP_DST))
478480
return -EINVAL;
479481

482+
if (nfc->data & RXH_VLAN)
483+
rss_cfg |= NIX_FLOW_KEY_TYPE_VLAN;
484+
else
485+
rss_cfg &= ~NIX_FLOW_KEY_TYPE_VLAN;
486+
480487
switch (nfc->flow_type) {
481488
case TCP_V4_FLOW:
482489
case TCP_V6_FLOW:

0 commit comments

Comments
 (0)