diff options
author | Hadar Hen Zion <hadarh@mellanox.com> | 2013-04-10 21:56:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-11 16:12:40 -0400 |
commit | fd91c49fb047a4a28c694982548aee7bea9c365b (patch) | |
tree | 808b258378da51816110bf7240c9dd753a25e66a /drivers/net/ethernet/mellanox | |
parent | 4b49f58fff00e6e9b24eaa31d4c6324393d76b0a (diff) |
net/mlx4_core: Add helper function to translate B0 steering rules to DMFS
A pre-step for supporting guests that use B0 steering over a hypervisor
that runs in DMFS (device managed flow steering mode). Add helper function
which allows to translate L2 attachments / detachments provided in B0 mode
to DMFS rules.
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mcg.c | 51 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4.h | 4 |
2 files changed, 33 insertions, 22 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index 52685524708d..ffc78d2cb0cf 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -1125,28 +1125,11 @@ static int mlx4_QP_ATTACH(struct mlx4_dev *dev, struct mlx4_qp *qp, | |||
1125 | return err; | 1125 | return err; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | 1128 | int mlx4_trans_to_dmfs_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, |
1129 | u8 port, int block_mcast_loopback, | 1129 | u8 gid[16], u8 port, |
1130 | enum mlx4_protocol prot, u64 *reg_id) | 1130 | int block_mcast_loopback, |
1131 | enum mlx4_protocol prot, u64 *reg_id) | ||
1131 | { | 1132 | { |
1132 | |||
1133 | switch (dev->caps.steering_mode) { | ||
1134 | case MLX4_STEERING_MODE_A0: | ||
1135 | if (prot == MLX4_PROT_ETH) | ||
1136 | return 0; | ||
1137 | |||
1138 | case MLX4_STEERING_MODE_B0: | ||
1139 | if (prot == MLX4_PROT_ETH) | ||
1140 | gid[7] |= (MLX4_MC_STEER << 1); | ||
1141 | |||
1142 | if (mlx4_is_mfunc(dev)) | ||
1143 | return mlx4_QP_ATTACH(dev, qp, gid, 1, | ||
1144 | block_mcast_loopback, prot); | ||
1145 | return mlx4_qp_attach_common(dev, qp, gid, | ||
1146 | block_mcast_loopback, prot, | ||
1147 | MLX4_MC_STEER); | ||
1148 | |||
1149 | case MLX4_STEERING_MODE_DEVICE_MANAGED: { | ||
1150 | struct mlx4_spec_list spec = { {NULL} }; | 1133 | struct mlx4_spec_list spec = { {NULL} }; |
1151 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | 1134 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); |
1152 | 1135 | ||
@@ -1180,8 +1163,32 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | |||
1180 | list_add_tail(&spec.list, &rule.list); | 1163 | list_add_tail(&spec.list, &rule.list); |
1181 | 1164 | ||
1182 | return mlx4_flow_attach(dev, &rule, reg_id); | 1165 | return mlx4_flow_attach(dev, &rule, reg_id); |
1183 | } | 1166 | } |
1184 | 1167 | ||
1168 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | ||
1169 | u8 port, int block_mcast_loopback, | ||
1170 | enum mlx4_protocol prot, u64 *reg_id) | ||
1171 | { | ||
1172 | switch (dev->caps.steering_mode) { | ||
1173 | case MLX4_STEERING_MODE_A0: | ||
1174 | if (prot == MLX4_PROT_ETH) | ||
1175 | return 0; | ||
1176 | |||
1177 | case MLX4_STEERING_MODE_B0: | ||
1178 | if (prot == MLX4_PROT_ETH) | ||
1179 | gid[7] |= (MLX4_MC_STEER << 1); | ||
1180 | |||
1181 | if (mlx4_is_mfunc(dev)) | ||
1182 | return mlx4_QP_ATTACH(dev, qp, gid, 1, | ||
1183 | block_mcast_loopback, prot); | ||
1184 | return mlx4_qp_attach_common(dev, qp, gid, | ||
1185 | block_mcast_loopback, prot, | ||
1186 | MLX4_MC_STEER); | ||
1187 | |||
1188 | case MLX4_STEERING_MODE_DEVICE_MANAGED: | ||
1189 | return mlx4_trans_to_dmfs_attach(dev, qp, gid, port, | ||
1190 | block_mcast_loopback, | ||
1191 | prot, reg_id); | ||
1185 | default: | 1192 | default: |
1186 | return -EINVAL; | 1193 | return -EINVAL; |
1187 | } | 1194 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index d738454116a0..252f4ba7f32c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -1190,6 +1190,10 @@ int mlx4_qp_detach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | |||
1190 | int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | 1190 | int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
1191 | int block_mcast_loopback, enum mlx4_protocol prot, | 1191 | int block_mcast_loopback, enum mlx4_protocol prot, |
1192 | enum mlx4_steer_type steer); | 1192 | enum mlx4_steer_type steer); |
1193 | int mlx4_trans_to_dmfs_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, | ||
1194 | u8 gid[16], u8 port, | ||
1195 | int block_mcast_loopback, | ||
1196 | enum mlx4_protocol prot, u64 *reg_id); | ||
1193 | int mlx4_SET_MCAST_FLTR_wrapper(struct mlx4_dev *dev, int slave, | 1197 | int mlx4_SET_MCAST_FLTR_wrapper(struct mlx4_dev *dev, int slave, |
1194 | struct mlx4_vhcr *vhcr, | 1198 | struct mlx4_vhcr *vhcr, |
1195 | struct mlx4_cmd_mailbox *inbox, | 1199 | struct mlx4_cmd_mailbox *inbox, |