net/sfc: remove EvQ info array to simplify reconfigure
[dpdk.git] / drivers / net / sfc / sfc_tx.c
index adf49d3..9597029 100644 (file)
@@ -84,6 +84,13 @@ sfc_tx_qcheck_conf(struct sfc_adapter *sa, uint16_t nb_tx_desc,
                rc = EINVAL;
        }
 
+       if (((flags & ETH_TXQ_FLAGS_NOMULTSEGS) == 0) &&
+           (~sa->dp_tx->features & SFC_DP_TX_FEAT_MULTI_SEG)) {
+               sfc_err(sa, "Multi-segment is not supported by %s datapath",
+                       sa->dp_tx->dp.name);
+               rc = EINVAL;
+       }
+
        if ((flags & ETH_TXQ_FLAGS_NOVLANOFFL) == 0) {
                if (!encp->enc_hw_tx_insert_vlan_enabled) {
                        sfc_err(sa, "VLAN offload is not supported");
@@ -127,7 +134,6 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
        struct sfc_txq_info *txq_info;
        struct sfc_evq *evq;
        struct sfc_txq *txq;
-       unsigned int evq_index = sfc_evq_index_by_txq_sw_index(sa, sw_index);
        int rc = 0;
        struct sfc_dp_tx_qcreate_info info;
 
@@ -143,12 +149,11 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
        SFC_ASSERT(nb_tx_desc <= sa->txq_max_entries);
        txq_info->entries = nb_tx_desc;
 
-       rc = sfc_ev_qinit(sa, evq_index, txq_info->entries, socket_id);
+       rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_TX, sw_index,
+                         txq_info->entries, socket_id, &evq);
        if (rc != 0)
                goto fail_ev_qinit;
 
-       evq = sa->evq_info[evq_index].evq;
-
        rc = ENOMEM;
        txq = rte_zmalloc_socket("sfc-txq", sizeof(*txq), 0, socket_id);
        if (txq == NULL)
@@ -201,7 +206,7 @@ fail_dma_alloc:
        rte_free(txq);
 
 fail_txq_alloc:
-       sfc_ev_qfini(sa, evq_index);
+       sfc_ev_qfini(evq);
 
 fail_ev_qinit:
        txq_info->entries = 0;
@@ -233,6 +238,10 @@ sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index)
        txq_info->entries = 0;
 
        sfc_dma_free(sa, &txq->mem);
+
+       sfc_ev_qfini(txq->evq);
+       txq->evq = NULL;
+
        rte_free(txq);
 }
 
@@ -298,9 +307,6 @@ sfc_tx_init(struct sfc_adapter *sa)
                goto fail_tx_dma_desc_boundary;
        }
 
-       if (~sa->dp_tx->features & SFC_DP_TX_FEAT_TSO)
-               sa->tso = B_FALSE;
-
        rc = sfc_tx_check_mode(sa, &dev_conf->txmode);
        if (rc != 0)
                goto fail_check_mode;
@@ -372,7 +378,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 
        evq = txq->evq;
 
-       rc = sfc_ev_qstart(sa, evq->evq_index);
+       rc = sfc_ev_qstart(evq, sfc_evq_index_by_txq_sw_index(sa, sw_index));
        if (rc != 0)
                goto fail_ev_qstart;
 
@@ -422,7 +428,7 @@ fail_dp_qstart:
        efx_tx_qdestroy(txq->common);
 
 fail_tx_qcreate:
-       sfc_ev_qstop(sa, evq->evq_index);
+       sfc_ev_qstop(evq);
 
 fail_ev_qstart:
        return rc;
@@ -490,7 +496,7 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 
        efx_tx_qdestroy(txq->common);
 
-       sfc_ev_qstop(sa, txq->evq->evq_index);
+       sfc_ev_qstop(txq->evq);
 
        /*
         * It seems to be used by DPDK for debug purposes only ('rte_ether')
@@ -938,7 +944,8 @@ struct sfc_dp_tx sfc_efx_tx = {
                .hw_fw_caps     = 0,
        },
        .features               = SFC_DP_TX_FEAT_VLAN_INSERT |
-                                 SFC_DP_TX_FEAT_TSO,
+                                 SFC_DP_TX_FEAT_TSO |
+                                 SFC_DP_TX_FEAT_MULTI_SEG,
        .qcreate                = sfc_efx_tx_qcreate,
        .qdestroy               = sfc_efx_tx_qdestroy,
        .qstart                 = sfc_efx_tx_qstart,