net/ring: release port upon close
[dpdk.git] / drivers / net / iavf / iavf_ethdev.c
index 28ca3fa..8f46c45 100644 (file)
@@ -32,7 +32,7 @@
 static int iavf_dev_configure(struct rte_eth_dev *dev);
 static int iavf_dev_start(struct rte_eth_dev *dev);
 static void iavf_dev_stop(struct rte_eth_dev *dev);
-static void iavf_dev_close(struct rte_eth_dev *dev);
+static int iavf_dev_close(struct rte_eth_dev *dev);
 static int iavf_dev_reset(struct rte_eth_dev *dev);
 static int iavf_dev_info_get(struct rte_eth_dev *dev,
                             struct rte_eth_dev_info *dev_info);
@@ -117,9 +117,6 @@ static const struct eth_dev_ops iavf_eth_dev_ops = {
        .rss_hash_conf_get          = iavf_dev_rss_hash_conf_get,
        .rxq_info_get               = iavf_dev_rxq_info_get,
        .txq_info_get               = iavf_dev_txq_info_get,
-       .rx_queue_count             = iavf_dev_rxq_count,
-       .rx_descriptor_status       = iavf_dev_rx_desc_status,
-       .tx_descriptor_status       = iavf_dev_tx_desc_status,
        .mtu_set                    = iavf_dev_mtu_set,
        .rx_queue_intr_enable       = iavf_dev_rx_queue_intr_enable,
        .rx_queue_intr_disable      = iavf_dev_rx_queue_intr_disable,
@@ -160,7 +157,7 @@ iavf_init_rss(struct iavf_adapter *adapter)
 {
        struct iavf_info *vf =  IAVF_DEV_PRIVATE_TO_VF(adapter);
        struct rte_eth_rss_conf *rss_conf;
-       uint8_t i, j, nb_q;
+       uint16_t i, j, nb_q;
        int ret;
 
        rss_conf = &adapter->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
@@ -286,7 +283,7 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 
        rxq->max_pkt_len = max_pkt_len;
        if ((dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) ||
-           (rxq->max_pkt_len + 2 * IAVF_VLAN_TAG_SIZE) > buf_size) {
+           rxq->max_pkt_len > buf_size) {
                dev_data->scattered_rx = 1;
        }
        IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
@@ -690,6 +687,8 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
        ret = iavf_config_promisc(adapter, true, vf->promisc_multicast_enabled);
        if (!ret)
                vf->promisc_unicast_enabled = true;
+       else if (ret == IAVF_NOT_SUPPORTED)
+               ret = -ENOTSUP;
        else
                ret = -EAGAIN;
 
@@ -711,6 +710,8 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
                                  vf->promisc_multicast_enabled);
        if (!ret)
                vf->promisc_unicast_enabled = false;
+       else if (ret == IAVF_NOT_SUPPORTED)
+               ret = -ENOTSUP;
        else
                ret = -EAGAIN;
 
@@ -731,6 +732,8 @@ iavf_dev_allmulticast_enable(struct rte_eth_dev *dev)
        ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, true);
        if (!ret)
                vf->promisc_multicast_enabled = true;
+       else if (ret == IAVF_NOT_SUPPORTED)
+               ret = -ENOTSUP;
        else
                ret = -EAGAIN;
 
@@ -751,6 +754,8 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev)
        ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, false);
        if (!ret)
                vf->promisc_multicast_enabled = false;
+       else if (ret == IAVF_NOT_SUPPORTED)
+               ret = -ENOTSUP;
        else
                ret = -EAGAIN;
 
@@ -1012,9 +1017,6 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
        old_addr = (struct rte_ether_addr *)hw->mac.addr;
        perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr;
 
-       if (rte_is_same_ether_addr(mac_addr, old_addr))
-               return 0;
-
        /* If the MAC address is configured by host, skip the setting */
        if (rte_is_valid_assigned_ether_addr(perm_addr))
                return -EPERM;
@@ -1283,6 +1285,8 @@ iavf_init_vf(struct rte_eth_dev *dev)
                }
        }
 
+       vf->vf_reset = false;
+
        return 0;
 err_rss:
        rte_free(vf->rss_key);
@@ -1378,6 +1382,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 
        /* assign ops func pointer */
        eth_dev->dev_ops = &iavf_eth_dev_ops;
+       eth_dev->rx_queue_count = iavf_dev_rxq_count;
+       eth_dev->rx_descriptor_status = iavf_dev_rx_desc_status;
+       eth_dev->tx_descriptor_status = iavf_dev_tx_desc_status;
        eth_dev->rx_pkt_burst = &iavf_recv_pkts;
        eth_dev->tx_pkt_burst = &iavf_xmit_pkts;
        eth_dev->tx_pkt_prepare = &iavf_prep_pkts;
@@ -1456,7 +1463,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
        return 0;
 }
 
-static void
+static int
 iavf_dev_close(struct rte_eth_dev *dev)
 {
        struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1499,6 +1506,8 @@ iavf_dev_close(struct rte_eth_dev *dev)
 
        rte_free(vf->aq_resp);
        vf->aq_resp = NULL;
+
+       return 0;
 }
 
 static int