aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorMoni Shoua <monis@mellanox.com>2015-02-03 09:48:32 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-04 19:14:24 -0500
commit59e14e325066be49b49b6c2503337c69a9ee29fc (patch)
tree4969e69e3ea30ed3f26a51b1729e715af1f69ddf /drivers/net/ethernet
parent69e6113343cfe983511904ffca0d7a1466460b67 (diff)
net/mlx4_core: Port aggregation low level interface
Implement the hardware interface required for port aggregation. 1. Disable RX port check on receive - don't perform a validity check that matches to QP's port and the port where the packet is received. 2. Virtual to physical port remap - configure virtual to physical port mapping. Port remap capability for virtual functions. Signed-off-by: Moni Shoua <monis@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')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c9
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c56
2 files changed, 60 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 154effbfd8be..a681d7c0bb9f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -1583,6 +1583,15 @@ static struct mlx4_cmd_info cmd_info[] = {
1583 .verify = NULL, 1583 .verify = NULL,
1584 .wrapper = mlx4_CMD_EPERM_wrapper 1584 .wrapper = mlx4_CMD_EPERM_wrapper
1585 }, 1585 },
1586 {
1587 .opcode = MLX4_CMD_VIRT_PORT_MAP,
1588 .has_inbox = false,
1589 .has_outbox = false,
1590 .out_is_imm = false,
1591 .encode_slave_id = false,
1592 .verify = NULL,
1593 .wrapper = mlx4_CMD_EPERM_wrapper
1594 },
1586}; 1595};
1587 1596
1588static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave, 1597static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave,
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index dbabfae3a3de..4b08a393ebcb 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -142,7 +142,8 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
142 [17] = "Asymmetric EQs support", 142 [17] = "Asymmetric EQs support",
143 [18] = "More than 80 VFs support", 143 [18] = "More than 80 VFs support",
144 [19] = "Performance optimized for limited rule configuration flow steering support", 144 [19] = "Performance optimized for limited rule configuration flow steering support",
145 [20] = "Recoverable error events support" 145 [20] = "Recoverable error events support",
146 [21] = "Port Remap support"
146 }; 147 };
147 int i; 148 int i;
148 149
@@ -863,6 +864,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
863 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_EQE_STRIDE; 864 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_EQE_STRIDE;
864 MLX4_GET(dev_cap->bmme_flags, outbox, 865 MLX4_GET(dev_cap->bmme_flags, outbox,
865 QUERY_DEV_CAP_BMME_FLAGS_OFFSET); 866 QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
867 if (dev_cap->bmme_flags & MLX4_FLAG_PORT_REMAP)
868 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_PORT_REMAP;
866 MLX4_GET(field, outbox, QUERY_DEV_CAP_CONFIG_DEV_OFFSET); 869 MLX4_GET(field, outbox, QUERY_DEV_CAP_CONFIG_DEV_OFFSET);
867 if (field & 0x20) 870 if (field & 0x20)
868 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_CONFIG_DEV; 871 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_CONFIG_DEV;
@@ -1120,9 +1123,10 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave,
1120 field &= 0x7f; 1123 field &= 0x7f;
1121 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET); 1124 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET);
1122 1125
1123 /* For guests, disable mw type 2 */ 1126 /* For guests, disable mw type 2 and port remap*/
1124 MLX4_GET(bmme_flags, outbox->buf, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); 1127 MLX4_GET(bmme_flags, outbox->buf, QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
1125 bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; 1128 bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN;
1129 bmme_flags &= ~MLX4_FLAG_PORT_REMAP;
1126 MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); 1130 MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
1127 1131
1128 /* turn off device-managed steering capability if not enabled */ 1132 /* turn off device-managed steering capability if not enabled */
@@ -2100,13 +2104,16 @@ struct mlx4_config_dev {
2100 __be32 rsvd1[3]; 2104 __be32 rsvd1[3];
2101 __be16 vxlan_udp_dport; 2105 __be16 vxlan_udp_dport;
2102 __be16 rsvd2; 2106 __be16 rsvd2;
2103 __be32 rsvd3[27]; 2107 __be32 rsvd3;
2104 __be16 rsvd4; 2108 __be32 roce_flags;
2105 u8 rsvd5; 2109 __be32 rsvd4[25];
2110 __be16 rsvd5;
2111 u8 rsvd6;
2106 u8 rx_checksum_val; 2112 u8 rx_checksum_val;
2107}; 2113};
2108 2114
2109#define MLX4_VXLAN_UDP_DPORT (1 << 0) 2115#define MLX4_VXLAN_UDP_DPORT (1 << 0)
2116#define MLX4_DISABLE_RX_PORT BIT(18)
2110 2117
2111static int mlx4_CONFIG_DEV_set(struct mlx4_dev *dev, struct mlx4_config_dev *config_dev) 2118static int mlx4_CONFIG_DEV_set(struct mlx4_dev *dev, struct mlx4_config_dev *config_dev)
2112{ 2119{
@@ -2209,6 +2216,45 @@ int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port)
2209} 2216}
2210EXPORT_SYMBOL_GPL(mlx4_config_vxlan_port); 2217EXPORT_SYMBOL_GPL(mlx4_config_vxlan_port);
2211 2218
2219#define CONFIG_DISABLE_RX_PORT BIT(15)
2220int mlx4_disable_rx_port_check(struct mlx4_dev *dev, bool dis)
2221{
2222 struct mlx4_config_dev config_dev;
2223
2224 memset(&config_dev, 0, sizeof(config_dev));
2225 config_dev.update_flags = cpu_to_be32(MLX4_DISABLE_RX_PORT);
2226 if (dis)
2227 config_dev.roce_flags =
2228 cpu_to_be32(CONFIG_DISABLE_RX_PORT);
2229
2230 return mlx4_CONFIG_DEV_set(dev, &config_dev);
2231}
2232
2233int mlx4_virt2phy_port_map(struct mlx4_dev *dev, u32 port1, u32 port2)
2234{
2235 struct mlx4_cmd_mailbox *mailbox;
2236 struct {
2237 __be32 v_port1;
2238 __be32 v_port2;
2239 } *v2p;
2240 int err;
2241
2242 mailbox = mlx4_alloc_cmd_mailbox(dev);
2243 if (IS_ERR(mailbox))
2244 return -ENOMEM;
2245
2246 v2p = mailbox->buf;
2247 v2p->v_port1 = cpu_to_be32(port1);
2248 v2p->v_port2 = cpu_to_be32(port2);
2249
2250 err = mlx4_cmd(dev, mailbox->dma, 0,
2251 MLX4_SET_PORT_VIRT2PHY, MLX4_CMD_VIRT_PORT_MAP,
2252 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE);
2253
2254 mlx4_free_cmd_mailbox(dev, mailbox);
2255 return err;
2256}
2257
2212 2258
2213int mlx4_SET_ICM_SIZE(struct mlx4_dev *dev, u64 icm_size, u64 *aux_pages) 2259int mlx4_SET_ICM_SIZE(struct mlx4_dev *dev, u64 icm_size, u64 *aux_pages)
2214{ 2260{