2015-12-02 05:18, Charles  Williams:
> On Wed, 2015-12-02 at 02:04 +0100, Thomas Monjalon wrote:
> > 2015-12-01 18:58, Charles  Williams:
> > > On Wed, 2015-12-02 at 00:34 +0100, Thomas Monjalon wrote:
> > > > 2015-12-01 14:37, Stephen Hemminger:
> > > > > Harish Patil <harish.patil at qlogic.com> wrote:
> > > > > > >2015-11-03 12:26, Chas Williams:  
> > > > > > >> --- a/drivers/net/bnx2x/bnx2x.c
> > > > > > >> +++ b/drivers/net/bnx2x/bnx2x.c
> > > > > > >> -                            tx_start_bd->vlan_or_ethertype = 
> > > > > > >> eh->ether_type;
> > > > > > >> +                            tx_start_bd->vlan_or_ethertype
> > > > > > >> +                                = 
> > > > > > >> rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
> > > > > > 
> > > > > > Minor question - any specific reason to use rte_be_to_cpu_16() on
> > > > > > ether_type alone before converting from native order to le16?
> > > > > 
> > > > > ether_type is in network byte order (big endian)
> > > > > and hardware wants little endian. On x86 the second step is a nop.
> > > > 
> > > > Doesn't it deserve a macro rte_ntole16()?
> > > > It may be in lib/librte_eal/common/include/generic/rte_byteorder.h.
> > > 
> > > I looked I didn't see anything.  This value, according to the linux
> > > driver, wants to be little endian regardless of the host endian.
> > 
> > Yes, that's why I suggest to create some macros to do this kind of 
> > conversion.
> > Example: rte_ntole16 means "network to little endian 16-bit".
> > Do you think it would be clearer to use?
> 
> This is the only example of this kind of conversion in the source code
> so it would be a macro for one user.  If you create rte_ntole16() you
> might feel obligated to create the various permutations for which there
> are no consumers.

Yes, that's why I was not sure of the interest.

Reply via email to