net/sfc: support Tx descriptor status in secondary process

If Tx datapath supports multi-process, secondary process should be
able to use Tx descriptor status API.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
Andrew Rybchenko 2019-02-07 12:17:38 +00:00 committed by Ferruh Yigit
parent 42ce2521a8
commit 3cf4b9c24b
4 changed files with 28 additions and 2 deletions

View File

@ -60,6 +60,7 @@ New Features
* Added support for Rx descriptor status and related API in a secondary
process.
* Added support for Tx descriptor status API in a secondary process.
Removed Items

View File

@ -182,6 +182,9 @@ sfc_dp_find_tx_by_caps(struct sfc_dp_list *head, unsigned int avail_caps)
return (p == NULL) ? NULL : container_of(p, struct sfc_dp_tx, dp);
}
/** Get Tx datapath ops by the datapath TxQ handle */
const struct sfc_dp_tx *sfc_dp_tx_by_dp_txq(const struct sfc_dp_txq *dp_txq);
extern struct sfc_dp_tx sfc_efx_tx;
extern struct sfc_dp_tx sfc_ef10_tx;
extern struct sfc_dp_tx sfc_ef10_simple_tx;

View File

@ -1167,13 +1167,19 @@ sfc_rx_descriptor_status(void *queue, uint16_t offset)
return dp_rx->qdesc_status(dp_rxq, offset);
}
/*
* The function is used by the secondary process as well. It must not
* use any process-local pointers from the adapter data.
*/
static int
sfc_tx_descriptor_status(void *queue, uint16_t offset)
{
struct sfc_dp_txq *dp_txq = queue;
struct sfc_txq *txq = sfc_txq_by_dp_txq(dp_txq);
const struct sfc_dp_tx *dp_tx;
return txq->evq->sa->priv.dp_tx->qdesc_status(dp_txq, offset);
dp_tx = sfc_dp_tx_by_dp_txq(dp_txq);
return dp_tx->qdesc_status(dp_txq, offset);
}
static int
@ -1896,6 +1902,7 @@ static const struct eth_dev_ops sfc_eth_dev_secondary_ops = {
.rx_queue_count = sfc_rx_queue_count,
.rx_descriptor_done = sfc_rx_descriptor_done,
.rx_descriptor_status = sfc_rx_descriptor_status,
.tx_descriptor_status = sfc_tx_descriptor_status,
.rxq_info_get = sfc_rx_queue_info_get,
.txq_info_get = sfc_tx_queue_info_get,
};

View File

@ -854,6 +854,21 @@ done:
return pkts_sent;
}
const struct sfc_dp_tx *
sfc_dp_tx_by_dp_txq(const struct sfc_dp_txq *dp_txq)
{
const struct sfc_dp_queue *dpq = &dp_txq->dpq;
struct rte_eth_dev *eth_dev;
struct sfc_adapter_priv *sap;
SFC_ASSERT(rte_eth_dev_is_valid_port(dpq->port_id));
eth_dev = &rte_eth_devices[dpq->port_id];
sap = sfc_adapter_priv_by_eth_dev(eth_dev);
return sap->dp_tx;
}
struct sfc_txq_info *
sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq)
{