Skip to content

Commit c371e7b

Browse files
committed
Merge tag 'mlx5e-updates-2018-08-10' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5e-updates-2018-08-10 This series provides the following updates to mlx5e netdevice driver. 1) First 4 patches extends the support for ethtool rxnfc flow steering - Added ipv6 support - l4 proto ip field for both ip6 and ip4 2) Next 4 patches, reorganizing flow steering structures and declaration into one header file, and add two Kconfig flags to allow disabling/enabling mlx5 netdevice rx flow steering at compile time: CONFIG_MLX5_EN_ARFS for en_arfs.c CONFIG_MLX5_EN_RXNFC for en_fs_ehtool.c 3) More kconfig flags dependencies - vxlan.c depends on CONFIG_VXLAN - clock.c depends on CONFIG_PTP_1588_CLOCK 4) Reorganize the Makefile ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 42c625a + cf916ff commit c371e7b

File tree

14 files changed

+756
-466
lines changed

14 files changed

+756
-466
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config MLX5_CORE
77
depends on MAY_USE_DEVLINK
88
depends on PCI
99
imply PTP_1588_CLOCK
10+
imply VXLAN
1011
default n
1112
---help---
1213
Core driver for low level functionality of the ConnectX-4 and
@@ -35,6 +36,24 @@ config MLX5_CORE_EN
3536
---help---
3637
Ethernet support in Mellanox Technologies ConnectX-4 NIC.
3738

39+
config MLX5_EN_ARFS
40+
bool "Mellanox MLX5 ethernet accelerated receive flow steering (ARFS) support"
41+
depends on MLX5_CORE_EN && RFS_ACCEL
42+
default y
43+
---help---
44+
Mellanox MLX5 ethernet hardware-accelerated receive flow steering support,
45+
Enables ethernet netdevice arfs support and ntuple filtering.
46+
47+
config MLX5_EN_RXNFC
48+
bool "Mellanox MLX5 ethernet rx nfc flow steering support"
49+
depends on MLX5_CORE_EN
50+
default y
51+
---help---
52+
Mellanox MLX5 ethernet rx nfc flow steering support
53+
Enables ethtool receive network flow classification, which allows user defined
54+
flow rules to direct traffic into arbitrary rx queue via ethtool set/get_rxnfc
55+
API.
56+
3857
config MLX5_MPFS
3958
bool "Mellanox Technologies MLX5 MPFS support"
4059
depends on MLX5_CORE_EN
Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,61 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
2+
#
3+
# Makefile for Mellanox 5th generation network adapters
4+
# (ConnectX series) core & netdev driver
5+
#
6+
37
subdir-ccflags-y += -I$(src)
48

9+
obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
10+
11+
#
12+
# mlx5 core basic
13+
#
514
mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
615
health.o mcg.o cq.o srq.o alloc.o qp.o port.o mr.o pd.o \
716
mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \
8-
fs_counters.o rl.o lag.o dev.o wq.o lib/gid.o lib/clock.o \
17+
fs_counters.o rl.o lag.o dev.o wq.o lib/gid.o \
918
diag/fs_tracepoint.o diag/fw_tracer.o
1019

11-
mlx5_core-$(CONFIG_MLX5_ACCEL) += accel/ipsec.o accel/tls.o
12-
13-
mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o \
14-
fpga/ipsec.o fpga/tls.o
15-
20+
#
21+
# Netdev basic
22+
#
1623
mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
1724
en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \
18-
en_arfs.o en_fs_ethtool.o en_selftest.o en/port.o lib/vxlan.o
19-
20-
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o
21-
22-
mlx5_core-$(CONFIG_MLX5_ESWITCH) += eswitch.o eswitch_offloads.o en_rep.o en_tc.o
25+
en_selftest.o en/port.o
26+
27+
#
28+
# Netdev extra
29+
#
30+
mlx5_core-$(CONFIG_MLX5_EN_ARFS) += en_arfs.o
31+
mlx5_core-$(CONFIG_MLX5_EN_RXNFC) += en_fs_ethtool.o
32+
mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o en/port_buffer.o
33+
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o en_tc.o
34+
35+
#
36+
# Core extra
37+
#
38+
mlx5_core-$(CONFIG_MLX5_ESWITCH) += eswitch.o eswitch_offloads.o
39+
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o
40+
mlx5_core-$(CONFIG_VXLAN) += lib/vxlan.o
41+
mlx5_core-$(CONFIG_PTP_1588_CLOCK) += lib/clock.o
42+
43+
#
44+
# Ipoib netdev
45+
#
46+
mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib_vlan.o
2347

