net/mlx4: remove Tx inline compilation option
[dpdk.git] / drivers / net / mlx4 / mlx4.c
index 6f8d328..394b87c 100644 (file)
@@ -34,7 +34,6 @@
 /*
  * Known limitations:
  * - RSS hash key and options cannot be modified.
- * - Hardware counters aren't implemented.
  */
 
 /* System headers. */
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
 #include <rte_atomic.h>
-#include <rte_version.h>
 #include <rte_log.h>
 #include <rte_alarm.h>
 #include <rte_memory.h>
 #include <rte_flow.h>
 #include <rte_kvargs.h>
 #include <rte_interrupts.h>
+#include <rte_branch_prediction.h>
 
 /* Generated configuration header. */
 #include "mlx4_autoconf.h"
@@ -1177,8 +1176,6 @@ txq_mp2mr_iter(struct rte_mempool *mp, void *arg)
        txq_mp2mr(txq, mp);
 }
 
-#if MLX4_PMD_SGE_WR_N > 1
-
 /**
  * Copy scattered mbuf contents to a single linear buffer.
  *
@@ -1325,8 +1322,6 @@ stop:
        };
 }
 
-#endif /* MLX4_PMD_SGE_WR_N > 1 */
-
 /**
  * DPDK callback for TX.
  *
@@ -1372,9 +1367,7 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                struct txq_elt *elt_next = &(*txq->elts)[elts_head_next];
                struct txq_elt *elt = &(*txq->elts)[elts_head];
                unsigned int segs = NB_SEGS(buf);
-#ifdef MLX4_PMD_SOFT_COUNTERS
                unsigned int sent_size = 0;
-#endif
                uint32_t send_flags = 0;
 
                /* Clean up old buffer. */
@@ -1435,7 +1428,6 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                              (uintptr_t)addr);
                        RTE_MBUF_PREFETCH_TO_FREE(elt_next->buf);
                        /* Put packet into send queue. */
-#if MLX4_PMD_MAX_INLINE > 0
                        if (length <= txq->max_inline)
                                err = txq->if_qp->send_pending_inline
                                        (txq->qp,
@@ -1443,7 +1435,6 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                         length,
                                         send_flags);
                        else
-#endif
                                err = txq->if_qp->send_pending
                                        (txq->qp,
                                         addr,
@@ -1452,11 +1443,8 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                         send_flags);
                        if (unlikely(err))
                                goto stop;
-#ifdef MLX4_PMD_SOFT_COUNTERS
                        sent_size += length;
-#endif
                } else {
-#if MLX4_PMD_SGE_WR_N > 1
                        struct ibv_sge sges[MLX4_PMD_SGE_WR_N];
                        struct tx_burst_sg_ret ret;
 
@@ -1473,29 +1461,18 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                 send_flags);
                        if (unlikely(err))
                                goto stop;
-#ifdef MLX4_PMD_SOFT_COUNTERS
                        sent_size += ret.length;
-#endif
-#else /* MLX4_PMD_SGE_WR_N > 1 */
-                       DEBUG("%p: TX scattered buffers support not"
-                             " compiled in", (void *)txq);
-                       goto stop;
-#endif /* MLX4_PMD_SGE_WR_N > 1 */
                }
                elts_head = elts_head_next;
-#ifdef MLX4_PMD_SOFT_COUNTERS
                /* Increment sent bytes counter. */
                txq->stats.obytes += sent_size;
-#endif
        }
 stop:
        /* Take a shortcut if nothing must be sent. */
        if (unlikely(i == 0))
                return 0;
-#ifdef MLX4_PMD_SOFT_COUNTERS
        /* Increment sent packets counter. */
        txq->stats.opackets += i;
-#endif
        /* Ring QP doorbell. */
        err = txq->if_qp->send_flush(txq->qp);
        if (unlikely(err)) {
@@ -1599,9 +1576,7 @@ txq_setup(struct rte_eth_dev *dev, struct txq *txq, uint16_t desc,
                                          MLX4_PMD_SGE_WR_N) ?
                                         priv->device_attr.max_sge :
                                         MLX4_PMD_SGE_WR_N),
-#if MLX4_PMD_MAX_INLINE > 0
                        .max_inline_data = MLX4_PMD_MAX_INLINE,
-#endif
                },
                .qp_type = IBV_QPT_RAW_PACKET,
                /* Do *NOT* enable this, completions events are managed per
@@ -1619,10 +1594,8 @@ txq_setup(struct rte_eth_dev *dev, struct txq *txq, uint16_t desc,
                      (void *)dev, strerror(ret));
                goto error;
        }
-#if MLX4_PMD_MAX_INLINE > 0
        /* ibv_create_qp() updates this value. */
        tmpl.max_inline = attr.init.cap.max_inline_data;
-#endif
        attr.mod = (struct ibv_exp_qp_attr){
                /* Move the QP to this state. */
                .qp_state = IBV_QPS_INIT,
@@ -2786,10 +2759,8 @@ mlx4_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                      " completion status (%d): %s",
                                      (void *)rxq, wc.wr_id, wc.status,
                                      ibv_wc_status_str(wc.status));
-#ifdef MLX4_PMD_SOFT_COUNTERS
                                /* Increment dropped packets counter. */
                                ++rxq->stats.idropped;
-#endif
                                /* Link completed WRs together for repost. */
                                *next = wr;
                                next = &wr->next;
@@ -2901,10 +2872,8 @@ mlx4_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                /* Return packet. */
                *(pkts++) = pkt_buf;
                ++pkts_ret;
-#ifdef MLX4_PMD_SOFT_COUNTERS
                /* Increase bytes counter. */
                rxq->stats.ibytes += pkt_buf_len;
