/* 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
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]++;
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++;
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);
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;
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
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;
+}