Commit 3e0144ad authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-flow-director'

Huazhong Tan says:

====================
net: hns3: refactor and new features for flow director

This patchset refactor some functions and add some new features for
flow director.

patch 1~3: refactor large functions
patch 4, 7: add traffic class and user-def field support for ethtool
patch 5: refactor flow director configuration
patch 6: clean up for hns3_del_all_fd_entries()

change log:
V1->V2: modifies patch 5 as Jakub suggested, keep configuring
	ethtool/tc flower rules synchronously while aRFS
	asynchronously.
	changes the usecnt of user-def rule checking in patch 7.
	removes previous patches 8 and 9 from this series, since
	there are issues that need further discussion.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 405a129f 67b0e142
......@@ -612,8 +612,6 @@ struct hnae3_ae_ops {
struct ethtool_rxnfc *cmd);
int (*del_fd_entry)(struct hnae3_handle *handle,
struct ethtool_rxnfc *cmd);
void (*del_all_fd_entries)(struct hnae3_handle *handle,
bool clear_list);
int (*get_fd_rule_cnt)(struct hnae3_handle *handle,
struct ethtool_rxnfc *cmd);
int (*get_fd_rule_info)(struct hnae3_handle *handle,
......
......@@ -4143,14 +4143,6 @@ static void hns3_uninit_phy(struct net_device *netdev)
h->ae_algo->ops->mac_disconnect_phy(h);
}
static void hns3_del_all_fd_rules(struct net_device *netdev, bool clear_list)
{
struct hnae3_handle *h = hns3_get_handle(netdev);
if (h->ae_algo->ops->del_all_fd_entries)
h->ae_algo->ops->del_all_fd_entries(h, clear_list);
}
static int hns3_client_start(struct hnae3_handle *handle)
{
if (!handle->ae_algo->ops->client_start)
......@@ -4337,8 +4329,6 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
hns3_nic_uninit_irq(priv);
hns3_del_all_fd_rules(netdev, true);
hns3_clear_all_ring(handle, true);
hns3_nic_uninit_vector_data(priv);
......
......@@ -243,6 +243,7 @@ enum hclge_opcode_type {
HCLGE_OPC_FD_KEY_CONFIG = 0x1202,
HCLGE_OPC_FD_TCAM_OP = 0x1203,
HCLGE_OPC_FD_AD_OP = 0x1204,
HCLGE_OPC_FD_USER_DEF_OP = 0x1207,
/* MDIO command */
HCLGE_OPC_MDIO_CONFIG = 0x1900,
......@@ -1082,6 +1083,19 @@ struct hclge_fd_ad_config_cmd {
u8 rsv2[8];
};
#define HCLGE_FD_USER_DEF_OFT_S 0
#define HCLGE_FD_USER_DEF_OFT_M GENMASK(14, 0)
#define HCLGE_FD_USER_DEF_EN_B 15
struct hclge_fd_user_def_cfg_cmd {
__le16 ol2_cfg;
__le16 l2_cfg;
__le16 ol3_cfg;
__le16 l3_cfg;
__le16 ol4_cfg;
__le16 l4_cfg;
u8 rsv[12];
};
struct hclge_get_m7_bd_cmd {
__le32 bd_num;
u8 rsv[20];
......
......@@ -223,6 +223,9 @@ enum HCLGE_DEV_STATE {
HCLGE_STATE_LINK_UPDATING,
HCLGE_STATE_PROMISC_CHANGED,
HCLGE_STATE_RST_FAIL,
HCLGE_STATE_FD_TBL_CHANGED,
HCLGE_STATE_FD_CLEAR_ALL,
HCLGE_STATE_FD_USER_DEF_CHANGED,
HCLGE_STATE_MAX
};
......@@ -536,6 +539,9 @@ enum HCLGE_FD_TUPLE {
MAX_TUPLE,
};
#define HCLGE_FD_TUPLE_USER_DEF_TUPLES \
(BIT(INNER_L2_RSV) | BIT(INNER_L3_RSV) | BIT(INNER_L4_RSV))
enum HCLGE_FD_META_DATA {
PACKET_TYPE_ID,
IP_FRAGEMENT,
......@@ -548,9 +554,21 @@ enum HCLGE_FD_META_DATA {
MAX_META_DATA,
};
enum HCLGE_FD_KEY_OPT {
KEY_OPT_U8,
KEY_OPT_LE16,
KEY_OPT_LE32,
KEY_OPT_MAC,
KEY_OPT_IP,
KEY_OPT_VNI,
};
struct key_info {
u8 key_type;
u8 key_length; /* use bit as unit */
enum HCLGE_FD_KEY_OPT key_opt;
int offset;
int moffset;
};
#define MAX_KEY_LENGTH 400
......@@ -558,6 +576,11 @@ struct key_info {
#define MAX_KEY_BYTES (MAX_KEY_DWORDS * 4)
#define MAX_META_DATA_LENGTH 32
#define HCLGE_FD_MAX_USER_DEF_OFFSET 9000
#define HCLGE_FD_USER_DEF_DATA GENMASK(15, 0)
#define HCLGE_FD_USER_DEF_OFFSET GENMASK(15, 0)
#define HCLGE_FD_USER_DEF_OFFSET_UNMASK GENMASK(15, 0)
/* assigned by firmware, the real filter number for each pf may be less */
#define MAX_FD_FILTER_NUM 4096
#define HCLGE_ARFS_EXPIRE_INTERVAL 5UL
......@@ -580,6 +603,33 @@ enum HCLGE_FD_ACTION {
HCLGE_FD_ACTION_SELECT_TC,
};
enum HCLGE_FD_NODE_STATE {
HCLGE_FD_TO_ADD,
HCLGE_FD_TO_DEL,
HCLGE_FD_ACTIVE,
HCLGE_FD_DELETED,
};
enum HCLGE_FD_USER_DEF_LAYER {
HCLGE_FD_USER_DEF_NONE,
HCLGE_FD_USER_DEF_L2,
HCLGE_FD_USER_DEF_L3,
HCLGE_FD_USER_DEF_L4,
};
#define HCLGE_FD_USER_DEF_LAYER_NUM 3
struct hclge_fd_user_def_cfg {
u16 ref_cnt;
u16 offset;
};
struct hclge_fd_user_def_info {
enum HCLGE_FD_USER_DEF_LAYER layer;
u16 data;
u16 data_mask;
u16 offset;
};
struct hclge_fd_key_cfg {
u8 key_sel;
u8 inner_sipv6_word_en;
......@@ -596,6 +646,7 @@ struct hclge_fd_cfg {
u32 rule_num[MAX_STAGE_NUM]; /* rule entry number */
u16 cnt_num[MAX_STAGE_NUM]; /* rule hit counter number */
struct hclge_fd_key_cfg key_cfg[MAX_STAGE_NUM];
struct hclge_fd_user_def_cfg user_def_cfg[HCLGE_FD_USER_DEF_LAYER_NUM];
};
#define IPV4_INDEX 3
......@@ -612,6 +663,9 @@ struct hclge_fd_rule_tuples {
u16 dst_port;
u16 vlan_tag1;
u16 ether_proto;
u16 l2_user_def;
u16 l3_user_def;
u32 l4_user_def;
u8 ip_tos;
u8 ip_proto;
};
......@@ -630,11 +684,15 @@ struct hclge_fd_rule {
struct {
u16 flow_id; /* only used for arfs */
} arfs;
struct {
struct hclge_fd_user_def_info user_def;
} ep;
};
u16 queue_id;
u16 vf_id;
u16 location;
enum HCLGE_FD_ACTIVE_RULE_TYPE rule_type;
enum HCLGE_FD_NODE_STATE state;
u8 action;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment