Skip to content

Commit 61f98da

Browse files
Hariprasad Kelamdavem330
authored andcommitted
octeontx2-pf: Allow both ntuple and TC features on the interface
The current implementation does not allow the user to enable both hw-tc-offload and ntuple features on the interface. These checks are added as TC flower offload and ntuple features internally configures the same hardware resource MCAM. But TC HTB offload configures the transmit scheduler which can be safely enabled on the interface with ntuple feature. This patch adds the same and ensures only TC flower offload and ntuple features are mutually exclusive. Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4b006b4 commit 61f98da

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,31 +1905,16 @@ int otx2_handle_ntuple_tc_features(struct net_device *netdev, netdev_features_t
19051905
}
19061906
}
19071907

1908-
if ((changed & NETIF_F_HW_TC) && tc) {
1909-
if (!pfvf->flow_cfg->max_flows) {
1910-
netdev_err(netdev,
1911-
"Can't enable TC, MCAM entries not allocated\n");
1912-
return -EINVAL;
1913-
}
1914-
}
1915-
19161908
if ((changed & NETIF_F_HW_TC) && !tc &&
1917-
pfvf->flow_cfg && pfvf->flow_cfg->nr_flows) {
1909+
otx2_tc_flower_rule_cnt(pfvf)) {
19181910
netdev_err(netdev, "Can't disable TC hardware offload while flows are active\n");
19191911
return -EBUSY;
19201912
}
19211913

19221914
if ((changed & NETIF_F_NTUPLE) && ntuple &&
1923-
(netdev->features & NETIF_F_HW_TC) && !(changed & NETIF_F_HW_TC)) {
1924-
netdev_err(netdev,
1925-
"Can't enable NTUPLE when TC is active, disable TC and retry\n");
1926-
return -EINVAL;
1927-
}
1928-
1929-
if ((changed & NETIF_F_HW_TC) && tc &&
1930-
(netdev->features & NETIF_F_NTUPLE) && !(changed & NETIF_F_NTUPLE)) {
1915+
otx2_tc_flower_rule_cnt(pfvf) && !(changed & NETIF_F_HW_TC)) {
19311916
netdev_err(netdev,
1932-
"Can't enable TC when NTUPLE is active, disable NTUPLE and retry\n");
1917+
"Can't enable NTUPLE when TC flower offload is active, disable TC rules and retry\n");
19331918
return -EINVAL;
19341919
}
19351920

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,15 @@ static inline u64 otx2_convert_rate(u64 rate)
940940
return converted_rate;
941941
}
942942

943+
static inline int otx2_tc_flower_rule_cnt(struct otx2_nic *pfvf)
944+
{
945+
/* return here if MCAM entries not allocated */
946+
if (!pfvf->flow_cfg)
947+
return 0;
948+
949+
return pfvf->flow_cfg->nr_flows;
950+
}
951+
943952
/* MSI-X APIs */
944953
void otx2_free_cints(struct otx2_nic *pfvf, int n);
945954
void otx2_set_cints_affinity(struct otx2_nic *pfvf);

0 commit comments

Comments
 (0)