Hi 

> -----Original Message-----
> From: Suanming Mou <[email protected]>
> Sent: Tuesday, September 13, 2022 3:57 PM
> To: Wang, YuanX <[email protected]>; [email protected]; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <[email protected]>; Ferruh Yigit
> <[email protected]>; Andrew Rybchenko
> <[email protected]>
> Cc: [email protected]; Li, Xiaoyun <[email protected]>; Singh, Aman Deep
> <[email protected]>; Zhang, Yuying <[email protected]>;
> Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>;
> [email protected]; Slava Ovsiienko <[email protected]>;
> [email protected]; Ding, Xuan <[email protected]>;
> [email protected]; Tang, Yaqi <[email protected]>; Wenxuan Wu
> <[email protected]>
> Subject: RE: [PATCH v3 2/4] ethdev: introduce protocol hdr based buffer split
> 
> 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?

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

Reply via email to