diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-07-20 00:54:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 16:47:57 -0400 |
commit | 53515734888e018af7bcec6b4464bd9e28f1d655 (patch) | |
tree | 17c7b3f3b8679cda9c47b9d680602ba972eeb2fa /drivers/net/vxge | |
parent | b2cb09b1a7725408a3464b2f593ceb222eff1042 (diff) |
vxge: do vlan cleanup
- unify vlan and nonvlan rx path
- kill vdev->vlgrp and vxge_vlan_rx_register
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge')
-rw-r--r-- | drivers/net/vxge/vxge-main.c | 91 | ||||
-rw-r--r-- | drivers/net/vxge/vxge-main.h | 5 |
2 files changed, 16 insertions, 80 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index 15d878b4547c..178348a258d2 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 44 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
45 | 45 | ||
46 | #include <linux/bitops.h> | ||
46 | #include <linux/if_vlan.h> | 47 | #include <linux/if_vlan.h> |
47 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
48 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
@@ -308,13 +309,10 @@ vxge_rx_complete(struct vxge_ring *ring, struct sk_buff *skb, u16 vlan, | |||
308 | "%s: %s:%d skb protocol = %d", | 309 | "%s: %s:%d skb protocol = %d", |
309 | ring->ndev->name, __func__, __LINE__, skb->protocol); | 310 | ring->ndev->name, __func__, __LINE__, skb->protocol); |
310 | 311 | ||
311 | if (ring->vlgrp && ext_info->vlan && | 312 | if (ext_info->vlan && |
312 | (ring->vlan_tag_strip == | 313 | ring->vlan_tag_strip == VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE) |
313 | VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE)) | 314 | __vlan_hwaccel_put_tag(skb, ext_info->vlan); |
314 | vlan_gro_receive(ring->napi_p, ring->vlgrp, | 315 | napi_gro_receive(ring->napi_p, skb); |
315 | ext_info->vlan, skb); | ||
316 | else | ||
317 | napi_gro_receive(ring->napi_p, skb); | ||
318 | 316 | ||
319 | vxge_debug_entryexit(VXGE_TRACE, | 317 | vxge_debug_entryexit(VXGE_TRACE, |
320 | "%s: %s:%d Exiting...", ring->ndev->name, __func__, __LINE__); | 318 | "%s: %s:%d Exiting...", ring->ndev->name, __func__, __LINE__); |
@@ -1489,15 +1487,11 @@ vxge_restore_vpath_vid_table(struct vxge_vpath *vpath) | |||
1489 | struct vxgedev *vdev = vpath->vdev; | 1487 | struct vxgedev *vdev = vpath->vdev; |
1490 | u16 vid; | 1488 | u16 vid; |
1491 | 1489 | ||
1492 | if (vdev->vlgrp && vpath->is_open) { | 1490 | if (!vpath->is_open) |
1491 | return status; | ||
1493 | 1492 | ||
1494 | for (vid = 0; vid < VLAN_N_VID; vid++) { | 1493 | for_each_set_bit(vid, vdev->active_vlans, VLAN_N_VID) |
1495 | if (!vlan_group_get_device(vdev->vlgrp, vid)) | 1494 | status = vxge_hw_vpath_vid_add(vpath->handle, vid); |
1496 | continue; | ||
1497 | /* Add these vlan to the vid table */ | ||
1498 | status = vxge_hw_vpath_vid_add(vpath->handle, vid); | ||
1499 | } | ||
1500 | } | ||
1501 | 1495 | ||
1502 | return status; | 1496 | return status; |
1503 | } | 1497 | } |
@@ -3303,60 +3297,6 @@ static void vxge_tx_watchdog(struct net_device *dev) | |||
3303 | } | 3297 | } |
3304 | 3298 | ||
3305 | /** | 3299 | /** |
3306 | * vxge_vlan_rx_register | ||
3307 | * @dev: net device pointer. | ||
3308 | * @grp: vlan group | ||
3309 | * | ||
3310 | * Vlan group registration | ||
3311 | */ | ||
3312 | static void | ||
3313 | vxge_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | ||
3314 | { | ||
3315 | struct vxgedev *vdev; | ||
3316 | struct vxge_vpath *vpath; | ||
3317 | int vp; | ||
3318 | u64 vid; | ||
3319 | enum vxge_hw_status status; | ||
3320 | int i; | ||
3321 | |||
3322 | vxge_debug_entryexit(VXGE_TRACE, "%s:%d", __func__, __LINE__); | ||
3323 | |||
3324 | vdev = netdev_priv(dev); | ||
3325 | |||
3326 | vpath = &vdev->vpaths[0]; | ||
3327 | if ((NULL == grp) && (vpath->is_open)) { | ||
3328 | /* Get the first vlan */ | ||
3329 | status = vxge_hw_vpath_vid_get(vpath->handle, &vid); | ||
3330 | |||
3331 | while (status == VXGE_HW_OK) { | ||
3332 | |||
3333 | /* Delete this vlan from the vid table */ | ||
3334 | for (vp = 0; vp < vdev->no_of_vpath; vp++) { | ||
3335 | vpath = &vdev->vpaths[vp]; | ||
3336 | if (!vpath->is_open) | ||
3337 | continue; | ||
3338 | |||
3339 | vxge_hw_vpath_vid_delete(vpath->handle, vid); | ||
3340 | } | ||
3341 | |||
3342 | /* Get the next vlan to be deleted */ | ||
3343 | vpath = &vdev->vpaths[0]; | ||
3344 | status = vxge_hw_vpath_vid_get(vpath->handle, &vid); | ||
3345 | } | ||
3346 | } | ||
3347 | |||
3348 | vdev->vlgrp = grp; | ||
3349 | |||
3350 | for (i = 0; i < vdev->no_of_vpath; i++) { | ||
3351 | if (vdev->vpaths[i].is_configured) | ||
3352 | vdev->vpaths[i].ring.vlgrp = grp; | ||
3353 | } | ||
3354 | |||
3355 | vxge_debug_entryexit(VXGE_TRACE, | ||
3356 | "%s:%d Exiting...", __func__, __LINE__); | ||
3357 | } | ||
3358 | |||
3359 | /** | ||
3360 | * vxge_vlan_rx_add_vid | 3300 | * vxge_vlan_rx_add_vid |
3361 | * @dev: net device pointer. | 3301 | * @dev: net device pointer. |
3362 | * @vid: vid | 3302 | * @vid: vid |
@@ -3366,12 +3306,10 @@ vxge_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | |||
3366 | static void | 3306 | static void |
3367 | vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | 3307 | vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) |
3368 | { | 3308 | { |
3369 | struct vxgedev *vdev; | 3309 | struct vxgedev *vdev = netdev_priv(dev); |
3370 | struct vxge_vpath *vpath; | 3310 | struct vxge_vpath *vpath; |
3371 | int vp_id; | 3311 | int vp_id; |
3372 | 3312 | ||
3373 | vdev = netdev_priv(dev); | ||
3374 | |||
3375 | /* Add these vlan to the vid table */ | 3313 | /* Add these vlan to the vid table */ |
3376 | for (vp_id = 0; vp_id < vdev->no_of_vpath; vp_id++) { | 3314 | for (vp_id = 0; vp_id < vdev->no_of_vpath; vp_id++) { |
3377 | vpath = &vdev->vpaths[vp_id]; | 3315 | vpath = &vdev->vpaths[vp_id]; |
@@ -3379,6 +3317,7 @@ vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | |||
3379 | continue; | 3317 | continue; |
3380 | vxge_hw_vpath_vid_add(vpath->handle, vid); | 3318 | vxge_hw_vpath_vid_add(vpath->handle, vid); |
3381 | } | 3319 | } |
3320 | set_bit(vid, vdev->active_vlans); | ||
3382 | } | 3321 | } |
3383 | 3322 | ||
3384 | /** | 3323 | /** |
@@ -3391,16 +3330,12 @@ vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | |||
3391 | static void | 3330 | static void |
3392 | vxge_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | 3331 | vxge_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) |
3393 | { | 3332 | { |
3394 | struct vxgedev *vdev; | 3333 | struct vxgedev *vdev = netdev_priv(dev); |
3395 | struct vxge_vpath *vpath; | 3334 | struct vxge_vpath *vpath; |
3396 | int vp_id; | 3335 | int vp_id; |
3397 | 3336 | ||
3398 | vxge_debug_entryexit(VXGE_TRACE, "%s:%d", __func__, __LINE__); | 3337 | vxge_debug_entryexit(VXGE_TRACE, "%s:%d", __func__, __LINE__); |
3399 | 3338 | ||
3400 | vdev = netdev_priv(dev); | ||
3401 | |||
3402 | vlan_group_set_device(vdev->vlgrp, vid, NULL); | ||
3403 | |||
3404 | /* Delete this vlan from the vid table */ | 3339 | /* Delete this vlan from the vid table */ |
3405 | for (vp_id = 0; vp_id < vdev->no_of_vpath; vp_id++) { | 3340 | for (vp_id = 0; vp_id < vdev->no_of_vpath; vp_id++) { |
3406 | vpath = &vdev->vpaths[vp_id]; | 3341 | vpath = &vdev->vpaths[vp_id]; |
@@ -3410,6 +3345,7 @@ vxge_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
3410 | } | 3345 | } |
3411 | vxge_debug_entryexit(VXGE_TRACE, | 3346 | vxge_debug_entryexit(VXGE_TRACE, |
3412 | "%s:%d Exiting...", __func__, __LINE__); | 3347 | "%s:%d Exiting...", __func__, __LINE__); |
3348 | clear_bit(vid, vdev->active_vlans); | ||
3413 | } | 3349 | } |
3414 | 3350 | ||
3415 | static const struct net_device_ops vxge_netdev_ops = { | 3351 | static const struct net_device_ops vxge_netdev_ops = { |
@@ -3424,7 +3360,6 @@ static const struct net_device_ops vxge_netdev_ops = { | |||
3424 | .ndo_change_mtu = vxge_change_mtu, | 3360 | .ndo_change_mtu = vxge_change_mtu, |
3425 | .ndo_fix_features = vxge_fix_features, | 3361 | .ndo_fix_features = vxge_fix_features, |
3426 | .ndo_set_features = vxge_set_features, | 3362 | .ndo_set_features = vxge_set_features, |
3427 | .ndo_vlan_rx_register = vxge_vlan_rx_register, | ||
3428 | .ndo_vlan_rx_kill_vid = vxge_vlan_rx_kill_vid, | 3363 | .ndo_vlan_rx_kill_vid = vxge_vlan_rx_kill_vid, |
3429 | .ndo_vlan_rx_add_vid = vxge_vlan_rx_add_vid, | 3364 | .ndo_vlan_rx_add_vid = vxge_vlan_rx_add_vid, |
3430 | .ndo_tx_timeout = vxge_tx_watchdog, | 3365 | .ndo_tx_timeout = vxge_tx_watchdog, |
diff --git a/drivers/net/vxge/vxge-main.h b/drivers/net/vxge/vxge-main.h index 66e6de86ff0c..f52a42d1dbb7 100644 --- a/drivers/net/vxge/vxge-main.h +++ b/drivers/net/vxge/vxge-main.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #include "vxge-config.h" | 18 | #include "vxge-config.h" |
19 | #include "vxge-version.h" | 19 | #include "vxge-version.h" |
20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
21 | #include <linux/bitops.h> | ||
22 | #include <linux/if_vlan.h> | ||
21 | 23 | ||
22 | #define VXGE_DRIVER_NAME "vxge" | 24 | #define VXGE_DRIVER_NAME "vxge" |
23 | #define VXGE_DRIVER_VENDOR "Neterion, Inc" | 25 | #define VXGE_DRIVER_VENDOR "Neterion, Inc" |
@@ -287,7 +289,6 @@ struct vxge_ring { | |||
287 | #define VXGE_MAX_MAC_ADDR_COUNT 30 | 289 | #define VXGE_MAX_MAC_ADDR_COUNT 30 |
288 | 290 | ||
289 | int vlan_tag_strip; | 291 | int vlan_tag_strip; |
290 | struct vlan_group *vlgrp; | ||
291 | u32 rx_vector_no; | 292 | u32 rx_vector_no; |
292 | enum vxge_hw_status last_status; | 293 | enum vxge_hw_status last_status; |
293 | 294 | ||
@@ -332,7 +333,7 @@ struct vxgedev { | |||
332 | struct net_device *ndev; | 333 | struct net_device *ndev; |
333 | struct pci_dev *pdev; | 334 | struct pci_dev *pdev; |
334 | struct __vxge_hw_device *devh; | 335 | struct __vxge_hw_device *devh; |
335 | struct vlan_group *vlgrp; | 336 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
336 | int vlan_tag_strip; | 337 | int vlan_tag_strip; |
337 | struct vxge_config config; | 338 | struct vxge_config config; |
338 | unsigned long state; | 339 | unsigned long state; |