> -----Original Message----- > From: dev <dev-boun...@dpdk.org> On Behalf Of chenmin....@intel.com > Sent: Saturday, June 13, 2020 02:00 > To: Zhang, Qi Z <qi.z.zh...@intel.com>; Xing, Beilei <beilei.x...@intel.com>; > Wu, Jingjing > <jingjing...@intel.com> > Cc: dev@dpdk.org; Sun, Chenmin <chenmin....@intel.com> > Subject: [dpdk-dev] [PATCH] net/i40e: i40e FDIR update rate optimization > > From: Chenmin Sun <chenmin....@intel.com> > > This patch optimized the fdir update rate for i40e PF, by tracking the > fdir rule will be inserted into guaranteed space or shared space. > For the flows that are inserted to the guaranteed space, it returns success > directly without retrieving the result for NIC. > > This patch changes the global register GLQF_CTL. Therefore, when devarg > ``Support multiple driver`` is set, the patch will not take effect to > avoid affecting the normal behavior of other i40e drivers, e.g., Linux > kernel driver. > > Signed-off-by: Chenmin Sun <chenmin....@intel.com> > --- > drivers/net/i40e/i40e_ethdev.c | 96 ++++++++++++++++- > drivers/net/i40e/i40e_ethdev.h | 57 +++++++--- > drivers/net/i40e/i40e_fdir.c | 182 +++++++++++++++++++++----------- > drivers/net/i40e/i40e_flow.c | 181 +++++++++++++++++++++++++------ > drivers/net/i40e/i40e_rxtx.c | 15 ++- > drivers/net/i40e/rte_pmd_i40e.c | 2 +- > 6 files changed, 417 insertions(+), 116 deletions(-) >
> > +static > +uint32_t bin_search(uint64_t data) > +{ > + uint32_t pos = 0; > + > + if ((data & 0xFFFFFFFF) == 0) { > + data >>= 32; > + pos += 32; > + } > + > + if ((data & 0xFFFF) == 0) { > + data >>= 16; > + pos += 16; > + } > + if ((data & 0xFF) == 0) { > + data >>= 8; > + pos += 8; > + } > + if ((data & 0xF) == 0) { > + data >>= 4; > + pos += 4; > + } > + if ((data & 0x3) == 0) { > + data >>= 2; > + pos += 2; > + } > + if ((data & 0x1) == 0) > + pos += 1; > + > + return pos; > +} > + Try " __builtin_ctzll ", DPDK has many examples to use it. ;-) > -- > 2.17.1