diff options
| author | David S. Miller <davem@davemloft.net> | 2015-02-04 19:14:29 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-02-04 19:14:29 -0500 |
| commit | ce388fff3aa446d5a4895f8a757345f53daa200a (patch) | |
| tree | 93990685d6fdba0784d68bf5ca0dbf523c930bb4 /include/linux | |
| parent | 251c005a6403933b3405fdc15fca4355e7590b42 (diff) | |
| parent | c6215745b66a7fbeeda1a826f94dd864a2ccf654 (diff) | |
Merge branch 'mlx4-next'
Or Gerlitz says:
====================
Add HA and LAG support to mlx4 RoCE and SRIOV services
This series takes advanges of bonding mlx4 Ethernet devices to support
a model of High-Availability and Link Aggregation for more environments.
The mlx4 driver reacts on netdev events generated by bonding when
slave state changes happen by programming a HW V2P (Virt-to-Phys)
port table. Bonding was extended to expose these state changes
through netdev events.
When an mlx4 interface such as the mlx4 IB/RoCE driver is subject to
this policy, QPs are created over virtual ports which are mapped
to one of the two physical ports. When a failure happens, the
re-programming of the V2P table allows traffic to keep flowing.
The mlx4 Ethernet driver interfaces are not subject to this
policy and act as usual.
A 2nd use-case for this model would be to add HA and Link Aggregation
support to single ported mlx4 Ethernet VFs. In this case, the PF Ethernet
intrfaces are bonded, all the VFs see single port devices (which is
supported already today), and VF QPs are subject to V2P.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mlx4/cmd.h | 7 | ||||
| -rw-r--r-- | include/linux/mlx4/device.h | 11 | ||||
| -rw-r--r-- | include/linux/mlx4/driver.h | 19 | ||||
| -rw-r--r-- | include/linux/mlx4/qp.h | 1 | ||||
| -rw-r--r-- | include/linux/netdevice.h | 15 |
5 files changed, 52 insertions, 1 deletions
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index ae95adc78509..7b6d4e9ff603 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
| @@ -71,6 +71,7 @@ enum { | |||
| 71 | 71 | ||
| 72 | /*master notify fw on finish for slave's flr*/ | 72 | /*master notify fw on finish for slave's flr*/ |
| 73 | MLX4_CMD_INFORM_FLR_DONE = 0x5b, | 73 | MLX4_CMD_INFORM_FLR_DONE = 0x5b, |
| 74 | MLX4_CMD_VIRT_PORT_MAP = 0x5c, | ||
| 74 | MLX4_CMD_GET_OP_REQ = 0x59, | 75 | MLX4_CMD_GET_OP_REQ = 0x59, |
| 75 | 76 | ||
| 76 | /* TPT commands */ | 77 | /* TPT commands */ |
| @@ -171,6 +172,12 @@ enum { | |||
| 171 | }; | 172 | }; |
| 172 | 173 | ||
| 173 | enum { | 174 | enum { |
| 175 | /* virtual to physical port mapping opcode modifiers */ | ||
| 176 | MLX4_GET_PORT_VIRT2PHY = 0x0, | ||
| 177 | MLX4_SET_PORT_VIRT2PHY = 0x1, | ||
| 178 | }; | ||
| 179 | |||
| 180 | enum { | ||
| 174 | MLX4_MAILBOX_SIZE = 4096, | 181 | MLX4_MAILBOX_SIZE = 4096, |
| 175 | MLX4_ACCESS_MEM_ALIGN = 256, | 182 | MLX4_ACCESS_MEM_ALIGN = 256, |
| 176 | }; | 183 | }; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index c95d659a39f2..977b0b164431 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -70,6 +70,7 @@ enum { | |||
| 70 | MLX4_FLAG_SLAVE = 1 << 3, | 70 | MLX4_FLAG_SLAVE = 1 << 3, |
| 71 | MLX4_FLAG_SRIOV = 1 << 4, | 71 | MLX4_FLAG_SRIOV = 1 << 4, |
| 72 | MLX4_FLAG_OLD_REG_MAC = 1 << 6, | 72 | MLX4_FLAG_OLD_REG_MAC = 1 << 6, |
| 73 | MLX4_FLAG_BONDED = 1 << 7 | ||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | enum { | 76 | enum { |
| @@ -201,7 +202,8 @@ enum { | |||
| 201 | MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17, | 202 | MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17, |
| 202 | MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, | 203 | MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, |
| 203 | MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19, | 204 | MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19, |
| 204 | MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20 | 205 | MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20, |
| 206 | MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21 | ||
| 205 | }; | 207 | }; |
| 206 | 208 | ||
| 207 | enum { | 209 | enum { |
| @@ -253,9 +255,14 @@ enum { | |||
| 253 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 255 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
| 254 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, | 256 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, |
| 255 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, | 257 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, |
| 258 | MLX4_BMME_FLAG_PORT_REMAP = 1 << 24, | ||
| 256 | MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28, | 259 | MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28, |
| 257 | }; | 260 | }; |
| 258 | 261 | ||
| 262 | enum { | ||
| 263 | MLX4_FLAG_PORT_REMAP = MLX4_BMME_FLAG_PORT_REMAP | ||
| 264 | }; | ||
| 265 | |||
| 259 | enum mlx4_event { | 266 | enum mlx4_event { |
| 260 | MLX4_EVENT_TYPE_COMP = 0x00, | 267 | MLX4_EVENT_TYPE_COMP = 0x00, |
| 261 | MLX4_EVENT_TYPE_PATH_MIG = 0x01, | 268 | MLX4_EVENT_TYPE_PATH_MIG = 0x01, |
| @@ -1378,6 +1385,8 @@ int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port); | |||
| 1378 | int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port); | 1385 | int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port); |
| 1379 | 1386 | ||
| 1380 | int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port); | 1387 | int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port); |
| 1388 | int mlx4_disable_rx_port_check(struct mlx4_dev *dev, bool dis); | ||
| 1389 | int mlx4_virt2phy_port_map(struct mlx4_dev *dev, u32 port1, u32 port2); | ||
| 1381 | int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port); | 1390 | int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port); |
| 1382 | int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); | 1391 | int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); |
| 1383 | int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, | 1392 | int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, |
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index 022055c8fb26..9553a73d2049 100644 --- a/include/linux/mlx4/driver.h +++ b/include/linux/mlx4/driver.h | |||
| @@ -49,6 +49,10 @@ enum mlx4_dev_event { | |||
| 49 | MLX4_DEV_EVENT_SLAVE_SHUTDOWN, | 49 | MLX4_DEV_EVENT_SLAVE_SHUTDOWN, |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | enum { | ||
| 53 | MLX4_INTFF_BONDING = 1 << 0 | ||
| 54 | }; | ||
| 55 | |||
| 52 | struct mlx4_interface { | 56 | struct mlx4_interface { |
| 53 | void * (*add) (struct mlx4_dev *dev); | 57 | void * (*add) (struct mlx4_dev *dev); |
| 54 | void (*remove)(struct mlx4_dev *dev, void *context); | 58 | void (*remove)(struct mlx4_dev *dev, void *context); |
| @@ -57,11 +61,26 @@ struct mlx4_interface { | |||
| 57 | void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); | 61 | void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); |
| 58 | struct list_head list; | 62 | struct list_head list; |
| 59 | enum mlx4_protocol protocol; | 63 | enum mlx4_protocol protocol; |
| 64 | int flags; | ||
| 60 | }; | 65 | }; |
| 61 | 66 | ||
| 62 | int mlx4_register_interface(struct mlx4_interface *intf); | 67 | int mlx4_register_interface(struct mlx4_interface *intf); |
| 63 | void mlx4_unregister_interface(struct mlx4_interface *intf); | 68 | void mlx4_unregister_interface(struct mlx4_interface *intf); |
| 64 | 69 | ||
| 70 | int mlx4_bond(struct mlx4_dev *dev); | ||
| 71 | int mlx4_unbond(struct mlx4_dev *dev); | ||
| 72 | static inline int mlx4_is_bonded(struct mlx4_dev *dev) | ||
| 73 | { | ||
| 74 | return !!(dev->flags & MLX4_FLAG_BONDED); | ||
| 75 | } | ||
| 76 | |||
| 77 | struct mlx4_port_map { | ||
| 78 | u8 port1; | ||
| 79 | u8 port2; | ||
| 80 | }; | ||
| 81 | |||
| 82 | int mlx4_port_map_set(struct mlx4_dev *dev, struct mlx4_port_map *v2p); | ||
| 83 | |||
| 65 | void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); | 84 | void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); |
| 66 | 85 | ||
| 67 | static inline u64 mlx4_mac_to_u64(u8 *addr) | 86 | static inline u64 mlx4_mac_to_u64(u8 *addr) |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 467ccdf94c98..2bbc62aa818a 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
| @@ -96,6 +96,7 @@ enum { | |||
| 96 | MLX4_QP_BIT_RRE = 1 << 15, | 96 | MLX4_QP_BIT_RRE = 1 << 15, |
| 97 | MLX4_QP_BIT_RWE = 1 << 14, | 97 | MLX4_QP_BIT_RWE = 1 << 14, |
| 98 | MLX4_QP_BIT_RAE = 1 << 13, | 98 | MLX4_QP_BIT_RAE = 1 << 13, |
| 99 | MLX4_QP_BIT_FPP = 1 << 3, | ||
| 99 | MLX4_QP_BIT_RIC = 1 << 4, | 100 | MLX4_QP_BIT_RIC = 1 << 4, |
| 100 | }; | 101 | }; |
| 101 | 102 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1347ac50d2af..ce784d5018e0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | #include <linux/netdev_features.h> | 51 | #include <linux/netdev_features.h> |
| 52 | #include <linux/neighbour.h> | 52 | #include <linux/neighbour.h> |
| 53 | #include <uapi/linux/netdevice.h> | 53 | #include <uapi/linux/netdevice.h> |
| 54 | #include <uapi/linux/if_bonding.h> | ||
| 54 | 55 | ||
| 55 | struct netpoll_info; | 56 | struct netpoll_info; |
| 56 | struct device; | 57 | struct device; |
| @@ -2056,6 +2057,7 @@ struct pcpu_sw_netstats { | |||
| 2056 | #define NETDEV_RESEND_IGMP 0x0016 | 2057 | #define NETDEV_RESEND_IGMP 0x0016 |
| 2057 | #define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ | 2058 | #define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ |
| 2058 | #define NETDEV_CHANGEINFODATA 0x0018 | 2059 | #define NETDEV_CHANGEINFODATA 0x0018 |
| 2060 | #define NETDEV_BONDING_INFO 0x0019 | ||
| 2059 | 2061 | ||
| 2060 | int register_netdevice_notifier(struct notifier_block *nb); | 2062 | int register_netdevice_notifier(struct notifier_block *nb); |
| 2061 | int unregister_netdevice_notifier(struct notifier_block *nb); | 2063 | int unregister_netdevice_notifier(struct notifier_block *nb); |
| @@ -3494,6 +3496,19 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, | |||
| 3494 | struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | 3496 | struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, |
| 3495 | netdev_features_t features); | 3497 | netdev_features_t features); |
| 3496 | 3498 | ||
| 3499 | struct netdev_bonding_info { | ||
| 3500 | ifslave slave; | ||
| 3501 | ifbond master; | ||
| 3502 | }; | ||
| 3503 | |||
| 3504 | struct netdev_notifier_bonding_info { | ||
| 3505 | struct netdev_notifier_info info; /* must be first */ | ||
| 3506 | struct netdev_bonding_info bonding_info; | ||
| 3507 | }; | ||
| 3508 | |||
| 3509 | void netdev_bonding_info_change(struct net_device *dev, | ||
| 3510 | struct netdev_bonding_info *bonding_info); | ||
| 3511 | |||
| 3497 | static inline | 3512 | static inline |
| 3498 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) | 3513 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) |
| 3499 | { | 3514 | { |
