net: add rte prefix to ether defines
[dpdk.git] / drivers / net / netvsc / hn_rxtx.c
index 7856f7e..7212780 100644 (file)
@@ -100,7 +100,7 @@ struct hn_txdesc {
 
 /* Minimum space required for a packet */
 #define HN_PKTSIZE_MIN(align) \
-       RTE_ALIGN(ETHER_MIN_LEN + HN_RNDIS_PKT_LEN, align)
+       RTE_ALIGN(RTE_ETHER_MIN_LEN + HN_RNDIS_PKT_LEN, align)
 
 #define DEFAULT_TX_FREE_THRESH 32U
 
@@ -108,7 +108,7 @@ static void
 hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m)
 {
        uint32_t s = m->pkt_len;
-       const struct ether_addr *ea;
+       const struct rte_ether_addr *ea;
 
        if (s == 64) {
                stats->size_bins[1]++;
@@ -127,9 +127,9 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m)
                        stats->size_bins[7]++;
        }
 
-       ea = rte_pktmbuf_mtod(m, const struct ether_addr *);
-       if (is_multicast_ether_addr(ea)) {
-               if (is_broadcast_ether_addr(ea))
+       ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *);
+       if (rte_is_multicast_ether_addr(ea)) {
+               if (rte_is_broadcast_ether_addr(ea))
                        stats->broadcast++;
                else
                        stats->multicast++;
@@ -606,7 +606,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq,
        if (unlikely(data_off + data_len > pkt->len))
                goto error;
 
-       if (unlikely(data_len < ETHER_HDR_LEN))
+       if (unlikely(data_len < RTE_ETHER_HDR_LEN))
                goto error;
 
        hn_rxpkt(rxq, rxb, data, data_off, data_len, &info);
@@ -840,12 +840,9 @@ fail:
        return error;
 }
 
-void
-hn_dev_rx_queue_release(void *arg)
+static void
+hn_rx_queue_free(struct hn_rx_queue *rxq, bool keep_primary)
 {
-       struct hn_rx_queue *rxq = arg;
-
-       PMD_INIT_FUNC_TRACE();
 
        if (!rxq)
                return;
@@ -857,10 +854,21 @@ hn_dev_rx_queue_release(void *arg)
        hn_vf_rx_queue_release(rxq->hv, rxq->queue_id);
 
        /* Keep primary queue to allow for control operations */
-       if (rxq != rxq->hv->primary) {
-               rte_free(rxq->event_buf);
-               rte_free(rxq);
-       }
+       if (keep_primary && rxq == rxq->hv->primary)
+               return;
+
+       rte_free(rxq->event_buf);
+       rte_free(rxq);
+}
+
+void
+hn_dev_rx_queue_release(void *arg)
+{
+       struct hn_rx_queue *rxq = arg;
+
+       PMD_INIT_FUNC_TRACE();
+
+       hn_rx_queue_free(rxq, true);
 }
 
 int
@@ -1440,3 +1448,23 @@ hn_recv_pkts(void *prxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
        return nb_rcv;
 }
+
+void
+hn_dev_free_queues(struct rte_eth_dev *dev)
+{
+       unsigned int i;
+
+       for (i = 0; i < dev->data->nb_rx_queues; i++) {
+               struct hn_rx_queue *rxq = dev->data->rx_queues[i];
+
+               hn_rx_queue_free(rxq, false);
+               dev->data->rx_queues[i] = NULL;
+       }
+       dev->data->nb_rx_queues = 0;
+
+       for (i = 0; i < dev->data->nb_tx_queues; i++) {
+               hn_dev_tx_queue_release(dev->data->tx_queues[i]);
+               dev->data->tx_queues[i] = NULL;
+       }
+       dev->data->nb_tx_queues = 0;
+}