diff options
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r-- | drivers/net/mlx4/en_main.c | 15 | ||||
-rw-r--r-- | drivers/net/mlx4/en_netdev.c | 10 | ||||
-rw-r--r-- | drivers/net/mlx4/en_port.c | 4 | ||||
-rw-r--r-- | drivers/net/mlx4/en_port.h | 3 | ||||
-rw-r--r-- | drivers/net/mlx4/fw.c | 3 | ||||
-rw-r--r-- | drivers/net/mlx4/intf.c | 21 | ||||
-rw-r--r-- | drivers/net/mlx4/main.c | 4 | ||||
-rw-r--r-- | drivers/net/mlx4/mlx4_en.h | 1 | ||||
-rw-r--r-- | drivers/net/mlx4/port.c | 19 |
9 files changed, 71 insertions, 9 deletions
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c index 143906417048..f6e0d40cd876 100644 --- a/drivers/net/mlx4/en_main.c +++ b/drivers/net/mlx4/en_main.c | |||
@@ -124,6 +124,13 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev) | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | static void *mlx4_en_get_netdev(struct mlx4_dev *dev, void *ctx, u8 port) | ||
128 | { | ||
129 | struct mlx4_en_dev *endev = ctx; | ||
130 | |||
131 | return endev->pndev[port]; | ||
132 | } | ||
133 | |||
127 | static void mlx4_en_event(struct mlx4_dev *dev, void *endev_ptr, | 134 | static void mlx4_en_event(struct mlx4_dev *dev, void *endev_ptr, |
128 | enum mlx4_dev_event event, int port) | 135 | enum mlx4_dev_event event, int port) |
129 | { | 136 | { |
@@ -282,9 +289,11 @@ err_free_res: | |||
282 | } | 289 | } |
283 | 290 | ||
284 | static struct mlx4_interface mlx4_en_interface = { | 291 | static struct mlx4_interface mlx4_en_interface = { |
285 | .add = mlx4_en_add, | 292 | .add = mlx4_en_add, |
286 | .remove = mlx4_en_remove, | 293 | .remove = mlx4_en_remove, |
287 | .event = mlx4_en_event, | 294 | .event = mlx4_en_event, |
295 | .get_dev = mlx4_en_get_netdev, | ||
296 | .protocol = MLX4_PROTOCOL_EN, | ||
288 | }; | 297 | }; |
289 | 298 | ||
290 | static int __init mlx4_en_init(void) | 299 | static int __init mlx4_en_init(void) |
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index 79478bd4211a..6d6806b361e3 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -69,6 +69,7 @@ static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | |||
69 | struct mlx4_en_priv *priv = netdev_priv(dev); | 69 | struct mlx4_en_priv *priv = netdev_priv(dev); |
70 | struct mlx4_en_dev *mdev = priv->mdev; | 70 | struct mlx4_en_dev *mdev = priv->mdev; |
71 | int err; | 71 | int err; |
72 | int idx; | ||
72 | 73 | ||
73 | if (!priv->vlgrp) | 74 | if (!priv->vlgrp) |
74 | return; | 75 | return; |
@@ -83,7 +84,10 @@ static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | |||
83 | if (err) | 84 | if (err) |
84 | en_err(priv, "Failed configuring VLAN filter\n"); | 85 | en_err(priv, "Failed configuring VLAN filter\n"); |
85 | } | 86 | } |
87 | if (mlx4_register_vlan(mdev->dev, priv->port, vid, &idx)) | ||
88 | en_err(priv, "failed adding vlan %d\n", vid); | ||
86 | mutex_unlock(&mdev->state_lock); | 89 | mutex_unlock(&mdev->state_lock); |
90 | |||
87 | } | 91 | } |
88 | 92 | ||
89 | static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | 93 | static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) |
@@ -91,6 +95,7 @@ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
91 | struct mlx4_en_priv *priv = netdev_priv(dev); | 95 | struct mlx4_en_priv *priv = netdev_priv(dev); |
92 | struct mlx4_en_dev *mdev = priv->mdev; | 96 | struct mlx4_en_dev *mdev = priv->mdev; |
93 | int err; | 97 | int err; |
98 | int idx; | ||
94 | 99 | ||
95 | if (!priv->vlgrp) | 100 | if (!priv->vlgrp) |
96 | return; | 101 | return; |
@@ -101,6 +106,11 @@ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
101 | 106 | ||
102 | /* Remove VID from port VLAN filter */ | 107 | /* Remove VID from port VLAN filter */ |
103 | mutex_lock(&mdev->state_lock); | 108 | mutex_lock(&mdev->state_lock); |
109 | if (!mlx4_find_cached_vlan(mdev->dev, priv->port, vid, &idx)) | ||
110 | mlx4_unregister_vlan(mdev->dev, priv->port, idx); | ||
111 | else | ||
112 | en_err(priv, "could not find vid %d in cache\n", vid); | ||
113 | |||
104 | if (mdev->device_up && priv->port_up) { | 114 | if (mdev->device_up && priv->port_up) { |
105 | err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp); | 115 | err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp); |
106 | if (err) | 116 | if (err) |
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c index aa3ef2aee5bf..7f5a3221e0c1 100644 --- a/drivers/net/mlx4/en_port.c +++ b/drivers/net/mlx4/en_port.c | |||
@@ -127,8 +127,8 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | |||
127 | memset(context, 0, sizeof *context); | 127 | memset(context, 0, sizeof *context); |
128 | 128 | ||
129 | context->base_qpn = cpu_to_be32(base_qpn); | 129 | context->base_qpn = cpu_to_be32(base_qpn); |
130 | context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_SHIFT | base_qpn); | 130 | context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_EN_SHIFT | base_qpn); |
131 | context->mcast = cpu_to_be32(1 << SET_PORT_PROMISC_SHIFT | base_qpn); | 131 | context->mcast = cpu_to_be32(1 << SET_PORT_PROMISC_MODE_SHIFT | base_qpn); |
132 | context->intra_no_vlan = 0; | 132 | context->intra_no_vlan = 0; |
133 | context->no_vlan = MLX4_NO_VLAN_IDX; | 133 | context->no_vlan = MLX4_NO_VLAN_IDX; |
134 | context->intra_vlan_miss = 0; | 134 | context->intra_vlan_miss = 0; |
diff --git a/drivers/net/mlx4/en_port.h b/drivers/net/mlx4/en_port.h index f6511aa2b7df..092e814b1981 100644 --- a/drivers/net/mlx4/en_port.h +++ b/drivers/net/mlx4/en_port.h | |||
@@ -36,7 +36,8 @@ | |||
36 | 36 | ||
37 | 37 | ||
38 | #define SET_PORT_GEN_ALL_VALID 0x7 | 38 | #define SET_PORT_GEN_ALL_VALID 0x7 |
39 | #define SET_PORT_PROMISC_SHIFT 31 | 39 | #define SET_PORT_PROMISC_EN_SHIFT 31 |
40 | #define SET_PORT_PROMISC_MODE_SHIFT 30 | ||
40 | 41 | ||
41 | enum { | 42 | enum { |
42 | MLX4_CMD_SET_VLAN_FLTR = 0x47, | 43 | MLX4_CMD_SET_VLAN_FLTR = 0x47, |
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index b716e1a1b298..b68eee2414c2 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -98,7 +98,8 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u32 flags) | |||
98 | [20] = "Address vector port checking support", | 98 | [20] = "Address vector port checking support", |
99 | [21] = "UD multicast support", | 99 | [21] = "UD multicast support", |
100 | [24] = "Demand paging support", | 100 | [24] = "Demand paging support", |
101 | [25] = "Router support" | 101 | [25] = "Router support", |
102 | [30] = "IBoE support" | ||
102 | }; | 103 | }; |
103 | int i; | 104 | int i; |
104 | 105 | ||
diff --git a/drivers/net/mlx4/intf.c b/drivers/net/mlx4/intf.c index 555067802751..73c94fcdfddf 100644 --- a/drivers/net/mlx4/intf.c +++ b/drivers/net/mlx4/intf.c | |||
@@ -161,3 +161,24 @@ void mlx4_unregister_device(struct mlx4_dev *dev) | |||
161 | 161 | ||
162 | mutex_unlock(&intf_mutex); | 162 | mutex_unlock(&intf_mutex); |
163 | } | 163 | } |
164 | |||
165 | void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port) | ||
166 | { | ||
167 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
168 | struct mlx4_device_context *dev_ctx; | ||
169 | unsigned long flags; | ||
170 | void *result = NULL; | ||
171 | |||
172 | spin_lock_irqsave(&priv->ctx_lock, flags); | ||
173 | |||
174 | list_for_each_entry(dev_ctx, &priv->ctx_list, list) | ||
175 | if (dev_ctx->intf->protocol == proto && dev_ctx->intf->get_dev) { | ||
176 | result = dev_ctx->intf->get_dev(dev, dev_ctx->context, port); | ||
177 | break; | ||
178 | } | ||
179 | |||
180 | spin_unlock_irqrestore(&priv->ctx_lock, flags); | ||
181 | |||
182 | return result; | ||
183 | } | ||
184 | EXPORT_SYMBOL_GPL(mlx4_get_protocol_dev); | ||
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 569fa3df381f..782f11d8fa71 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(use_prio, "Enable steering by VLAN priority on ETH ports " | |||
103 | 103 | ||
104 | static int log_mtts_per_seg = ilog2(MLX4_MTT_ENTRY_PER_SEG); | 104 | static int log_mtts_per_seg = ilog2(MLX4_MTT_ENTRY_PER_SEG); |
105 | module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444); | 105 | module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444); |
106 | MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-5)"); | 106 | MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-7)"); |
107 | 107 | ||
108 | int mlx4_check_port_params(struct mlx4_dev *dev, | 108 | int mlx4_check_port_params(struct mlx4_dev *dev, |
109 | enum mlx4_port_type *port_type) | 109 | enum mlx4_port_type *port_type) |
@@ -1310,7 +1310,7 @@ static int __init mlx4_verify_params(void) | |||
1310 | return -1; | 1310 | return -1; |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | if ((log_mtts_per_seg < 1) || (log_mtts_per_seg > 5)) { | 1313 | if ((log_mtts_per_seg < 1) || (log_mtts_per_seg > 7)) { |
1314 | pr_warning("mlx4_core: bad log_mtts_per_seg: %d\n", log_mtts_per_seg); | 1314 | pr_warning("mlx4_core: bad log_mtts_per_seg: %d\n", log_mtts_per_seg); |
1315 | return -1; | 1315 | return -1; |
1316 | } | 1316 | } |
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h index 1fc16ab7ad2f..dfed6a07c2d7 100644 --- a/drivers/net/mlx4/mlx4_en.h +++ b/drivers/net/mlx4/mlx4_en.h | |||
@@ -475,6 +475,7 @@ struct mlx4_en_priv { | |||
475 | char *mc_addrs; | 475 | char *mc_addrs; |
476 | int mc_addrs_cnt; | 476 | int mc_addrs_cnt; |
477 | struct mlx4_en_stat_out_mbox hw_stats; | 477 | struct mlx4_en_stat_out_mbox hw_stats; |
478 | int vids[128]; | ||
478 | }; | 479 | }; |
479 | 480 | ||
480 | 481 | ||
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index 606aa58afdea..56371ef328ef 100644 --- a/drivers/net/mlx4/port.c +++ b/drivers/net/mlx4/port.c | |||
@@ -182,6 +182,25 @@ static int mlx4_set_port_vlan_table(struct mlx4_dev *dev, u8 port, | |||
182 | return err; | 182 | return err; |
183 | } | 183 | } |
184 | 184 | ||
185 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx) | ||
186 | { | ||
187 | struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; | ||
188 | int i; | ||
189 | |||
190 | for (i = 0; i < MLX4_MAX_VLAN_NUM; ++i) { | ||
191 | if (table->refs[i] && | ||
192 | (vid == (MLX4_VLAN_MASK & | ||
193 | be32_to_cpu(table->entries[i])))) { | ||
194 | /* VLAN already registered, increase reference count */ | ||
195 | *idx = i; | ||
196 | return 0; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | return -ENOENT; | ||
201 | } | ||
202 | EXPORT_SYMBOL_GPL(mlx4_find_cached_vlan); | ||
203 | |||
185 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) | 204 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) |
186 | { | 205 | { |
187 | struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; | 206 | struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; |