Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[platform/kernel/linux-starfive.git] / drivers / net / ethernet / marvell / octeontx2 / nic / otx2_common.c
index b971204..8511906 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/interrupt.h>
 #include <linux/pci.h>
+#include <net/page_pool/helpers.h>
 #include <net/tso.h>
 #include <linux/bitfield.h>
 
@@ -774,6 +775,7 @@ int otx2_txsch_alloc(struct otx2_nic *pfvf)
                                rsp->schq_list[lvl][schq];
 
        pfvf->hw.txschq_link_cfg_lvl = rsp->link_cfg_lvl;
+       pfvf->hw.txschq_aggr_lvl_rr_prio = rsp->aggr_lvl_rr_prio;
 
        return 0;
 }
@@ -1904,31 +1906,16 @@ int otx2_handle_ntuple_tc_features(struct net_device *netdev, netdev_features_t
                }
        }
 
-       if ((changed & NETIF_F_HW_TC) && tc) {
-               if (!pfvf->flow_cfg->max_flows) {
-                       netdev_err(netdev,
-                                  "Can't enable TC, MCAM entries not allocated\n");
-                       return -EINVAL;
-               }
-       }
-
        if ((changed & NETIF_F_HW_TC) && !tc &&
-           pfvf->flow_cfg && pfvf->flow_cfg->nr_flows) {
+           otx2_tc_flower_rule_cnt(pfvf)) {
                netdev_err(netdev, "Can't disable TC hardware offload while flows are active\n");
                return -EBUSY;
        }
 
        if ((changed & NETIF_F_NTUPLE) && ntuple &&
-           (netdev->features & NETIF_F_HW_TC) && !(changed & NETIF_F_HW_TC)) {
-               netdev_err(netdev,
-                          "Can't enable NTUPLE when TC is active, disable TC and retry\n");
-               return -EINVAL;
-       }
-
-       if ((changed & NETIF_F_HW_TC) && tc &&
-           (netdev->features & NETIF_F_NTUPLE) && !(changed & NETIF_F_NTUPLE)) {
+           otx2_tc_flower_rule_cnt(pfvf) && !(changed & NETIF_F_HW_TC)) {
                netdev_err(netdev,
-                          "Can't enable TC when NTUPLE is active, disable NTUPLE and retry\n");
+                          "Can't enable NTUPLE when TC flower offload is active, disable TC rules and retry\n");
                return -EINVAL;
        }