net/i40e: optimize flow director update rate
[dpdk.git] / drivers / net / enic / enic_rxtx.c
index 5189ee6..6a8718c 100644 (file)
@@ -329,7 +329,8 @@ enic_noscatter_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
        return rx - rx_pkts;
 }
 
-static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
+static inline void enic_free_wq_bufs(struct vnic_wq *wq,
+                                    uint16_t completed_index)
 {
        struct rte_mbuf *buf;
        struct rte_mbuf *m, *free[ENIC_MAX_WQ_DESCS];
@@ -371,7 +372,7 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
 
 unsigned int enic_cleanup_wq(__rte_unused struct enic *enic, struct vnic_wq *wq)
 {
-       u16 completed_index;
+       uint16_t completed_index;
 
        completed_index = *((uint32_t *)wq->cqmsg_rz->addr) & 0xffff;
 
@@ -393,11 +394,22 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
        for (i = 0; i != nb_pkts; i++) {
                m = tx_pkts[i];
-               if (unlikely(m->pkt_len > ENIC_TX_MAX_PKT_SIZE)) {
-                       rte_errno = EINVAL;
-                       return i;
-               }
                ol_flags = m->ol_flags;
+               if (!(ol_flags & PKT_TX_TCP_SEG)) {
+                       if (unlikely(m->pkt_len > ENIC_TX_MAX_PKT_SIZE)) {
+                               rte_errno = EINVAL;
+                               return i;
+                       }
+               } else {
+                       uint16_t header_len;
+
+                       header_len = m->l2_len + m->l3_len + m->l4_len;
+                       if (m->tso_segsz + header_len > ENIC_TX_MAX_PKT_SIZE) {
+                               rte_errno = EINVAL;
+                               return i;
+                       }
+               }
+
                if (ol_flags & wq->tx_offload_notsup_mask) {
                        rte_errno = ENOTSUP;
                        return i;
@@ -405,13 +417,13 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
                ret = rte_validate_tx_offload(m);
                if (ret != 0) {
-                       rte_errno = ret;
+                       rte_errno = -ret;
                        return i;
                }
 #endif
                ret = rte_net_intel_cksum_prepare(m);
                if (ret != 0) {
-                       rte_errno = ret;
+                       rte_errno = -ret;
                        return i;
                }
        }