[PATCH v3 2/4] ethdev: introduce protocol hdr based buffer split

Suanming Mou suanmingm at nvidia.com
Tue Sep 13 09:56:41 CEST 2022


Hi

> -----Original Message-----
> From: Yuan Wang <yuanx.wang at intel.com>
> Sent: Saturday, September 3, 2022 3:10 AM
> To: dev at dpdk.org; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas at monjalon.net>; Ferruh Yigit <ferruh.yigit at xilinx.com>; Andrew
> Rybchenko <andrew.rybchenko at oktetlabs.ru>
> Cc: mdr at ashroe.eu; xiaoyun.li at intel.com; aman.deep.singh at intel.com;
> yuying.zhang at intel.com; qi.z.zhang at intel.com; qiming.yang at intel.com;
> jerinjacobk at gmail.com; Slava Ovsiienko <viacheslavo at nvidia.com>;
> stephen at networkplumber.org; xuan.ding at intel.com; hpothula at marvell.com;
> yaqi.tang at intel.com; Yuan Wang <yuanx.wang at intel.com>; Wenxuan Wu
> <wenxuanx.wu at intel.com>
> Subject: [PATCH v3 2/4] ethdev: introduce protocol hdr based buffer split
> 

snip

> @@ -1693,13 +1695,44 @@ rte_eth_rx_queue_check_split(const struct
> rte_eth_rxseg_split *rx_seg,
>  		}
>  		offset += seg_idx != 0 ? 0 : RTE_PKTMBUF_HEADROOM;
>  		*mbp_buf_size = rte_pktmbuf_data_room_size(mpl);
> -		length = length != 0 ? length : *mbp_buf_size;
> -		if (*mbp_buf_size < length + offset) {
> -			RTE_ETHDEV_LOG(ERR,
> -				       "%s mbuf_data_room_size %u < %u
> (segment length=%u + segment offset=%u)\n",
> -				       mpl->name, *mbp_buf_size,
> -				       length + offset, length, offset);
> -			return -EINVAL;
> +
> +		int ret =
> rte_eth_buffer_split_get_supported_hdr_ptypes(port_id, NULL, 0);

One small question, since the  ptypes == NULL and num == 0, I assume ret will always be <=0, right?

> +		if (ret <= 0) {
> +			/* Split at fixed length. */
> +			length = length != 0 ? length : *mbp_buf_size;
> +			if (*mbp_buf_size < length + offset) {
> +				RTE_ETHDEV_LOG(ERR,
> +					"%s mbuf_data_room_size %u < %u
> (segment length=%u + segment offset=%u)\n",
> +					mpl->name, *mbp_buf_size,
> +					length + offset, length, offset);
> +				return -EINVAL;
> +			}
> +		} else {
> +			/* Split after specified protocol header. */
> +			uint32_t ptypes[ret];
> +			int i;
> +
> +			ret =
> rte_eth_buffer_split_get_supported_hdr_ptypes(port_id, ptypes, ret);
> +			for (i = 0; i < ret; i++)
> +				if (ptypes[i] & proto_hdr)
> +					break;
> +

snip


More information about the dev mailing list