-#endif
 repost:
                if (++elts_head >= elts_n)
                        elts_head = 0;
@@ -2924,10 +2893,8 @@ repost:
                abort();
        }
        rxq->elts_head = elts_head;
-#ifdef MLX4_PMD_SOFT_COUNTERS
        /* Increase packets counter. */
        rxq->stats.ipackets += pkts_ret;
-#endif
        return pkts_ret;
 }
 
@@ -3008,10 +2975,8 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                      " completion status (%d): %s",
                                      (void *)rxq, wc.wr_id, wc.status,
                                      ibv_wc_status_str(wc.status));
-#ifdef MLX4_PMD_SOFT_COUNTERS
                                /* Increment dropped packets counter. */
                                ++rxq->stats.idropped;
-#endif
                                /* Add SGE to array for repost. */
                                sges[i] = elt->sge;
                                goto repost;
@@ -3062,10 +3027,8 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                /* Return packet. */
                *(pkts++) = seg;
                ++pkts_ret;
-#ifdef MLX4_PMD_SOFT_COUNTERS
                /* Increase bytes counter. */
                rxq->stats.ibytes += len;
-#endif
 repost:
                if (++elts_head >= elts_n)
                        elts_head = 0;
@@ -3083,10 +3046,8 @@ repost:
                abort();
        }
        rxq->elts_head = elts_head;
-#ifdef MLX4_PMD_SOFT_COUNTERS
        /* Increase packets counter. */
        rxq->stats.ipackets += pkts_ret;
-#endif
        return pkts_ret;
 }
 
@@ -4270,17 +4231,13 @@ mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
                        continue;
                idx = rxq->stats.idx;
                if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
-#ifdef MLX4_PMD_SOFT_COUNTERS
                        tmp.q_ipackets[idx] += rxq->stats.ipackets;
                        tmp.q_ibytes[idx] += rxq->stats.ibytes;
-#endif
                        tmp.q_errors[idx] += (rxq->stats.idropped +
                                              rxq->stats.rx_nombuf);
                }
-#ifdef MLX4_PMD_SOFT_COUNTERS
                tmp.ipackets += rxq->stats.ipackets;
                tmp.ibytes += rxq->stats.ibytes;
-#endif
                tmp.ierrors += rxq->stats.idropped;
                tmp.rx_nombuf += rxq->stats.rx_nombuf;
        }
@@ -4291,21 +4248,14 @@ mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
                        continue;
                idx = txq->stats.idx;
                if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
-#ifdef MLX4_PMD_SOFT_COUNTERS
                        tmp.q_opackets[idx] += txq->stats.opackets;
                        tmp.q_obytes[idx] += txq->stats.obytes;
-#endif
                        tmp.q_errors[idx] += txq->stats.odropped;
                }
-#ifdef MLX4_PMD_SOFT_COUNTERS
                tmp.opackets += txq->stats.opackets;
                tmp.obytes += txq->stats.obytes;
-#endif
                tmp.oerrors += txq->stats.odropped;
        }
-#ifndef MLX4_PMD_SOFT_COUNTERS
-       /* FIXME: retrieve and add hardware counters. */
-#endif
        *stats = tmp;
        priv_unlock(priv);
 }
@@ -4340,9 +4290,6 @@ mlx4_stats_reset(struct rte_eth_dev *dev)
                (*priv->txqs)[i]->stats =
                        (struct mlx4_txq_stats){ .idx = idx };
        }
-#ifndef MLX4_PMD_SOFT_COUNTERS
-       /* FIXME: reset hardware counters. */
-#endif
        priv_unlock(priv);
 }
 
@@ -4649,10 +4596,6 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
        return -1;
 }
 
-static int
-mlx4_ibv_device_to_pci_addr(const struct ibv_device *device,
-                           struct rte_pci_addr *pci_addr);
-
 /**
  * DPDK callback to change the MTU.
  *
@@ -4998,10 +4941,6 @@ mlx4_dev_filter_ctrl(struct rte_eth_dev *dev,
                        return -EINVAL;
                *(const void **)arg = &mlx4_flow_ops;
                return 0;
-       case RTE_ETH_FILTER_FDIR:
-               DEBUG("%p: filter type FDIR is not supported by this PMD",
-                     (void *)dev);
-               break;
        default:
                ERROR("%p: filter type (%d) not supported",
                      (void *)dev, filter_type);
@@ -5024,22 +4963,15 @@ static const struct eth_dev_ops mlx4_dev_ops = {
        .link_update = mlx4_link_update,
        .stats_get = mlx4_stats_get,
        .stats_reset = mlx4_stats_reset,
-       .queue_stats_mapping_set = NULL,
        .dev_infos_get = mlx4_dev_infos_get,
        .dev_supported_ptypes_get = mlx4_dev_supported_ptypes_get,
        .vlan_filter_set = mlx4_vlan_filter_set,
-       .vlan_tpid_set = NULL,
-       .vlan_strip_queue_set = NULL,
-       .vlan_offload_set = NULL,
        .rx_queue_setup = mlx4_rx_queue_setup,
        .tx_queue_setup = mlx4_tx_queue_setup,
        .rx_queue_release = mlx4_rx_queue_release,
        .tx_queue_release = mlx4_tx_queue_release,
-       .dev_led_on = NULL,
-       .dev_led_off = NULL,
        .flow_ctrl_get = mlx4_dev_get_flow_ctrl,
        .flow_ctrl_set = mlx4_dev_set_flow_ctrl,
-       .priority_flow_ctrl_set = NULL,
        .mac_addr_remove = mlx4_mac_addr_remove,
        .mac_addr_add = mlx4_mac_addr_add,
        .mac_addr_set = mlx4_mac_addr_set,