mlx4_core: slave multicast support
PATCH v4 12/19 mlx4_core: slave multicast support
Multicast table processing requires multiple related commands.
To keep things simple, low-level multicast handling is done only by the master; a new virtual command is added to allow slaves to attach/detach QPs to mulitcast groups at a higher abstraction level.
The multicast attachment mechanism is used both by IB and Ethernet,
so we need to specify for each multicast address (whether it is gid or mac) its protocol.
For ethernet addresses, their VEP number should be specified. This field is set according device capabilities. Search and hash calculation is also done according to this field.
A Ethernet ports now need to register to the multicast groups, we can not longer use the default multicast queue per port because of the multiple "clients" per port.
--- drivers/infiniband/hw/mlx4/main.c | 6 +- drivers/net/mlx4/cmd.c | 8 +++ drivers/net/mlx4/en_netdev.c | 42 ++++++++++++- drivers/net/mlx4/en_port.c | 4 +- drivers/net/mlx4/en_port.h | 5 ++ drivers/net/mlx4/fw.c | 4 + drivers/net/mlx4/fw.h | 2 + drivers/net/mlx4/main.c | 2 + drivers/net/mlx4/mcg.c | 127 +++++++++++++++++++++++++++++++----- drivers/net/mlx4/mlx4.h | 4 + drivers/net/mlx4/port.c | 4 +- include/linux/mlx4/cmd.h | 1 + include/linux/mlx4/device.h | 14 ++++- 13 files changed, 196 insertions(+), 27 deletions(-)
drivers/infiniband/hw/mlx4/main.c +4 -2
@@ -452,13 +452,15 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)return mlx4_multicast_attach (to_mdev (ibqp->device)->dev, &to_mqp (ibqp)->mqp, gid->raw, !!(to_mqp (ibqp)->flags & -MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK )); +MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK ), +MLX4_PROT_IB_IPV6 ); }static int mlx4_ib_mcg_detach (struct ib_qp *ibqp,union ib_gid *gid,u16 lid) {return mlx4_multicast_detach (to_mdev (ibqp->device)->dev, - &to_mqp (ibqp)->mqp, gid->raw); + &to_mqp (ibqp)->mqp, gid->raw, +MLX4_PROT_IB_IPV6 ); }static int init_node_data (struct mlx4_ib_dev *dev)
drivers/net/mlx4/cmd.c +8 -0
@@ -903,6 +903,14 @@ static struct mlx4_cmd_info {/* Native multicast commands are not available for guests */ { + .opcode = MLX4_CMD_MCAST_ATTACH, + .has_inbox = true, + .has_outbox = false, + .out_is_imm = false, + .verify = NULL, + .wrapper = mlx4_MCAST_wrapper + }, + { .opcode = MLX4_CMD_DIAG_RPRT, .has_inbox = false, .has_outbox = true,
drivers/net/mlx4/en_netdev.c +40 -2
96 lines not on this page · raw message
drivers/net/mlx4/en_port.c +3 -1
@@ -119,6 +119,7 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,struct mlx4_set_port_rqp_calc_context *context;int err;u32 in_mod; +u32 m_promisc = (dev->caps.vep_mc_steering) ?MCAST_DIRECT :MCAST_DEFAULT ; mailbox =mlx4_alloc_cmd_mailbox (dev);if (IS_ERR (mailbox))
@@ -129,7 +130,8 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, context->base_qpn =cpu_to_be32 (base_qpn); context->n_mac =0x7 ; context->promisc =cpu_to_be32 (promisc <<SET_PORT_PROMISC_SHIFT | base_qpn); - context->mcast =cpu_to_be32 (1 <<SET_PORT_PROMISC_SHIFT | base_qpn); + context->mcast =cpu_to_be32 ((m_promisc <<SET_PORT_MC_PROMISC_SHIFT ) | + base_qpn); context->intra_no_vlan =0 ; context->no_vlan =MLX4_NO_VLAN_IDX ; context->intra_vlan_miss =0 ;
drivers/net/mlx4/en_port.h +5 -0
@@ -39,6 +39,11 @@#define SET_PORT_PROMISC_SHIFT 31#define SET_PORT_MC_PROMISC_SHIFT 30 +enum { +MCAST_DIRECT_ONLY =0 , +MCAST_DIRECT =1 , +MCAST_DEFAULT =2 +};struct mlx4_set_port_general_context {u8 reserved[3 ];
drivers/net/mlx4/fw.c +4 -0
@@ -229,6 +229,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)#define QUERY_DEV_CAP_MAX_GID_OFFSET 0x3b#define QUERY_DEV_CAP_RATE_SUPPORT_OFFSET 0x3c#define QUERY_DEV_CAP_MAX_PKEY_OFFSET 0x3f +#define QUERY_DEV_CAP_ETH_UC_LOOPBACK_OFFSET 0x43#define QUERY_DEV_CAP_FLAGS_OFFSET 0x44#define QUERY_DEV_CAP_RSVD_UAR_OFFSET 0x48#define QUERY_DEV_CAP_UAR_SZ_OFFSET 0x49
@@ -323,6 +324,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) dev_cap->max_msg_sz =1 << (field &0x1f );MLX4_GET (stat_rate, outbox,QUERY_DEV_CAP_RATE_SUPPORT_OFFSET ); dev_cap->stat_rate_support = stat_rate; +MLX4_GET (field, outbox,QUERY_DEV_CAP_ETH_UC_LOOPBACK_OFFSET ); + dev_cap->vep_uc_steering = field &0x4 ; + dev_cap->vep_mc_steering = field &0x8 ;MLX4_GET (dev_cap->flags, outbox,QUERY_DEV_CAP_FLAGS_OFFSET );MLX4_GET (field, outbox,QUERY_DEV_CAP_RSVD_UAR_OFFSET ); dev_cap->reserved_uars = field >>4 ;
drivers/net/mlx4/fw.h +2 -0
@@ -76,6 +76,8 @@ struct mlx4_dev_cap {u16 eth_mtu[MLX4_MAX_PORTS +1 ];u16 stat_rate_support;u32 flags; +int vep_uc_steering; +int vep_mc_steering;int reserved_uars;int uar_size;int min_page_sz;
drivers/net/mlx4/main.c +2 -0
@@ -245,6 +245,8 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) dev->caps.bmme_flags = dev_cap->bmme_flags; dev->caps.reserved_lkey = dev_cap->reserved_lkey; dev->caps.stat_rate_support = dev_cap->stat_rate_support; + dev->caps.vep_uc_steering = dev_cap->vep_uc_steering; + dev->caps.vep_mc_steering = dev_cap->vep_mc_steering; dev->caps.max_gso_sz = dev_cap->max_gso_sz; dev->caps.log_num_macs = log_num_mac;
drivers/net/mlx4/mcg.c +109 -18
233 lines not on this page · raw message
drivers/net/mlx4/mlx4.h +4 -0
@@ -550,4 +550,8 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *v struct mlx4_cmd_mailbox *outbox);int mlx4_get_port_ib_caps (struct mlx4_dev *dev,u8 port,__be32 *caps); +int mlx4_MCAST_wrapper (struct mlx4_dev *dev,int slave,struct mlx4_vhcr *vhcr, +struct mlx4_cmd_mailbox *inbox, +struct mlx4_cmd_mailbox *outbox); +#endif /* MLX4_H */
drivers/net/mlx4/port.c +2 -2
@@ -389,9 +389,9 @@ int mlx4_SET_PORT_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhc promisc <<SET_PORT_PROMISC_SHIFT | port_info->base_qpn); promisc =be32_to_cpu (qpn_context->mcast) >> -SET_PORT_PROMISC_SHIFT ; +SET_PORT_MC_PROMISC_SHIFT ; qpn_context->mcast =cpu_to_be32 ( - promisc <<SET_PORT_PROMISC_SHIFT | + promisc <<SET_PORT_MC_PROMISC_SHIFT | port_info->base_qpn);break ;case MLX4_SET_PORT_GENERAL :
include/linux/mlx4/cmd.h +1 -0
@@ -131,6 +131,7 @@ enum {MLX4_CMD_REPLACE_RES =0xf02 ,MLX4_CMD_GET_EVENT =0xf03 ,MLX4_CMD_QUERY_SLAVE_CAP =0xf04 , +MLX4_CMD_MCAST_ATTACH =0xf05 ,/* debug commands */ MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
include/linux/mlx4/device.h +12 -2
@@ -148,6 +148,13 @@ enum { MLX4_STAT_RATE_OFFSET = 5 }; +enum mlx4_protocol { +MLX4_PROT_IB_IPV6 =0 , +MLX4_PROT_ETH , +MLX4_PROT_IB_IPV4 , +MLX4_PROT_FCOE +}; +enum {MLX4_MTT_FLAG_PRESENT =1 };
@@ -240,6 +247,8 @@ struct mlx4_caps {u32 bmme_flags;u32 reserved_lkey;u16 stat_rate_support; +int vep_uc_steering; +int vep_mc_steering;u8 port_width_cap[MLX4_MAX_PORTS +1 ];int max_gso_sz;int reserved_qps_cnt[MLX4_NUM_QP_REGION ];
@@ -488,8 +497,9 @@ int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);int mlx4_CLOSE_PORT (struct mlx4_dev *dev,int port);int mlx4_multicast_attach (struct mlx4_dev *dev,struct mlx4_qp *qp,u8 gid[16 ], -int block_mcast_loopback); -int mlx4_multicast_detach (struct mlx4_dev *dev,struct mlx4_qp *qp,u8 gid[16 ]); +int block_mcast_loopback,enum mlx4_protocol prot); +int mlx4_multicast_detach (struct mlx4_dev *dev,struct mlx4_qp *qp,u8 gid[16 ], +enum mlx4_protocol prot);int mlx4_register_mac (struct mlx4_dev *dev,u8 port,u64 mac,int *qpn);void mlx4_unregister_mac (struct mlx4_dev *dev,u8 port,int qpn);
Signature · 6 lines
1.6.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html