[dpdk-dev] [PATCH v6 03/13] mbuf: add accessors to get data room size and private size

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Apr 28 11:15:23 CEST 2015


2015-04-22 11:57, Olivier Matz:
> This code retrieving the pool private area is duplicated in many
> places, we can use of function for it.
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> Acked-by: Neil Horman <nhorman at tuxdriver.com>
[...]
> --- a/lib/librte_pmd_pcap/rte_eth_pcap.c
> +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
> @@ -136,9 +136,7 @@ eth_pcap_rx(void *queue,
>  	const u_char *packet;
>  	struct rte_mbuf *mbuf;
>  	struct pcap_rx_queue *pcap_q = queue;
> -	struct rte_pktmbuf_pool_private *mbp_priv;
>  	uint16_t num_rx = 0;
> -	uint16_t buf_size;
>  
>  	if (unlikely(pcap_q->pcap == NULL || nb_pkts == 0))
>  		return 0;
> @@ -157,8 +155,7 @@ eth_pcap_rx(void *queue,
>  			break;
>  
>  		/* Now get the space available for data in the mbuf */
> -		mbp_priv =  rte_mempool_get_priv(pcap_q->mb_pool);
> -		buf_size = (uint16_t) (mbp_priv->mbuf_data_room_size -
> +		buf_size = (uint16_t)(rte_pktmbuf_data_room_size(pcap_q->mb_pool) -
>  				RTE_PKTMBUF_HEADROOM);
>  
>  		if (header.len <= buf_size) {

It doesn't compile because buf_size is removed by error:
lib/librte_pmd_pcap/rte_eth_pcap.c: In function ‘eth_pcap_rx’:
lib/librte_pmd_pcap/rte_eth_pcap.c:158:3: error: ‘buf_size’ undeclared (first use in this function)

I fix it while applying patches.


More information about the dev mailing list