24-
mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o en/port_buffer.o
48+
#
49+
# Accelerations & FPGA
50+
#
51+
mlx5_core-$(CONFIG_MLX5_ACCEL) += accel/ipsec.o accel/tls.o
2552

26-
mlx5_core-$(CONFIG_MLX5_CORE_IPOIB) += ipoib/ipoib.o ipoib/ethtool.o ipoib/ipoib_vlan.o
53+
mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o \
54+
fpga/ipsec.o fpga/tls.o
2755

2856
mlx5_core-$(CONFIG_MLX5_EN_IPSEC) += en_accel/ipsec.o en_accel/ipsec_rxtx.o \
29-
en_accel/ipsec_stats.o
57+
en_accel/ipsec_stats.o
3058

31-
mlx5_core-$(CONFIG_MLX5_EN_TLS) += en_accel/tls.o en_accel/tls_rxtx.o en_accel/tls_stats.o
59+
mlx5_core-$(CONFIG_MLX5_EN_TLS) += en_accel/tls.o en_accel/tls_rxtx.o en_accel/tls_stats.o
3260

3361
CFLAGS_tracepoint.o := -I$(src)

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "wq.h"
5353
#include "mlx5_core.h"
5454
#include "en_stats.h"
55+
#include "en/fs.h"
5556

5657
struct page_pool;
5758

@@ -626,152 +627,12 @@ struct mlx5e_channel_stats {
626627
struct mlx5e_xdpsq_stats xdpsq;
627628
} ____cacheline_aligned_in_smp;
628629

629-
enum mlx5e_traffic_types {
630-
MLX5E_TT_IPV4_TCP,
631-
MLX5E_TT_IPV6_TCP,
632-
MLX5E_TT_IPV4_UDP,
633-
MLX5E_TT_IPV6_UDP,
634-
MLX5E_TT_IPV4_IPSEC_AH,
635-
MLX5E_TT_IPV6_IPSEC_AH,
636-
MLX5E_TT_IPV4_IPSEC_ESP,
637-
MLX5E_TT_IPV6_IPSEC_ESP,
638-
MLX5E_TT_IPV4,
639-
MLX5E_TT_IPV6,
640-
MLX5E_TT_ANY,
641-
MLX5E_NUM_TT,
642-
MLX5E_NUM_INDIR_TIRS = MLX5E_TT_ANY,
643-
};
644-
645-
enum mlx5e_tunnel_types {
646-
MLX5E_TT_IPV4_GRE,
647-
MLX5E_TT_IPV6_GRE,
648-
MLX5E_NUM_TUNNEL_TT,
649-
};
650-
651630
enum {
652631
MLX5E_STATE_ASYNC_EVENTS_ENABLED,
653632
MLX5E_STATE_OPENED,
654633
MLX5E_STATE_DESTROYING,
655634
};
656635

