net/bnxt: add Tx TruFlow table config for P4 device
[dpdk.git] / drivers / net / af_packet / rte_eth_af_packet.c
index 77b3e94..1396f32 100644 (file)
@@ -149,7 +149,7 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
                /* check for vlan info */
                if (ppd->tp_status & TP_STATUS_VLAN_VALID) {
                        mbuf->vlan_tci = ppd->tp_vlan_tci;
-                       mbuf->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
+                       mbuf->ol_flags |= (RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED);
 
                        if (!pkt_q->vlan_strip && rte_vlan_insert(&mbuf))
                                PMD_LOG(ERR, "Failed to reinsert VLAN tag");
@@ -229,7 +229,7 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
                }
 
                /* insert vlan info if necessary */
-               if (mbuf->ol_flags & PKT_TX_VLAN) {
+               if (mbuf->ol_flags & RTE_MBUF_F_TX_VLAN) {
                        if (rte_vlan_insert(&mbuf)) {
                                rte_pktmbuf_free(mbuf);
                                continue;
@@ -237,8 +237,30 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
                }
 
                /* point at the next incoming frame */
-               if (!tx_ring_status_available(ppd->tp_status) &&
-                   poll(&pfd, 1, -1) < 0)
+               if (!tx_ring_status_available(ppd->tp_status)) {
+                       if (poll(&pfd, 1, -1) < 0)
+                               break;
+
+                       /* poll() can return POLLERR if the interface is down */
+                       if (pfd.revents & POLLERR)
+                               break;
+               }
+
+               /*
+                * poll() will almost always return POLLOUT, even if there
+                * are no extra buffers available
+                *
+                * This happens, because packet_poll() calls datagram_poll()
+                * which checks the space left in the socket buffer and,
+                * in the case of packet_mmap, the default socket buffer length
+                * doesn't match the requested size for the tx_ring.
+                * As such, there is almost always space left in socket buffer,
+                * which doesn't seem to be correlated to the requested size
+                * for the tx_ring in packet_mmap.
+                *
+                * This results in poll() returning POLLOUT.
+                */
+               if (!tx_ring_status_available(ppd->tp_status))
                        break;
 
                /* copy the tx frame data */
@@ -342,7 +364,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
        dev_info->if_index = internals->if_index;
        dev_info->max_mac_addrs = 1;
-       dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+       dev_info->max_rx_pktlen = RTE_ETHER_MAX_LEN;
        dev_info->max_rx_queues = (uint16_t)internals->nb_queues;
        dev_info->max_tx_queues = (uint16_t)internals->nb_queues;
        dev_info->min_rx_bufsize = 0;