net: add rte prefix to IP defines
[dpdk.git] / drivers / net / ixgbe / ixgbe_rxtx.c
index e71d3c1..18938fc 100644 (file)
@@ -2029,7 +2029,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,
                struct ixgbe_rx_entry *next_rxe = NULL;
                struct rte_mbuf *first_seg;
                struct rte_mbuf *rxm;
-               struct rte_mbuf *nmb;
+               struct rte_mbuf *nmb = NULL;
                union ixgbe_adv_rx_desc rxd;
                uint16_t data_len;
                uint16_t next_id;
@@ -2496,14 +2496,29 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
         *  tx_rs_thresh must be a divisor of the ring size.
         *  tx_free_thresh must be greater than 0.
         *  tx_free_thresh must be less than the size of the ring minus 3.
+        *  tx_free_thresh + tx_rs_thresh must not exceed nb_desc.
         * One descriptor in the TX ring is used as a sentinel to avoid a
         * H/W race condition, hence the maximum threshold constraints.
         * When set to zero use default values.
         */
-       tx_rs_thresh = (uint16_t)((tx_conf->tx_rs_thresh) ?
-                       tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH);
        tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
                        tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH);
+       /* force tx_rs_thresh to adapt an aggresive tx_free_thresh */
+       tx_rs_thresh = (DEFAULT_TX_RS_THRESH + tx_free_thresh > nb_desc) ?
+                       nb_desc - tx_free_thresh : DEFAULT_TX_RS_THRESH;
+       if (tx_conf->tx_rs_thresh > 0)
+               tx_rs_thresh = tx_conf->tx_rs_thresh;
+       if (tx_rs_thresh + tx_free_thresh > nb_desc) {
+               PMD_INIT_LOG(ERR, "tx_rs_thresh + tx_free_thresh must not "
+                            "exceed nb_desc. (tx_rs_thresh=%u "
+                            "tx_free_thresh=%u nb_desc=%u port = %d queue=%d)",
+                            (unsigned int)tx_rs_thresh,
+                            (unsigned int)tx_free_thresh,
+                            (unsigned int)nb_desc,
+                            (int)dev->data->port_id,
+                            (int)queue_idx);
+               return -(EINVAL);
+       }
        if (tx_rs_thresh >= (nb_desc - 2)) {
                PMD_INIT_LOG(ERR, "tx_rs_thresh must be less than the number "
                        "of TX descriptors minus 2. (tx_rs_thresh=%u "
@@ -2940,7 +2955,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
                queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
        rxq->port_id = dev->data->port_id;
        if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
-               rxq->crc_len = ETHER_CRC_LEN;
+               rxq->crc_len = RTE_ETHER_CRC_LEN;
        else
                rxq->crc_len = 0;
        rxq->drop_en = rx_conf->rx_drop_en;
@@ -3965,7 +3980,8 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
        uint16_t max[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0};
        uint8_t map[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0};
        struct ixgbe_dcb_tc_config *tc;
-       uint32_t max_frame = dev->data->mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+       uint32_t max_frame = dev->data->mtu + RTE_ETHER_HDR_LEN +
+               RTE_ETHER_CRC_LEN;
        struct ixgbe_hw *hw =
                        IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        struct ixgbe_bw_conf *bw_conf =
@@ -4537,7 +4553,7 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool)
 
        /* MAXDESC * SRRCTL.BSIZEPKT must not exceed 64 KB minus one */
        uint16_t maxdesc =
-               IPV4_MAX_PKT_LEN /
+               RTE_IPV4_MAX_PKT_LEN /
                        (mp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM);
 
        if (maxdesc >= 16)
@@ -4948,7 +4964,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
                 * call to configure.
                 */
                if (rx_conf->offloads & DEV_RX_OFFLOAD_KEEP_CRC)
-                       rxq->crc_len = ETHER_CRC_LEN;
+                       rxq->crc_len = RTE_ETHER_CRC_LEN;
                else
                        rxq->crc_len = 0;