mlx5: support promiscuous and allmulticast Rx modes
[dpdk.git] / drivers / net / mlx5 / mlx5_rxtx.h
index 1459317..020acf0 100644 (file)
 #include "mlx5.h"
 #include "mlx5_defs.h"
 
+struct mlx5_rxq_stats {
+       unsigned int idx; /**< Mapping index. */
+#ifdef MLX5_PMD_SOFT_COUNTERS
+       uint64_t ipackets; /**< Total of successfully received packets. */
+       uint64_t ibytes; /**< Total of successfully received bytes. */
+#endif
+       uint64_t idropped; /**< Total of packets dropped when RX ring full. */
+       uint64_t rx_nombuf; /**< Total of RX mbuf allocation failures. */
+};
+
+struct mlx5_txq_stats {
+       unsigned int idx; /**< Mapping index. */
+#ifdef MLX5_PMD_SOFT_COUNTERS
+       uint64_t opackets; /**< Total of successfully sent packets. */
+       uint64_t obytes; /**< Total of successfully sent bytes. */
+#endif
+       uint64_t odropped; /**< Total of packets not sent when TX ring full. */
+};
+
+/* RX element (scattered packets). */
+struct rxq_elt_sp {
+       struct ibv_recv_wr wr; /* Work Request. */
+       struct ibv_sge sges[MLX5_PMD_SGE_WR_N]; /* Scatter/Gather Elements. */
+       struct rte_mbuf *bufs[MLX5_PMD_SGE_WR_N]; /* SGEs buffers. */
+};
+
 /* RX element. */
 struct rxq_elt {
        struct ibv_recv_wr wr; /* Work Request. */
@@ -78,13 +104,20 @@ struct rxq {
        struct ibv_qp *qp; /* Queue Pair. */
        struct ibv_exp_qp_burst_family *if_qp; /* QP burst interface. */
        struct ibv_exp_cq_family *if_cq; /* CQ interface. */
+       /* MAC flow steering rules. */
+       struct ibv_flow *mac_flow[MLX5_MAX_MAC_ADDRESSES];
+       struct ibv_flow *promisc_flow; /* Promiscuous flow. */
+       struct ibv_flow *allmulti_flow; /* Multicast flow. */
        unsigned int port_id; /* Port ID for incoming packets. */
        unsigned int elts_n; /* (*elts)[] length. */
        unsigned int elts_head; /* Current index in (*elts)[]. */
        union {
+               struct rxq_elt_sp (*sp)[]; /* Scattered RX elements. */
                struct rxq_elt (*no_sp)[]; /* RX elements. */
        } elts;
+       unsigned int sp:1; /* Use scattered RX elements. */
        uint32_t mb_len; /* Length of a mp-issued mbuf. */
+       struct mlx5_rxq_stats stats; /* RX queue counters. */
        unsigned int socket; /* CPU socket ID for allocations. */
        struct ibv_exp_res_domain *rd; /* Resource Domain. */
 };
@@ -124,6 +157,7 @@ struct txq {
        unsigned int elts_comp; /* Number of completion requests. */
        unsigned int elts_comp_cd; /* Countdown for next completion request. */
        unsigned int elts_comp_cd_init; /* Initial value for countdown. */
+       struct mlx5_txq_stats stats; /* TX queue counters. */
        linear_t (*elts_linear)[]; /* Linearized buffers. */
        struct ibv_mr *mr_linear; /* Memory Region for linearized buffers. */
        unsigned int socket; /* CPU socket ID for allocations. */
@@ -133,6 +167,7 @@ struct txq {
 /* mlx5_rxq.c */
 
 void rxq_cleanup(struct rxq *);
+int rxq_rehash(struct rte_eth_dev *, struct rxq *);
 int rxq_setup(struct rte_eth_dev *, struct rxq *, uint16_t, unsigned int,
              const struct rte_eth_rxconf *, struct rte_mempool *);
 int mlx5_rx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
@@ -149,6 +184,7 @@ void mlx5_tx_queue_release(void *);
 /* mlx5_rxtx.c */
 
 uint16_t mlx5_tx_burst(void *, struct rte_mbuf **, uint16_t);
+uint16_t mlx5_rx_burst_sp(void *, struct rte_mbuf **, uint16_t);
 uint16_t mlx5_rx_burst(void *, struct rte_mbuf **, uint16_t);
 uint16_t removed_tx_burst(void *, struct rte_mbuf **, uint16_t);
 uint16_t removed_rx_burst(void *, struct rte_mbuf **, uint16_t);