657-
struct mlx5e_l2_rule {
658-
u8 addr[ETH_ALEN + 2];
659-
struct mlx5_flow_handle *rule;
660-
};
661-
662-
struct mlx5e_flow_table {
663-
int num_groups;
664-
struct mlx5_flow_table *t;
665-
struct mlx5_flow_group **g;
666-
};
667-
668-
#define MLX5E_L2_ADDR_HASH_SIZE BIT(BITS_PER_BYTE)
669-
670-
struct mlx5e_tc_table {
671-
struct mlx5_flow_table *t;
672-
673-
struct rhashtable ht;
674-
675-
DECLARE_HASHTABLE(mod_hdr_tbl, 8);
676-
DECLARE_HASHTABLE(hairpin_tbl, 8);
677-
};
678-
679-
struct mlx5e_vlan_table {
680-
struct mlx5e_flow_table ft;
681-
DECLARE_BITMAP(active_cvlans, VLAN_N_VID);
682-
DECLARE_BITMAP(active_svlans, VLAN_N_VID);
683-
struct mlx5_flow_handle *active_cvlans_rule[VLAN_N_VID];
684-
struct mlx5_flow_handle *active_svlans_rule[VLAN_N_VID];
685-
struct mlx5_flow_handle *untagged_rule;
686-
struct mlx5_flow_handle *any_cvlan_rule;
687-
struct mlx5_flow_handle *any_svlan_rule;
688-
bool cvlan_filter_disabled;
689-
};
690-
691-
struct mlx5e_l2_table {
692-
struct mlx5e_flow_table ft;
693-
struct hlist_head netdev_uc[MLX5E_L2_ADDR_HASH_SIZE];
694-
struct hlist_head netdev_mc[MLX5E_L2_ADDR_HASH_SIZE];
695-
struct mlx5e_l2_rule broadcast;
696-
struct mlx5e_l2_rule allmulti;
697-
struct mlx5e_l2_rule promisc;
698-
bool broadcast_enabled;
699-
bool allmulti_enabled;
700-
bool promisc_enabled;
701-
};
702-
703-
/* L3/L4 traffic type classifier */
704-
struct mlx5e_ttc_table {
705-
struct mlx5e_flow_table ft;
706-
struct mlx5_flow_handle *rules[MLX5E_NUM_TT];
707-
struct mlx5_flow_handle *tunnel_rules[MLX5E_NUM_TUNNEL_TT];
708-
};
709-
710-
#define ARFS_HASH_SHIFT BITS_PER_BYTE
711-
#define ARFS_HASH_SIZE BIT(BITS_PER_BYTE)
712-
struct arfs_table {
713-
struct mlx5e_flow_table ft;
714-
struct mlx5_flow_handle *default_rule;
715-
struct hlist_head rules_hash[ARFS_HASH_SIZE];
716-
};
717-
718-
enum arfs_type {
719-
ARFS_IPV4_TCP,
720-
ARFS_IPV6_TCP,
721-
ARFS_IPV4_UDP,
722-
ARFS_IPV6_UDP,
723-
ARFS_NUM_TYPES,
724-
};
725-
726-
struct mlx5e_arfs_tables {
727-
struct arfs_table arfs_tables[ARFS_NUM_TYPES];
728-
/* Protect aRFS rules list */
729-
spinlock_t arfs_lock;
730-
struct list_head rules;
731-
int last_filter_id;
732-
struct workqueue_struct *wq;
733-
};
734-
735-
/* NIC prio FTS */
736-
enum {
737-
MLX5E_VLAN_FT_LEVEL = 0,
738-
MLX5E_L2_FT_LEVEL,
739-
MLX5E_TTC_FT_LEVEL,
740-
MLX5E_INNER_TTC_FT_LEVEL,
741-
MLX5E_ARFS_FT_LEVEL
742-
};
743-
744-
enum {
745-
MLX5E_TC_FT_LEVEL = 0,
746-
MLX5E_TC_TTC_FT_LEVEL,
747-
};
748-
749-
struct mlx5e_ethtool_table {
750-
struct mlx5_flow_table *ft;
751-
int num_rules;
752-
};
753-
754-
#define ETHTOOL_NUM_L3_L4_FTS 7
755-
#define ETHTOOL_NUM_L2_FTS 4
756-
757-
struct mlx5e_ethtool_steering {
758-
struct mlx5e_ethtool_table l3_l4_ft[ETHTOOL_NUM_L3_L4_FTS];
759-
struct mlx5e_ethtool_table l2_ft[ETHTOOL_NUM_L2_FTS];
760-
struct list_head rules;
761-
int tot_num_rules;
762-
};
763-
764-
struct mlx5e_flow_steering {
765-
struct mlx5_flow_namespace *ns;
766-
struct mlx5e_ethtool_steering ethtool;
767-
struct mlx5e_tc_table tc;
768-
struct mlx5e_vlan_table vlan;
769-
struct mlx5e_l2_table l2;
770-
struct mlx5e_ttc_table ttc;
771-
struct mlx5e_ttc_table inner_ttc;
772-
struct mlx5e_arfs_tables arfs;
773-
};
774-
775636
struct mlx5e_rqt {
776637
u32 rqtn;
777638
bool enabled;
@@ -905,23 +766,10 @@ mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
905766

906767
void mlx5e_update_stats(struct mlx5e_priv *priv);
907768

908-
int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
909-
void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
910769
void mlx5e_init_l2_addr(struct mlx5e_priv *priv);
911-
void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
912770
int mlx5e_self_test_num(struct mlx5e_priv *priv);
913771
void mlx5e_self_test(struct net_device *ndev, struct ethtool_test *etest,
914772
u64 *buf);
915-
int mlx5e_ethtool_get_flow(struct mlx5e_priv *priv, struct ethtool_rxnfc *info,
916-
int location);
917-
int mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv,
918-
struct ethtool_rxnfc *info, u32 *rule_locs);
919-
int mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,
920-
struct ethtool_rx_flow_spec *fs);
921-
int mlx5e_ethtool_flow_remove(struct mlx5e_priv *priv,
922-
int location);
923-
void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv);
924-
void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv);
925773
void mlx5e_set_rx_mode_work(struct work_struct *work);
926774

