net/ice: fix fast mbuf freeing
[dpdk.git] / drivers / net / i40e / i40e_rxtx.c
index 804fce8..02cf5e7 100644 (file)
@@ -169,7 +169,7 @@ i40e_rxd_error_to_pkt_flags(uint64_t qword)
                flags |= PKT_RX_L4_CKSUM_GOOD;
 
        if (unlikely(error_bits & (1 << I40E_RX_DESC_ERROR_EIPE_SHIFT)))
-               flags |= PKT_RX_EIP_CKSUM_BAD;
+               flags |= PKT_RX_OUTER_IP_CKSUM_BAD;
 
        return flags;
 }
@@ -372,9 +372,9 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
        if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
                        rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
                        rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
-               PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
-                       "(port=%d queue=%d)", desc_to_clean_to,
-                               txq->port_id, txq->queue_id);
+               PMD_TX_LOG(DEBUG, "TX descriptor %4u is not done "
+                          "(port=%d queue=%d)", desc_to_clean_to,
+                          txq->port_id, txq->queue_id);
                return -1;
        }
 
@@ -1253,10 +1253,10 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
 
                if (txq->nb_tx_used >= txq->tx_rs_thresh) {
-                       PMD_TX_FREE_LOG(DEBUG,
-                                       "Setting RS bit on TXD id="
-                                       "%4u (port=%d queue=%d)",
-                                       tx_last, txq->port_id, txq->queue_id);
+                       PMD_TX_LOG(DEBUG,
+                                  "Setting RS bit on TXD id="
+                                  "%4u (port=%d queue=%d)",
+                                  tx_last, txq->port_id, txq->queue_id);
 
                        td_cmd |= I40E_TX_DESC_CMD_RS;
 
@@ -1479,6 +1479,43 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
        return nb_tx;
 }
 
+/*********************************************************************
+ *
+ *  TX simple prep functions
+ *
+ **********************************************************************/
+uint16_t
+i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
+                     uint16_t nb_pkts)
+{
+       int i;
+       uint64_t ol_flags;
+       struct rte_mbuf *m;
+
+       for (i = 0; i < nb_pkts; i++) {
+               m = tx_pkts[i];
+               ol_flags = m->ol_flags;
+
+               if (m->nb_segs != 1) {
+                       rte_errno = EINVAL;
+                       return i;
+               }
+
+               if (ol_flags & PKT_TX_OFFLOAD_MASK) {
+                       rte_errno = ENOTSUP;
+                       return i;
+               }
+
+               /* check the size of packet */
+               if (m->pkt_len < I40E_TX_MIN_PKT_LEN ||
+                   m->pkt_len > I40E_FRAME_SIZE_MAX) {
+                       rte_errno = EINVAL;
+                       return i;
+               }
+       }
+       return i;
+}
+
 /*********************************************************************
  *
  *  TX prep functions
@@ -1525,7 +1562,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
                        return i;
                }
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#ifdef RTE_ETHDEV_DEBUG_TX
                ret = rte_validate_tx_offload(m);
                if (ret != 0) {
                        rte_errno = -ret;
@@ -2216,8 +2253,6 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
        if (hw->mac.type == I40E_MAC_VF || hw->mac.type == I40E_MAC_X722_VF) {
                vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
                vsi = &vf->vsi;
-               if (!vsi)
-                       return -EINVAL;
                reg_idx = queue_idx;
        } else {
                pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3412,7 +3447,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
                        PMD_INIT_LOG(DEBUG, "Simple tx finally be used.");
                        dev->tx_pkt_burst = i40e_xmit_pkts_simple;
                }
-               dev->tx_pkt_prepare = NULL;
+               dev->tx_pkt_prepare = i40e_simple_prep_pkts;
        } else {
                PMD_INIT_LOG(DEBUG, "Xmit tx finally be used.");
                dev->tx_pkt_burst = i40e_xmit_pkts;