Skip to content

Commit 9d33ffa

Browse files
committed
Merge branch 'octeontx2-Add-support-for-VLAN-based-flow-distribution'
George Cherian says: ==================== octeontx2: Add support for VLAN based flow distribution This series add support for VLAN based flow distribution for octeontx2 netdev driver. This adds support for configuring the same via ethtool. Following tests have been done. - Multi VLAN flow with same SD - Multi VLAN flow with same SDFN - Single VLAN flow with multi SD - Single VLAN flow with multi SDFN All tests done for udp/tcp both v4 and v6 ==================== Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents de2b541 + a55ff8e commit 9d33ffa

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/af/mbox.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ struct nix_rss_flowkey_cfg {
625625
#define NIX_FLOW_KEY_TYPE_INNR_UDP BIT(15)
626626
#define NIX_FLOW_KEY_TYPE_INNR_SCTP BIT(16)
627627
#define NIX_FLOW_KEY_TYPE_INNR_ETH_DMAC BIT(17)
628+
#define NIX_FLOW_KEY_TYPE_VLAN BIT(20)
628629
u32 flowkey_cfg; /* Flowkey types selected */
629630
u8 group; /* RSS context or group */
630631
};

drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,6 +2509,14 @@ static int set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
25092509
field->ltype_match = NPC_LT_LE_GTPU;
25102510
field->ltype_mask = 0xF;
25112511
break;
2512+
case NIX_FLOW_KEY_TYPE_VLAN:
2513+
field->lid = NPC_LID_LB;
2514+
field->hdr_offset = 2; /* Skip TPID (2-bytes) */
2515+
field->bytesm1 = 1; /* 2 Bytes (Actually 12 bits) */
2516+
field->ltype_match = NPC_LT_LB_CTAG;
2517+
field->ltype_mask = 0xF;
2518+
field->fn_mask = 1; /* Mask out the first nibble */
2519+
break;
25122520
}
25132521
field->ena = 1;
25142522

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)