Hi > -----Original Message----- > From: Suanming Mou <suanmi...@nvidia.com> > Sent: Tuesday, September 13, 2022 3:57 PM > To: Wang, YuanX <yuanx.w...@intel.com>; 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; Li, Xiaoyun <xiaoyun...@intel.com>; Singh, Aman Deep > <aman.deep.si...@intel.com>; Zhang, Yuying <yuying.zh...@intel.com>; > Zhang, Qi Z <qi.z.zh...@intel.com>; Yang, Qiming <qiming.y...@intel.com>; > jerinjac...@gmail.com; Slava Ovsiienko <viachesl...@nvidia.com>; > step...@networkplumber.org; Ding, Xuan <xuan.d...@intel.com>; > hpoth...@marvell.com; Tang, Yaqi <yaqi.t...@intel.com>; Wenxuan Wu > <wenxuanx...@intel.com> > Subject: RE: [PATCH v3 2/4] ethdev: introduce protocol hdr based buffer split > > 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?
The usage of rte_eth_buffer_split_get_supported_hdr_ptypes is the same as rte_eth_dev_get_supported_ptypes. In this scenario, the function returns the total number of supported ptypes, or an error code less than 0. > > > + 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