net/mlx5: force inline for completion function
[dpdk.git] / drivers / net / mlx5 / mlx5_rxtx.c
index 4132fd7..5c39cbb 100644 (file)
@@ -152,6 +152,9 @@ check_cqe64(volatile struct mlx5_cqe64 *cqe,
        return 0;
 }
 
+static inline void
+txq_complete(struct txq *txq) __attribute__((always_inline));
+
 /**
  * Manage TX completions.
  *
@@ -160,7 +163,7 @@ check_cqe64(volatile struct mlx5_cqe64 *cqe,
  * @param txq
  *   Pointer to TX queue structure.
  */
-static void
+static inline void
 txq_complete(struct txq *txq)
 {
        const unsigned int elts_n = txq->elts_n;
@@ -472,8 +475,8 @@ mlx5_wqe_write_inline_vlan(struct txq *txq, volatile union mlx5_wqe *wqe,
                   (uint8_t *)addr, 12);
        rte_memcpy((uint8_t *)(uintptr_t)wqe->inl.eseg.inline_hdr_start + 12,
                   &vlan, sizeof(vlan));
-       rte_memcpy((uint8_t *)(uintptr_t)wqe->inl.eseg.inline_hdr_start + 16,
-                  ((uint8_t *)addr + 12), 2);
+       rte_memcpy((uint8_t *)((uintptr_t)wqe->inl.eseg.inline_hdr_start + 16),
+                  (uint8_t *)(addr + 12), 2);
        addr += MLX5_ETH_VLAN_INLINE_HEADER_SIZE - sizeof(vlan);
        length -= MLX5_ETH_VLAN_INLINE_HEADER_SIZE - sizeof(vlan);
        size = (sizeof(wqe->inl.ctrl.ctrl) +
@@ -1572,13 +1575,21 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                rte_prefetch0(wqe);
                rep = rte_mbuf_raw_alloc(rxq->mp);
                if (unlikely(rep == NULL)) {
-                       while (pkt) {
+                       ++rxq->stats.rx_nombuf;
+                       if (!pkt) {
+                               /*
+                                * no buffers before we even started,
+                                * bail out silently.
+                                */
+                               break;
+                       }
+                       while (pkt != seg) {
+                               assert(pkt != (*rxq->elts)[idx]);
                                seg = NEXT(pkt);
                                rte_mbuf_refcnt_set(pkt, 0);
                                __rte_mbuf_raw_free(pkt);
                                pkt = seg;
                        }
-                       ++rxq->stats.rx_nombuf;
                        break;
                }
                if (!pkt) {