For me these defines make perfect sense - tunnelling filters require combinations of different tunnel components, but not all combinations are valid. So defining valid combinations separately helps.
Regards, Andrey > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > Sent: Wednesday, October 22, 2014 5:31 PM > To: Liu, Jijiang > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH v6 5/9] librte_ether:add data > structures of VxLAN filter > > 2014-10-22 02:25, Liu, Jijiang: > > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > > > 2014-10-21 16:46, Jijiang Liu: > > > > +#define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC > | \ > > > > + ETH_TUNNEL_FILTER_IVLAN) > > > > +#define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID > (ETH_TUNNEL_FILTER_IMAC | \ > > > > + ETH_TUNNEL_FILTER_IVLAN | \ > > > > + ETH_TUNNEL_FILTER_TENID) > > > > +#define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC > | \ > > > > + ETH_TUNNEL_FILTER_TENID) > > > > +#define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC > (ETH_TUNNEL_FILTER_OMAC | \ > > > > + ETH_TUNNEL_FILTER_TENID | \ > > > > + ETH_TUNNEL_FILTER_IMAC) > > > > > > I thought you agree that these definitions are useless? > > > > Sorry, this MAY be some misunderstanding, I don't think these > > definition are useless. I just thought change "uint16_t filter_type" > > is better than define "enum filter_type". > > > > Let me explain here again. > > The filter condition are: > > 1. inner MAC + inner VLAN > > 2. inner MAC + IVLAN + tenant ID > > .. > > 5. outer MAC + tenant ID + inner MAC > > > > For each filter condition, we need to check if the mandatory > > parameters are valid by checking corresponding bit MASK. > > Checking bit mask doesn't imply to define all combinations of bit masks. > There's probably something obvious that one of us is missing. Anybody else have comments on this? > > An pseudo code example: > > > > Switch (filter_type) > > Case 1: //inner MAC + inner VLAN > > If (filter_type & ETH_TUNNEL_FILTER_IMAC ) > > if (IMAC==NULL) > > return -1; > > > > case 5: // outer MAC + tenant ID + inner MAC > > If (filter_type & ETH_TUNNEL_FILTER_IMAC ) > > if (IMAC==NULL) > > return -1; > > > > If (filter_type & ETH_TUNNEL_FILTER_OMAC ) > > if (IMAC==NULL) > > return -1; > > ......