Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Hariprasad Kelam and committed by
David S. Miller
61f98da4 4b006b43

+12 -18
+3 -18
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
··· 1905 1905 } 1906 1906 } 1907 1907 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 - 1916 1908 if ((changed & NETIF_F_HW_TC) && !tc && 1917 - pfvf->flow_cfg && pfvf->flow_cfg->nr_flows) { 1909 + otx2_tc_flower_rule_cnt(pfvf)) { 1918 1910 netdev_err(netdev, "Can't disable TC hardware offload while flows are active\n"); 1919 1911 return -EBUSY; 1920 1912 } 1921 1913 1922 1914 if ((changed & NETIF_F_NTUPLE) && ntuple && 1923 - (netdev->features & NETIF_F_HW_TC) && !(changed & NETIF_F_HW_TC)) { 1915 + otx2_tc_flower_rule_cnt(pfvf) && !(changed & NETIF_F_HW_TC)) { 1924 1916 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)) { 1931 - 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"); 1933 1918 return -EINVAL; 1934 1919 } 1935 1920
+9
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
··· 940 940 return converted_rate; 941 941 } 942 942 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 + 943 952 /* MSI-X APIs */ 944 953 void otx2_free_cints(struct otx2_nic *pfvf, int n); 945 954 void otx2_set_cints_affinity(struct otx2_nic *pfvf);