net/ice: use dynamic log type for Tx/Rx debug
[dpdk.git] / drivers / net / iavf / iavf_rxtx.c
index db7070f..22d7bb6 100644 (file)
@@ -144,7 +144,8 @@ check_rx_bulk_allow(struct iavf_rx_queue *rxq)
 static inline void
 reset_rx_queue(struct iavf_rx_queue *rxq)
 {
-       uint16_t len, i;
+       uint16_t len;
+       uint32_t i;
 
        if (!rxq)
                return;
@@ -174,7 +175,8 @@ static inline void
 reset_tx_queue(struct iavf_tx_queue *txq)
 {
        struct iavf_tx_entry *txe;
-       uint16_t i, prev, size;
+       uint32_t i, size;
+       uint16_t prev;
 
        if (!txq) {
                PMD_DRV_LOG(DEBUG, "Pointer to txq is NULL");
@@ -1025,17 +1027,17 @@ iavf_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                 */
                rxm->next = NULL;
                if (unlikely(rxq->crc_len > 0)) {
-                       first_seg->pkt_len -= ETHER_CRC_LEN;
-                       if (rx_packet_len <= ETHER_CRC_LEN) {
+                       first_seg->pkt_len -= RTE_ETHER_CRC_LEN;
+                       if (rx_packet_len <= RTE_ETHER_CRC_LEN) {
                                rte_pktmbuf_free_seg(rxm);
                                first_seg->nb_segs--;
                                last_seg->data_len =
                                        (uint16_t)(last_seg->data_len -
-                                       (ETHER_CRC_LEN - rx_packet_len));
+                                       (RTE_ETHER_CRC_LEN - rx_packet_len));
                                last_seg->next = NULL;
                        } else
                                rxm->data_len = (uint16_t)(rx_packet_len -
-                                                               ETHER_CRC_LEN);
+                                                       RTE_ETHER_CRC_LEN);
                }
 
                first_seg->port = rxq->port_id;
@@ -1417,17 +1419,17 @@ iavf_txd_enable_checksum(uint64_t ol_flags,
        switch (ol_flags & PKT_TX_L4_MASK) {
        case PKT_TX_TCP_CKSUM:
                *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP;
-               *td_offset |= (sizeof(struct tcp_hdr) >> 2) <<
+               *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
                              IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
                break;
        case PKT_TX_SCTP_CKSUM:
                *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP;
-               *td_offset |= (sizeof(struct sctp_hdr) >> 2) <<
+               *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
                              IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
                break;
        case PKT_TX_UDP_CKSUM:
                *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP;
-               *td_offset |= (sizeof(struct udp_hdr) >> 2) <<
+               *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
                              IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
                break;
        default:
@@ -1449,9 +1451,6 @@ iavf_set_tso_ctx(struct rte_mbuf *mbuf, union iavf_tx_offload tx_offload)
                return ctx_desc;
        }
 
-       /* in case of non tunneling packet, the outer_l2_len and
-        * outer_l3_len must be 0.
-        */
        hdr_len = tx_offload.l2_len +
                  tx_offload.l3_len +
                  tx_offload.l4_len;
@@ -1583,6 +1582,9 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                        /* Setup TX context descriptor if required */
                        uint64_t cd_type_cmd_tso_mss =
                                IAVF_TX_DESC_DTYPE_CONTEXT;
+                       volatile struct iavf_tx_context_desc *ctx_txd =
+                               (volatile struct iavf_tx_context_desc *)
+                                                       &txr[tx_id];
 
                        txn = &sw_ring[txe->next_id];
                        RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
@@ -1596,6 +1598,9 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                                cd_type_cmd_tso_mss |=
                                        iavf_set_tso_ctx(tx_pkt, tx_offload);
 
+                       ctx_txd->type_cmd_tso_mss =
+                               rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+
                        IAVF_DUMP_TX_DESC(txq, &txr[tx_id], tx_id);
                        txe->last_id = tx_last;
                        tx_id = txe->next_id;
@@ -1698,31 +1703,31 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
                /* Check condition for nb_segs > IAVF_TX_MAX_MTU_SEG. */
                if (!(ol_flags & PKT_TX_TCP_SEG)) {
                        if (m->nb_segs > IAVF_TX_MAX_MTU_SEG) {
-                               rte_errno = -EINVAL;
+                               rte_errno = EINVAL;
                                return i;
                        }
                } else if ((m->tso_segsz < IAVF_MIN_TSO_MSS) ||
                           (m->tso_segsz > IAVF_MAX_TSO_MSS)) {
                        /* MSS outside the range are considered malicious */
-                       rte_errno = -EINVAL;
+                       rte_errno = EINVAL;
                        return i;
                }
 
                if (ol_flags & IAVF_TX_OFFLOAD_NOTSUP_MASK) {
-                       rte_errno = -ENOTSUP;
+                       rte_errno = ENOTSUP;
                        return i;
                }
 
 #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;
                }
        }