net/ice: refine debug build option
[dpdk.git] / drivers / net / ice / ice_ethdev.c
index 8999d44..5082c22 100644 (file)
@@ -129,10 +129,8 @@ static int ice_xstats_get(struct rte_eth_dev *dev,
 static int ice_xstats_get_names(struct rte_eth_dev *dev,
                                struct rte_eth_xstat_name *xstats_names,
                                unsigned int limit);
-static int ice_dev_filter_ctrl(struct rte_eth_dev *dev,
-                       enum rte_filter_type filter_type,
-                       enum rte_filter_op filter_op,
-                       void *arg);
+static int ice_dev_flow_ops_get(struct rte_eth_dev *dev,
+                               const struct rte_flow_ops **ops);
 static int ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
                        struct rte_eth_udp_tunnel *udp_tunnel);
 static int ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
@@ -215,7 +213,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = {
        .xstats_get                   = ice_xstats_get,
        .xstats_get_names             = ice_xstats_get_names,
        .xstats_reset                 = ice_stats_reset,
-       .filter_ctrl                  = ice_dev_filter_ctrl,
+       .flow_ops_get                 = ice_dev_flow_ops_get,
        .udp_tunnel_port_add          = ice_dev_udp_tunnel_port_add,
        .udp_tunnel_port_del          = ice_dev_udp_tunnel_port_del,
        .tx_done_cleanup              = ice_tx_done_cleanup,
@@ -809,7 +807,7 @@ ice_init_mac_address(struct rte_eth_dev *dev)
                (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr);
 
        dev->data->mac_addrs =
-               rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0);
+               rte_zmalloc(NULL, sizeof(struct rte_ether_addr) * ICE_NUM_MACADDR_MAX, 0);
        if (!dev->data->mac_addrs) {
                PMD_INIT_LOG(ERR,
                             "Failed to allocate memory to store mac address");
@@ -1663,8 +1661,14 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)
        pos = rte_pci_find_ext_capability(pci_dev, RTE_PCI_EXT_CAP_ID_DSN);
 
        if (pos) {
-               rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4);
-               rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8);
+               if (rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4) < 0) {
+                       PMD_INIT_LOG(ERR, "Failed to read pci config space\n");
+                       return -1;
+               }
+               if (rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8) < 0) {
+                       PMD_INIT_LOG(ERR, "Failed to read pci config space\n");
+                       return -1;
+               }
                snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,
                         "ice-%08x%08x.pkg", dsn_high, dsn_low);
        } else {
@@ -1727,7 +1731,11 @@ static int ice_load_pkg(struct rte_eth_dev *dev)
        struct ice_adapter *ad =
                ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
-       ice_pkg_file_search_path(pci_dev, pkg_file);
+       err = ice_pkg_file_search_path(pci_dev, pkg_file);
+       if (err) {
+               PMD_INIT_LOG(ERR, "failed to search file path\n");
+               return err;
+       }
 
        file = fopen(pkg_file, "rb");
        if (!file)  {
@@ -2338,7 +2346,7 @@ hash_cfg_reset(struct ice_rss_hash_cfg *cfg)
        cfg->hash_flds = 0;
        cfg->addl_hdrs = 0;
        cfg->symm = 0;
-       cfg->hdr_type = ICE_RSS_ANY_HEADERS;
+       cfg->hdr_type = ICE_RSS_OUTER_HEADERS;
 }
 
 static int
@@ -2823,7 +2831,7 @@ ice_rss_hash_set(struct ice_pf *pf, uint64_t rss_hf)
                            __func__, ret);
 
        cfg.symm = 0;
-       cfg.hdr_type = ICE_RSS_ANY_HEADERS;
+       cfg.hdr_type = ICE_RSS_OUTER_HEADERS;
        /* Configure RSS for IPv4 with src/dst addr as input set */
        if (rss_hf & ETH_RSS_IPV4) {
                cfg.addl_hdrs = ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER;
@@ -4447,8 +4455,10 @@ ice_rss_hash_update(struct rte_eth_dev *dev,
        if (status)
                return status;
 
-       if (rss_conf->rss_hf == 0)
+       if (rss_conf->rss_hf == 0) {
+               pf->rss_hf = 0;
                return 0;
+       }
 
        /* RSS hash configuration */
        ice_rss_hash_set(pf, rss_conf->rss_hf);
@@ -5255,30 +5265,14 @@ static int ice_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 }
 
 static int
-ice_dev_filter_ctrl(struct rte_eth_dev *dev,
-                    enum rte_filter_type filter_type,
-                    enum rte_filter_op filter_op,
-                    void *arg)
+ice_dev_flow_ops_get(struct rte_eth_dev *dev,
+                    const struct rte_flow_ops **ops)
 {
-       int ret = 0;
-
        if (!dev)
                return -EINVAL;
 
-       switch (filter_type) {
-       case RTE_ETH_FILTER_GENERIC:
-               if (filter_op != RTE_ETH_FILTER_GET)
-                       return -EINVAL;
-               *(const void **)arg = &ice_flow_ops;
-               break;
-       default:
-               PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
-                                       filter_type);
-               ret = -EINVAL;
-               break;
-       }
-
-       return ret;
+       *ops = &ice_flow_ops;
+       return 0;
 }
 
 /* Add UDP tunneling port */
@@ -5366,12 +5360,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 
 RTE_LOG_REGISTER(ice_logtype_init, pmd.net.ice.init, NOTICE);
 RTE_LOG_REGISTER(ice_logtype_driver, pmd.net.ice.driver, NOTICE);
-#ifdef RTE_LIBRTE_ICE_DEBUG_RX
+#ifdef RTE_ETHDEV_DEBUG_RX
 RTE_LOG_REGISTER(ice_logtype_rx, pmd.net.ice.rx, DEBUG);
 #endif
-#ifdef RTE_LIBRTE_ICE_DEBUG_TX
+#ifdef RTE_ETHDEV_DEBUG_TX
 RTE_LOG_REGISTER(ice_logtype_tx, pmd.net.ice.tx, DEBUG);
 #endif
-#ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE
-RTE_LOG_REGISTER(ice_logtype_tx_free, pmd.net.ice.tx_free, DEBUG);
-#endif