Skip to content

Commit

Permalink
net/hns3: reimplement hash flow function
Browse files Browse the repository at this point in the history
[ upstream commit e3069658da9ffb6f83a0d972ff2776c405eb6a8f ]

Currently, hns3 driver supports setting multiple rte flow RSS rule,
but only the last is valid. This implementation is different from
the mainstream usage of rte flow hash in the community. Please see
the discussion threads [1] and [2].

This patch sets RSS hash feature completely based on the request of
the flow rule so that multiple hash rules can take effect at the same
time. Please notice that:
1. For hns3, 'func' has only one hardware. 'key' and 'queue' have only
   one entry in hardware.
2. the overlapping part of the old rule will be overridden if the
   configuration items of a new rule overlap with those of an old rule.

The hns3_flow_validate() verifies and parses RSS or Fdir rules from
user, and saves them to a local variable at the same time. The local
variable is directly used to create RSS or Fdir rules. In this way,
we save one parsing and saving process.

[1] https://lore.kernel.org/all/DM5PR12MB46648085D7CABF1AFF2D75CDD60A9@DM5PR12MB4664.namprd12.prod.outlook.com/
[2] https://lore.kernel.org/all/f7de4db4-1b88-622f-4e03-acd3eee8a72c@oktetlabs.ru/

Fixes: c37ca66 ("net/hns3: support RSS")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
  • Loading branch information
LiHuiSong1 authored and kevintraynor committed Mar 21, 2023
1 parent 31b6a0d commit a306316
Show file tree
Hide file tree
Showing 5 changed files with 856 additions and 396 deletions.
9 changes: 0 additions & 9 deletions drivers/net/hns3/hns3_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1001,15 +1001,6 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
#define hns3_read_dev(a, reg) \
hns3_read_reg((a)->io_base, (reg))

#define NEXT_ITEM_OF_ACTION(act, actions, index) \
do { \
act = (actions) + (index); \
while (act->type == RTE_FLOW_ACTION_TYPE_VOID) { \
(index)++; \
act = actions + index; \
} \
} while (0)

static inline uint64_t
hns3_atomic_test_bit(unsigned int nr, volatile uint64_t *addr)
{
Expand Down
Loading

0 comments on commit a306316

Please sign in to comment.