net/mlx5: rearrange probing functions for Windows
[dpdk.git] / drivers / net / mlx5 / mlx5_tx.h
index 7d3ff84..e722738 100644 (file)
@@ -204,7 +204,7 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 int mlx5_tx_hairpin_queue_setup
        (struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
         const struct rte_eth_hairpin_conf *hairpin_conf);
-void mlx5_tx_queue_release(void *dpdk_txq);
+void mlx5_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl);
 int mlx5_tx_uar_init_secondary(struct rte_eth_dev *dev, int fd);
 void mlx5_tx_uar_uninit_secondary(struct rte_eth_dev *dev);
@@ -953,7 +953,8 @@ mlx5_tx_eseg_none(struct mlx5_txq_data *__rte_restrict txq __rte_unused,
        /* Fill metadata field if needed. */
        es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
                       loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
-                      *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
+                      rte_cpu_to_be_32(*RTE_FLOW_DYNF_METADATA(loc->mbuf)) :
+                      0 : 0;
        /* Engage VLAN tag insertion feature if requested. */
        if (MLX5_TXOFF_CONFIG(VLAN) &&
            loc->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
@@ -1013,7 +1014,8 @@ mlx5_tx_eseg_dmin(struct mlx5_txq_data *__rte_restrict txq __rte_unused,
        /* Fill metadata field if needed. */
        es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
                       loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
-                      *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
+                      rte_cpu_to_be_32(*RTE_FLOW_DYNF_METADATA(loc->mbuf)) :
+                      0 : 0;
        psrc = rte_pktmbuf_mtod(loc->mbuf, uint8_t *);
        es->inline_hdr_sz = RTE_BE16(MLX5_ESEG_MIN_INLINE_SIZE);
        es->inline_data = *(unaligned_uint16_t *)psrc;
@@ -1096,7 +1098,8 @@ mlx5_tx_eseg_data(struct mlx5_txq_data *__rte_restrict txq,
        /* Fill metadata field if needed. */
        es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
                       loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
-                      *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
+                      rte_cpu_to_be_32(*RTE_FLOW_DYNF_METADATA(loc->mbuf)) :
+                      0 : 0;
        psrc = rte_pktmbuf_mtod(loc->mbuf, uint8_t *);
        es->inline_hdr_sz = rte_cpu_to_be_16(inlen);
        es->inline_data = *(unaligned_uint16_t *)psrc;
@@ -1308,7 +1311,8 @@ mlx5_tx_eseg_mdat(struct mlx5_txq_data *__rte_restrict txq,
        /* Fill metadata field if needed. */
        es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
                       loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
-                      *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
+                      rte_cpu_to_be_32(*RTE_FLOW_DYNF_METADATA(loc->mbuf)) :
+                      0 : 0;
        MLX5_ASSERT(inlen >= MLX5_ESEG_MIN_INLINE_SIZE);
        pdst = (uint8_t *)&es->inline_data;
        if (MLX5_TXOFF_CONFIG(VLAN) && vlan) {
@@ -1338,7 +1342,8 @@ mlx5_tx_eseg_mdat(struct mlx5_txq_data *__rte_restrict txq,
                 * Copying may be interrupted inside the routine
                 * if run into no inline hint flag.
                 */
-               copy = tlen >= txq->inlen_mode ? 0 : (txq->inlen_mode - tlen);
+               copy = tso ? inlen : txq->inlen_mode;
+               copy = tlen >= copy ? 0 : (copy - tlen);
                copy = mlx5_tx_mseg_memcpy(pdst, loc, part, copy, olx);
                tlen += copy;
                if (likely(inlen <= tlen) || copy < part) {
@@ -2040,6 +2045,8 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq,
                unsigned int nxlen;
                uintptr_t start;
 
+               mbuf = loc->mbuf;
+               nxlen = rte_pktmbuf_data_len(mbuf);
                /*
                 * Packet length exceeds the allowed inline data length,
                 * check whether the minimal inlining is required.
@@ -2049,28 +2056,23 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq,
                                    MLX5_ESEG_MIN_INLINE_SIZE);
                        MLX5_ASSERT(txq->inlen_mode <= txq->inlen_send);
                        inlen = txq->inlen_mode;
-               } else {
-                       if (loc->mbuf->ol_flags & PKT_TX_DYNF_NOINLINE ||
-                           !vlan || txq->vlan_en) {
-                               /*
-                                * VLAN insertion will be done inside by HW.
-                                * It is not utmost effective - VLAN flag is
-                                * checked twice, but we should proceed the
-                                * inlining length correctly and take into
-                                * account the VLAN header being inserted.
-                                */
-                               return mlx5_tx_packet_multi_send
-                                                       (txq, loc, olx);
-                       }
+               } else if (vlan && !txq->vlan_en) {
+                       /*
+                        * VLAN insertion is requested and hardware does not
+                        * support the offload, will do with software inline.
+                        */
                        inlen = MLX5_ESEG_MIN_INLINE_SIZE;
+               } else if (mbuf->ol_flags & PKT_TX_DYNF_NOINLINE ||
+                          nxlen > txq->inlen_send) {
+                       return mlx5_tx_packet_multi_send(txq, loc, olx);
+               } else {
+                       goto do_first;
                }
                /*
                 * Now we know the minimal amount of data is requested
                 * to inline. Check whether we should inline the buffers
                 * from the chain beginning to eliminate some mbufs.
                 */
-               mbuf = loc->mbuf;
-               nxlen = rte_pktmbuf_data_len(mbuf);
                if (unlikely(nxlen <= txq->inlen_send)) {
                        /* We can inline first mbuf at least. */
                        if (nxlen < inlen) {
@@ -2092,6 +2094,7 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq,
                                        goto do_align;
                                }
                        }
+do_first:
                        do {
                                inlen = nxlen;
                                mbuf = NEXT(mbuf);
@@ -2471,7 +2474,7 @@ mlx5_tx_match_empw(struct mlx5_txq_data *__rte_restrict txq,
        /* Fill metadata field if needed. */
        if (MLX5_TXOFF_CONFIG(METADATA) &&
                es->metadata != (loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
-                                *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0))
+               rte_cpu_to_be_32(*RTE_FLOW_DYNF_METADATA(loc->mbuf)) : 0))
                return false;
        /* Legacy MPW can send packets with the same length only. */
        if (MLX5_TXOFF_CONFIG(MPW) &&