Thanks to Konstantin and Andrew for your feedback. I will use __builtin_ctzll() and __builtin_clzll() in my v3 patch set. I also will use strcasecmp and loop to do config_rx_offload() and config_tx_offload() following your guidance.
> -----Original Message----- > From: Ananyev, Konstantin > Sent: Tuesday, March 13, 2018 5:31 PM > To: Andrew Rybchenko <arybche...@solarflare.com>; Dai, Wei > <wei....@intel.com>; Lu, Wenzhuo <wenzhuo...@intel.com>; Wu, Jingjing > <jingjing...@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add commands to test > new Rx offload API > > > > > -----Original Message----- > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Andrew > Rybchenko > > Sent: Tuesday, March 13, 2018 7:21 AM > > To: Dai, Wei <wei....@intel.com>; Lu, Wenzhuo > <wenzhuo...@intel.com>; > > Wu, Jingjing <jingjing...@intel.com> > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add commands to > > test new Rx offload API > > > > On 03/13/2018 09:42 AM, Wei Dai wrote: > > > Add following testpmd run-time commands to support test of new Rx > > > offload API: > > > rx_offload get capability <port_id> > > > rx_offload get configuration <port_id> rx_offload enable|disable > > > per_port <offload> <port_id> rx_offload enable|disable per_queue > > > <offload> <port_id> <queue_id> > > > > > > Above last 2 commands should be run when the port is stopped. > > > And <offload> can be one of "vlan_strip", "ipv4_cksum", ... > > > > > > Signed-off-by: Wei Dai <wei....@intel.com> > > > --- > > > + for (single_offload = DEV_RX_OFFLOAD_VLAN_STRIP; > > > + single_offload <= DEV_RX_OFFLOAD_SECURITY; > > > > It requires attention when a new offload is added. > > Please, consider to use something like __builtin_ffsll(), print name > > of the found bit, clear it and retry. It allows to avoid boundaries > > specification. > > > > <snip> > > > > > > I was going to suggest rte_eth_dev_rx_offload_name(), strcasecmp() and > loop. > > +1 > > > It is possible to iterate on all U64 bits or add a way to get all > > offload bits from rte_ethdev. > > However it still requires list of offloads in the help below. So, it > > is not easy to get rig of offloads list completely. Just an idea. Up > > to you. > > > > <snip> > >