927775
int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr);
@@ -932,8 +780,6 @@ int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
932780
u16 vid);
933781
int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
934782
u16 vid);
935-
void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv);
936-
void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
937783
void mlx5e_timestamp_init(struct mlx5e_priv *priv);
938784

939785
struct mlx5e_redirect_rqt_param {
@@ -1050,32 +896,6 @@ void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv);
1050896
void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv);
1051897
#endif
1052898

1053-
#ifndef CONFIG_RFS_ACCEL
1054-
static inline int mlx5e_arfs_create_tables(struct mlx5e_priv *priv)
1055-
{
1056-
return 0;
1057-
}
1058-
1059-
static inline void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv) {}
1060-
1061-
static inline int mlx5e_arfs_enable(struct mlx5e_priv *priv)
1062-
{
1063-
return -EOPNOTSUPP;
1064-
}
1065-
1066-
static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv)
1067-
{
1068-
return -EOPNOTSUPP;
1069-
}
1070-
#else
1071-
int mlx5e_arfs_create_tables(struct mlx5e_priv *priv);
1072-
void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv);
1073-
int mlx5e_arfs_enable(struct mlx5e_priv *priv);
1074-
int mlx5e_arfs_disable(struct mlx5e_priv *priv);
1075-
int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
1076-
u16 rxq_index, u32 flow_id);
1077-
#endif
1078-
1079899
int mlx5e_create_tir(struct mlx5_core_dev *mdev,
1080900
struct mlx5e_tir *tir, u32 *in, int inlen);
1081901
void mlx5e_destroy_tir(struct mlx5_core_dev *mdev,
@@ -1096,27 +916,6 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv);
1096916
void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv);
1097917
void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt);
1098918

1099-
struct ttc_params {
1100-
struct mlx5_flow_table_attr ft_attr;
1101-
u32 any_tt_tirn;
1102-
u32 indir_tirn[MLX5E_NUM_INDIR_TIRS];
1103-
struct mlx5e_ttc_table *inner_ttc;
1104-
};
1105-
1106-
void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, struct ttc_params *ttc_params);
1107-
void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params);
1108-
void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params);
1109-
1110-
int mlx5e_create_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
1111-
struct mlx5e_ttc_table *ttc);
1112-
void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv,
1113-
struct mlx5e_ttc_table *ttc);
1114-
1115-
int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
1116-
struct mlx5e_ttc_table *ttc);
1117-
void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv,
1118-
struct mlx5e_ttc_table *ttc);
1119-
1120919
int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc,
1121920
u32 underlay_qpn, u32 *tisn);
1122921
void mlx5e_destroy_tis(struct mlx5_core_dev *mdev, u32 tisn);

0 commit comments

Comments
 (0)