[dpdk-dev] [PATCH 2/7] ethdev: move inline device operations

Ferruh Yigit ferruh.yigit at intel.com
Mon Aug 31 14:25:27 CEST 2020


On 8/29/2020 12:57 PM, Andrew Rybchenko wrote:
> On 8/24/20 12:40 PM, Ferruh Yigit wrote:
>> This patch is a preparation to hide the 'struct eth_dev_ops' from
>> applications by moving some device operations from 'struct eth_dev_ops'
>> to 'struct rte_eth_dev'.
>>
>> Mentioned ethdev APIs are in the data path and implemented as inline
>> because of performance reasons.
>>
>> Exposing 'struct eth_dev_ops' to applications is bad because it is a
>> contract between ethdev and PMDs, not really needs to be known by
>> applications, also changes in the struct causing ABI breakages which
>> shouldn't.
>>
>> To be able to both keep APIs inline and hide the 'struct eth_dev_ops',
>> moving device operations used in ethdev inline APIs to 'struct
>> rte_eth_dev' to the same level with Rx/Tx burst functions.
>>
>> The list of dev_ops moved:
>> eth_rx_queue_count_t       rx_queue_count;
>> eth_rx_descriptor_status_t rx_descriptor_status;
>> eth_tx_descriptor_status_t tx_descriptor_status;
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> 
> Reviewed-by: Andrew Rybchenko <arybchenko at solarflare.com>
> 
> doc/guides/nics/features.rst should be updated since it says
> that status callbacks live in eth_dev_ops.
> 

Yep, I will fix in v2, thanks for review.

> plus an net/sfc-related nit below:
> 
> [snip]
> 
>> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
>> index 65e0ff7d48..0b06bf91a0 100644
>> --- a/drivers/net/sfc/sfc_ethdev.c
>> +++ b/drivers/net/sfc/sfc_ethdev.c
> 
> [snip]
> 
>> @@ -1962,6 +1959,9 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
>>   	dev->tx_pkt_burst = dp_tx->pkt_burst;
>>   
>>   	dev->dev_ops = &sfc_eth_dev_ops;
>> +	dev->rx_queue_count = sfc_rx_queue_count;
>> +	dev->rx_descriptor_status = sfc_rx_descriptor_status;
>> +	dev->tx_descriptor_status = sfc_tx_descriptor_status;
> 
> May I ask to put it just after dev->tx_pkt_burst = ... line
> since these callbacks go before dev_ops in the structure.
> 

ok

>>   
>>   	return 0;
>>   
>> @@ -2001,9 +2001,6 @@ sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
>>   
>>   static const struct eth_dev_ops sfc_eth_dev_secondary_ops = {
>>   	.dev_supported_ptypes_get	= sfc_dev_supported_ptypes_get,
>> -	.rx_queue_count			= sfc_rx_queue_count,
>> -	.rx_descriptor_status		= sfc_rx_descriptor_status,
>> -	.tx_descriptor_status		= sfc_tx_descriptor_status,
>>   	.reta_query			= sfc_dev_rss_reta_query,
>>   	.rss_hash_conf_get		= sfc_dev_rss_hash_conf_get,
>>   	.rxq_info_get			= sfc_rx_queue_info_get,
>> @@ -2069,6 +2066,9 @@ sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main)
>>   	dev->tx_pkt_prepare = dp_tx->pkt_prepare;
>>   	dev->tx_pkt_burst = dp_tx->pkt_burst;
>>   	dev->dev_ops = &sfc_eth_dev_secondary_ops;
>> +	dev->rx_queue_count = sfc_rx_queue_count;
>> +	dev->rx_descriptor_status = sfc_rx_descriptor_status;
>> +	dev->tx_descriptor_status = sfc_tx_descriptor_status;
> 
> Same here.
> 

ok



More information about the dev mailing list