net/ice: fix VSI context
[dpdk.git] / drivers / net / ice / ice_ethdev.c
index 3b20ea4..cf99fc3 100644 (file)
 /* devargs */
 #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support"
 #define ICE_PIPELINE_MODE_SUPPORT_ARG  "pipeline-mode-support"
+#define ICE_FLOW_MARK_SUPPORT_ARG      "flow-mark-support"
 #define ICE_PROTO_XTR_ARG         "proto_xtr"
 
 static const char * const ice_valid_args[] = {
        ICE_SAFE_MODE_SUPPORT_ARG,
        ICE_PIPELINE_MODE_SUPPORT_ARG,
+       ICE_FLOW_MARK_SUPPORT_ARG,
        ICE_PROTO_XTR_ARG,
        NULL
 };
@@ -161,6 +163,9 @@ static const struct rte_pci_id pci_id_ice_map[] = {
        { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810_XXV_BACKPLANE) },
        { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810_XXV_QSFP) },
        { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810_XXV_SFP) },
+       { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_BACKPLANE) },
+       { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_QSFP) },
+       { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_SFP) },
        { .vendor_id = 0, /* sentinel */ },
 };
 
@@ -1571,7 +1576,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
                cfg = ICE_AQ_VSI_PROP_SECURITY_VALID |
                        ICE_AQ_VSI_PROP_FLOW_DIR_VALID;
                vsi_ctx.info.valid_sections |= rte_cpu_to_le_16(cfg);
-               cfg = ICE_AQ_VSI_FD_ENABLE | ICE_AQ_VSI_FD_PROG_ENABLE;
+               cfg = ICE_AQ_VSI_FD_ENABLE;
                vsi_ctx.info.fd_options = rte_cpu_to_le_16(cfg);
                vsi_ctx.info.max_fd_fltr_dedicated =
                        rte_cpu_to_le_16(hw->func_caps.fd_fltr_guar);
@@ -1599,9 +1604,10 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 
                cfg = ICE_AQ_VSI_PROP_FLOW_DIR_VALID;
                vsi_ctx.info.valid_sections |= rte_cpu_to_le_16(cfg);
-               cfg = ICE_AQ_VSI_FD_ENABLE | ICE_AQ_VSI_FD_PROG_ENABLE;
+               cfg = ICE_AQ_VSI_FD_PROG_ENABLE;
                vsi_ctx.info.fd_options = rte_cpu_to_le_16(cfg);
                vsi_ctx.info.sw_id = hw->port_info->sw_id;
+               vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
                ret = ice_vsi_config_tc_queue_mapping(vsi,
                                                      &vsi_ctx.info,
                                                      ICE_DEFAULT_TCMAP);
@@ -1987,6 +1993,13 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 
        ret = rte_kvargs_process(kvlist, ICE_PIPELINE_MODE_SUPPORT_ARG,
                                 &parse_bool, &ad->devargs.pipe_mode_support);
+       if (ret)
+               goto bail;
+
+       ret = rte_kvargs_process(kvlist, ICE_FLOW_MARK_SUPPORT_ARG,
+                                &parse_bool, &ad->devargs.flow_mark_support);
+       if (ret)
+               goto bail;
 
 bail:
        rte_kvargs_free(kvlist);
@@ -2242,10 +2255,12 @@ ice_dev_init(struct rte_eth_dev *dev)
        /* get base queue pairs index  in the device */
        ice_base_queue_get(pf);
 
-       ret = ice_flow_init(ad);
-       if (ret) {
-               PMD_INIT_LOG(ERR, "Failed to initialize flow");
-               return ret;
+       if (!ad->is_safe_mode) {
+               ret = ice_flow_init(ad);
+               if (ret) {
+                       PMD_INIT_LOG(ERR, "Failed to initialize flow");
+                       return ret;
+               }
        }
 
        ret = ice_reset_fxp_resource(hw);
@@ -2299,7 +2314,7 @@ ice_release_vsi(struct ice_vsi *vsi)
        return 0;
 }
 
-static void
+void
 ice_vsi_disable_queues_intr(struct ice_vsi *vsi)
 {
        struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2352,9 +2367,6 @@ ice_dev_stop(struct rte_eth_dev *dev)
        /* disable all queue interrupts */
        ice_vsi_disable_queues_intr(main_vsi);
 
-       if (pf->fdir.fdir_vsi)
-               ice_vsi_disable_queues_intr(pf->fdir.fdir_vsi);
-
        /* Clear all queues and release mbufs */
        ice_clear_queues(dev);
 
@@ -2392,7 +2404,8 @@ ice_dev_close(struct rte_eth_dev *dev)
 
        ice_dev_stop(dev);
 
-       ice_flow_uninit(ad);
+       if (!ad->is_safe_mode)
+               ice_flow_uninit(ad);
 
        /* release all queue resource */
        ice_free_queues(dev);
@@ -2442,7 +2455,8 @@ ice_dev_configure(struct rte_eth_dev *dev)
        ad->rx_bulk_alloc_allowed = true;
        ad->tx_simple_allowed = true;
 
-       dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+       if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+               dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
        return 0;
 }
@@ -2601,7 +2615,7 @@ __vsi_queues_bind_intr(struct ice_vsi *vsi, uint16_t msix_vect,
        }
 }
 
-static void
+void
 ice_vsi_queues_bind_intr(struct ice_vsi *vsi)
 {
        struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2654,7 +2668,7 @@ ice_vsi_queues_bind_intr(struct ice_vsi *vsi)
        }
 }
 
-static void
+void
 ice_vsi_enable_queues_intr(struct ice_vsi *vsi)
 {
        struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2724,12 +2738,6 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev)
        /* Enable interrupts for all the queues */
        ice_vsi_enable_queues_intr(vsi);
 
-       /* Enable FDIR MSIX interrupt */
-       if (pf->fdir.fdir_vsi) {
-               ice_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
-               ice_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
-       }
-
        rte_intr_enable(intr_handle);
 
        return 0;
@@ -4567,7 +4575,8 @@ RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_ice,
                              ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp>"
                              ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>"
-                             ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>");
+                             ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>"
+                             ICE_FLOW_MARK_SUPPORT_ARG "=<0|1>");
 
 RTE_INIT(ice_init_log)
 {