Hi

> -----Original Message-----
> From: Yuan Wang <yuanx.w...@intel.com>
> Sent: Saturday, September 3, 2022 3:10 AM
> To: dev@dpdk.org; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <tho...@monjalon.net>; Ferruh Yigit <ferruh.yi...@xilinx.com>; Andrew
> Rybchenko <andrew.rybche...@oktetlabs.ru>
> Cc: m...@ashroe.eu; xiaoyun...@intel.com; aman.deep.si...@intel.com;
> yuying.zh...@intel.com; qi.z.zh...@intel.com; qiming.y...@intel.com;
> jerinjac...@gmail.com; Slava Ovsiienko <viachesl...@nvidia.com>;
> step...@networkplumber.org; xuan.d...@intel.com; hpoth...@marvell.com;
> yaqi.t...@intel.com; Yuan Wang <yuanx.w...@intel.com>; Wenxuan Wu
> <wenxuanx...@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

Reply via email to