Skip to content

Commit 4aa1d8f

Browse files
sumang-mrvlPaolo Abeni
authored andcommitted
octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx queue than its PF
It is possible to add a ntuple rule which would like to direct packet to a VF whose number of queues are greater/less than its PF's queue numbers. For example a PF can have 2 Rx queues but a VF created on that PF can have 8 Rx queues. As of today, ntuple rule will reject rule because it is checking the requested queue number against PF's number of Rx queues. As a part of this fix if the action of a ntuple rule is to move a packet to a VF's queue then the check is removed. Also, a debug information is printed to aware user that it is user's responsibility to cross check if the requested queue number on that VF is a valid one. Fixes: f0a1913 ("octeontx2-pf: Add support for ethtool ntuple filters") Signed-off-by: Suman Ghosh <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 99360d9 commit 4aa1d8f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc)
10881088
struct ethhdr *eth_hdr;
10891089
bool new = false;
10901090
int err = 0;
1091+
u64 vf_num;
10911092
u32 ring;
10921093

10931094
if (!flow_cfg->max_flows) {
@@ -1100,7 +1101,21 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc)
11001101
if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT))
11011102
return -ENOMEM;
11021103

1103-
if (ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC)
1104+
/* Number of queues on a VF can be greater or less than
1105+
* the PF's queue. Hence no need to check for the
1106+
* queue count. Hence no need to check queue count if PF
1107+
* is installing for its VF. Below is the expected vf_num value
1108+
* based on the ethtool commands.
1109+
*
1110+
* e.g.
1111+
* 1. ethtool -U <netdev> ... action -1 ==> vf_num:255
1112+
* 2. ethtool -U <netdev> ... action <queue_num> ==> vf_num:0
1113+
* 3. ethtool -U <netdev> ... vf <vf_idx> queue <queue_num> ==>
1114+
* vf_num:vf_idx+1
1115+
*/
1116+
vf_num = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
1117+
if (!is_otx2_vf(pfvf->pcifunc) && !vf_num &&
1118+
ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC)
11041119
return -EINVAL;
11051120

11061121
if (fsp->location >= otx2_get_maxflows(flow_cfg))
@@ -1182,6 +1197,9 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc)
11821197
flow_cfg->nr_flows++;
11831198
}
11841199

1200+
if (flow->is_vf)
1201+
netdev_info(pfvf->netdev,
1202+
"Make sure that VF's queue number is within its queue limit\n");
11851203
return 0;
11861204
}
11871205

0 commit comments

Comments
 (0)