On Sat, 17 Dec 2022 15:22:21 +0000
"Zhang, Ke1X" <ke1x.zh...@intel.com> wrote:

> > -----Original Message-----
> > From: Stephen Hemminger <step...@networkplumber.org>
> > Sent: Tuesday, December 13, 2022 11:51 AM
> > To: Zhang, Ke1X <ke1x.zh...@intel.com>
> > Cc: Zhang, Qi Z <qi.z.zh...@intel.com>; Zhang, Yuying
> > <yuying.zh...@intel.com>; dev@dpdk.org
> > Subject: Re: [PATCH] net/ice: add devargs for disabling mac filter
> > 
> > On Fri, 25 Nov 2022 10:51:24 +0800
> > Ke Zhang <ke1x.zh...@intel.com> wrote:
> >   
> > > diff --git a/drivers/net/ice/ice_ethdev.h
> > > b/drivers/net/ice/ice_ethdev.h index c8311be179..0350c6584a 100644
> > > --- a/drivers/net/ice/ice_ethdev.h
> > > +++ b/drivers/net/ice/ice_ethdev.h
> > > @@ -563,6 +563,7 @@ struct ice_devargs {
> > >   int safe_mode_support;
> > >   uint8_t proto_xtr_dflt;
> > >   int pipe_mode_support;
> > > + int mac_filter_disable;  
> > 
> > Why use 4 bytes for a flag when a single bit would do.  
> 
> After modifying the code like this:
> struct ice_devargs {
>       int rx_low_latency : 1;
>       int safe_mode_support : 1;
>       int pipe_mode_support : 1;
>       int mac_filter_disable : 1;
> 
> I met a issue when compiling the code:
> ../drivers/net/ice/ice_ethdev.c:2076:19: error: cannot take address of 
> bit-field 'safe_mode_support'
>  2076 |      &parse_bool, &ad->devargs.safe_mode_support);
>       |                   ^
> ../drivers/net/ice/ice_ethdev.c:2081:19: error: cannot take address of 
> bit-field 'pipe_mode_support'
>  2081 |      &parse_bool, &ad->devargs.pipe_mode_support);
>       |                   ^
> ../drivers/net/ice/ice_ethdev.c:2086:18: error: cannot take address of 
> bit-field 'mac_filter_disable'
>  2086 |     &parse_bool, &ad->devargs.mac_filter_disable);
>       |                  ^
> ../drivers/net/ice/ice_ethdev.c:2101:19: error: cannot take address of 
> bit-field 'rx_low_latency'
>  2101 |      &parse_bool, &ad->devargs.rx_low_latency);
> 
> It seems that bitfields members aren't addressable.
> 

Would a uint8_t work?   Also parse_bool might make assumptions about size.

Reply via email to