Hi
> -----Original Message-----
> From: Yuan Wang <[email protected]>
> Sent: Saturday, September 3, 2022 3:10 AM
> To: [email protected]; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <[email protected]>; Ferruh Yigit <[email protected]>; Andrew
> Rybchenko <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Slava Ovsiienko <[email protected]>;
> [email protected]; [email protected]; [email protected];
> [email protected]; Yuan Wang <[email protected]>; Wenxuan Wu
> <[email protected]>
> 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