net/sfc: move datapath RxQ handle to shared RxQ info
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 7 Feb 2019 12:17:34 +0000 (12:17 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 7 Feb 2019 15:06:30 +0000 (16:06 +0100)
If datapath supports multi-process, it should be possible to get
its RxQ structure by the queue index.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/sfc_ethdev.c
drivers/net/sfc/sfc_rx.c
drivers/net/sfc/sfc_rx.h

index 7118d22..71be88f 100644 (file)
@@ -415,7 +415,7 @@ sfc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
        if (rc != 0)
                goto fail_rx_qinit;
 
-       dev->data->rx_queues[rx_queue_id] = sa->rxq_info[rx_queue_id].rxq->dp;
+       dev->data->rx_queues[rx_queue_id] = sa->rxq_info[rx_queue_id].dp;
 
        sfc_adapter_unlock(sa);
 
@@ -1123,16 +1123,14 @@ sfc_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev);
        struct sfc_adapter *sa = dev->data->dev_private;
        struct sfc_rxq_info *rxq_info;
-       struct sfc_rxq *rxq;
 
        SFC_ASSERT(rx_queue_id < sa->rxq_count);
        rxq_info = &sa->rxq_info[rx_queue_id];
-       rxq = rxq_info->rxq;
 
-       if (rxq == NULL || (rxq_info->state & SFC_RXQ_STARTED) == 0)
+       if ((rxq_info->state & SFC_RXQ_STARTED) == 0)
                return 0;
 
-       return sap->dp_rx->qdesc_npending(rxq->dp);
+       return sap->dp_rx->qdesc_npending(rxq_info->dp);
 }
 
 static int
index 130270d..886a7a2 100644 (file)
@@ -590,7 +590,7 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
                        sfc_notice(sa, "RxQ %u flushed", sw_index);
        }
 
-       sa->priv.dp_rx->qpurge(rxq->dp);
+       sa->priv.dp_rx->qpurge(rxq_info->dp);
 }
 
 static int
@@ -704,7 +704,7 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 
        efx_rx_qenable(rxq->common);
 
-       rc = sa->priv.dp_rx->qstart(rxq->dp, evq->read_ptr);
+       rc = sa->priv.dp_rx->qstart(rxq_info->dp, evq->read_ptr);
        if (rc != 0)
                goto fail_dp_qstart;
 
@@ -723,7 +723,7 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
        return 0;
 
 fail_mac_filter_default_rxq_set:
-       sa->priv.dp_rx->qstop(rxq->dp, &rxq->evq->read_ptr);
+       sa->priv.dp_rx->qstop(rxq_info->dp, &rxq->evq->read_ptr);
 
 fail_dp_qstart:
        sfc_rx_qflush(sa, sw_index);
@@ -758,7 +758,7 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
        sa->eth_dev->data->rx_queue_state[sw_index] =
                RTE_ETH_QUEUE_STATE_STOPPED;
 
-       sa->priv.dp_rx->qstop(rxq->dp, &rxq->evq->read_ptr);
+       sa->priv.dp_rx->qstop(rxq_info->dp, &rxq->evq->read_ptr);
 
        if (sw_index == 0)
                efx_mac_filter_default_rxq_clear(sa->nic);
@@ -1051,11 +1051,11 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 
        rc = sa->priv.dp_rx->qcreate(sa->eth_dev->data->port_id, sw_index,
                                     &RTE_ETH_DEV_TO_PCI(sa->eth_dev)->addr,
-                                    socket_id, &info, &rxq->dp);
+                                    socket_id, &info, &rxq_info->dp);
        if (rc != 0)
                goto fail_dp_rx_qcreate;
 
-       evq->dp_rxq = rxq->dp;
+       evq->dp_rxq = rxq_info->dp;
 
        rxq_info->state = SFC_RXQ_INITIALIZED;
 
@@ -1096,8 +1096,8 @@ sfc_rx_qfini(struct sfc_adapter *sa, unsigned int sw_index)
        rxq = rxq_info->rxq;
        SFC_ASSERT(rxq_info->state == SFC_RXQ_INITIALIZED);
 
-       sa->priv.dp_rx->qdestroy(rxq->dp);
-       rxq->dp = NULL;
+       sa->priv.dp_rx->qdestroy(rxq_info->dp);
+       rxq_info->dp = NULL;
 
        rxq_info->rxq = NULL;
        rxq_info->entries = 0;
index be64004..9c946d7 100644 (file)
@@ -59,7 +59,6 @@ struct sfc_rxq {
        efsys_mem_t             mem;
        unsigned int            hw_index;
        uint16_t                buf_size;
-       struct sfc_dp_rxq       *dp;
 };
 
 static inline unsigned int
@@ -124,6 +123,7 @@ struct sfc_rxq_info {
        efx_rxq_type_t          type;
        unsigned int            type_flags;
        struct sfc_rxq          *rxq;
+       struct sfc_dp_rxq       *dp;
        boolean_t               deferred_start;
        boolean_t               deferred_started;
        unsigned int            refill_threshold;