diff options
Diffstat (limited to 'drivers/net/vxge/vxge-main.c')
-rw-r--r-- | drivers/net/vxge/vxge-main.c | 94 |
1 files changed, 39 insertions, 55 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index b8806a15bcaf..3f2d6ed13d3e 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -688,7 +688,7 @@ static int vxge_learn_mac(struct vxgedev *vdev, u8 *mac_header) | |||
688 | struct vxge_vpath *vpath = NULL; | 688 | struct vxge_vpath *vpath = NULL; |
689 | struct __vxge_hw_device *hldev; | 689 | struct __vxge_hw_device *hldev; |
690 | 690 | ||
691 | hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); | 691 | hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev); |
692 | 692 | ||
693 | mac_address = (u8 *)&mac_addr; | 693 | mac_address = (u8 *)&mac_addr; |
694 | memcpy(mac_address, mac_header, ETH_ALEN); | 694 | memcpy(mac_address, mac_header, ETH_ALEN); |
@@ -1112,7 +1112,7 @@ static void vxge_set_multicast(struct net_device *dev) | |||
1112 | /* Delete previous MC's */ | 1112 | /* Delete previous MC's */ |
1113 | for (i = 0; i < mcast_cnt; i++) { | 1113 | for (i = 0; i < mcast_cnt; i++) { |
1114 | list_for_each_safe(entry, next, list_head) { | 1114 | list_for_each_safe(entry, next, list_head) { |
1115 | mac_entry = (struct vxge_mac_addrs *) entry; | 1115 | mac_entry = (struct vxge_mac_addrs *)entry; |
1116 | /* Copy the mac address to delete */ | 1116 | /* Copy the mac address to delete */ |
1117 | mac_address = (u8 *)&mac_entry->macaddr; | 1117 | mac_address = (u8 *)&mac_entry->macaddr; |
1118 | memcpy(mac_info.macaddr, mac_address, ETH_ALEN); | 1118 | memcpy(mac_info.macaddr, mac_address, ETH_ALEN); |
@@ -1155,7 +1155,7 @@ _set_all_mcast: | |||
1155 | /* Delete previous MC's */ | 1155 | /* Delete previous MC's */ |
1156 | for (i = 0; i < mcast_cnt; i++) { | 1156 | for (i = 0; i < mcast_cnt; i++) { |
1157 | list_for_each_safe(entry, next, list_head) { | 1157 | list_for_each_safe(entry, next, list_head) { |
1158 | mac_entry = (struct vxge_mac_addrs *) entry; | 1158 | mac_entry = (struct vxge_mac_addrs *)entry; |
1159 | /* Copy the mac address to delete */ | 1159 | /* Copy the mac address to delete */ |
1160 | mac_address = (u8 *)&mac_entry->macaddr; | 1160 | mac_address = (u8 *)&mac_entry->macaddr; |
1161 | memcpy(mac_info.macaddr, mac_address, ETH_ALEN); | 1161 | memcpy(mac_info.macaddr, mac_address, ETH_ALEN); |
@@ -1202,7 +1202,7 @@ static int vxge_set_mac_addr(struct net_device *dev, void *p) | |||
1202 | { | 1202 | { |
1203 | struct sockaddr *addr = p; | 1203 | struct sockaddr *addr = p; |
1204 | struct vxgedev *vdev; | 1204 | struct vxgedev *vdev; |
1205 | struct __vxge_hw_device *hldev; | 1205 | struct __vxge_hw_device *hldev; |
1206 | enum vxge_hw_status status = VXGE_HW_OK; | 1206 | enum vxge_hw_status status = VXGE_HW_OK; |
1207 | struct macInfo mac_info_new, mac_info_old; | 1207 | struct macInfo mac_info_new, mac_info_old; |
1208 | int vpath_idx = 0; | 1208 | int vpath_idx = 0; |
@@ -1632,7 +1632,7 @@ static int vxge_poll_inta(struct napi_struct *napi, int budget) | |||
1632 | int budget_org = budget; | 1632 | int budget_org = budget; |
1633 | struct vxge_ring *ring; | 1633 | struct vxge_ring *ring; |
1634 | 1634 | ||
1635 | struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) | 1635 | struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) |
1636 | pci_get_drvdata(vdev->pdev); | 1636 | pci_get_drvdata(vdev->pdev); |
1637 | 1637 | ||
1638 | for (i = 0; i < vdev->no_of_vpath; i++) { | 1638 | for (i = 0; i < vdev->no_of_vpath; i++) { |
@@ -1669,7 +1669,7 @@ static int vxge_poll_inta(struct napi_struct *napi, int budget) | |||
1669 | */ | 1669 | */ |
1670 | static void vxge_netpoll(struct net_device *dev) | 1670 | static void vxge_netpoll(struct net_device *dev) |
1671 | { | 1671 | { |
1672 | struct __vxge_hw_device *hldev; | 1672 | struct __vxge_hw_device *hldev; |
1673 | struct vxgedev *vdev; | 1673 | struct vxgedev *vdev; |
1674 | 1674 | ||
1675 | vdev = (struct vxgedev *)netdev_priv(dev); | 1675 | vdev = (struct vxgedev *)netdev_priv(dev); |
@@ -1821,7 +1821,7 @@ static int vxge_mac_list_del(struct vxge_vpath *vpath, struct macInfo *mac) | |||
1821 | { | 1821 | { |
1822 | struct list_head *entry, *next; | 1822 | struct list_head *entry, *next; |
1823 | u64 del_mac = 0; | 1823 | u64 del_mac = 0; |
1824 | u8 *mac_address = (u8 *) (&del_mac); | 1824 | u8 *mac_address = (u8 *)(&del_mac); |
1825 | 1825 | ||
1826 | /* Copy the mac address to delete from the list */ | 1826 | /* Copy the mac address to delete from the list */ |
1827 | memcpy(mac_address, mac->macaddr, ETH_ALEN); | 1827 | memcpy(mac_address, mac->macaddr, ETH_ALEN); |
@@ -2102,7 +2102,7 @@ static irqreturn_t vxge_isr_napi(int irq, void *dev_id) | |||
2102 | struct __vxge_hw_device *hldev; | 2102 | struct __vxge_hw_device *hldev; |
2103 | u64 reason; | 2103 | u64 reason; |
2104 | enum vxge_hw_status status; | 2104 | enum vxge_hw_status status; |
2105 | struct vxgedev *vdev = (struct vxgedev *) dev_id;; | 2105 | struct vxgedev *vdev = (struct vxgedev *)dev_id; |
2106 | 2106 | ||
2107 | vxge_debug_intr(VXGE_TRACE, "%s:%d", __func__, __LINE__); | 2107 | vxge_debug_intr(VXGE_TRACE, "%s:%d", __func__, __LINE__); |
2108 | 2108 | ||
@@ -2341,8 +2341,8 @@ static void vxge_rem_msix_isr(struct vxgedev *vdev) | |||
2341 | 2341 | ||
2342 | static void vxge_rem_isr(struct vxgedev *vdev) | 2342 | static void vxge_rem_isr(struct vxgedev *vdev) |
2343 | { | 2343 | { |
2344 | struct __vxge_hw_device *hldev; | 2344 | struct __vxge_hw_device *hldev; |
2345 | hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); | 2345 | hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev); |
2346 | 2346 | ||
2347 | #ifdef CONFIG_PCI_MSI | 2347 | #ifdef CONFIG_PCI_MSI |
2348 | if (vdev->config.intr_type == MSI_X) { | 2348 | if (vdev->config.intr_type == MSI_X) { |
@@ -2583,7 +2583,7 @@ vxge_open(struct net_device *dev) | |||
2583 | "%s: %s:%d", dev->name, __func__, __LINE__); | 2583 | "%s: %s:%d", dev->name, __func__, __LINE__); |
2584 | 2584 | ||
2585 | vdev = (struct vxgedev *)netdev_priv(dev); | 2585 | vdev = (struct vxgedev *)netdev_priv(dev); |
2586 | hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); | 2586 | hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev); |
2587 | function_mode = vdev->config.device_hw_info.function_mode; | 2587 | function_mode = vdev->config.device_hw_info.function_mode; |
2588 | 2588 | ||
2589 | /* make sure you have link off by default every time Nic is | 2589 | /* make sure you have link off by default every time Nic is |
@@ -2811,7 +2811,7 @@ static int do_vxge_close(struct net_device *dev, int do_io) | |||
2811 | dev->name, __func__, __LINE__); | 2811 | dev->name, __func__, __LINE__); |
2812 | 2812 | ||
2813 | vdev = (struct vxgedev *)netdev_priv(dev); | 2813 | vdev = (struct vxgedev *)netdev_priv(dev); |
2814 | hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); | 2814 | hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev); |
2815 | 2815 | ||
2816 | if (unlikely(!is_vxge_card_up(vdev))) | 2816 | if (unlikely(!is_vxge_card_up(vdev))) |
2817 | return 0; | 2817 | return 0; |
@@ -3440,36 +3440,29 @@ _out0: | |||
3440 | * | 3440 | * |
3441 | * This function will unregister and free network device | 3441 | * This function will unregister and free network device |
3442 | */ | 3442 | */ |
3443 | static void | 3443 | static void vxge_device_unregister(struct __vxge_hw_device *hldev) |
3444 | vxge_device_unregister(struct __vxge_hw_device *hldev) | ||
3445 | { | 3444 | { |
3446 | struct vxgedev *vdev; | 3445 | struct vxgedev *vdev; |
3447 | struct net_device *dev; | 3446 | struct net_device *dev; |
3448 | char buf[IFNAMSIZ]; | 3447 | char buf[IFNAMSIZ]; |
3449 | #if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \ | ||
3450 | (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK)) | ||
3451 | u32 level_trace; | ||
3452 | #endif | ||
3453 | 3448 | ||
3454 | dev = hldev->ndev; | 3449 | dev = hldev->ndev; |
3455 | vdev = netdev_priv(dev); | 3450 | vdev = netdev_priv(dev); |
3456 | #if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \ | ||
3457 | (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK)) | ||
3458 | level_trace = vdev->level_trace; | ||
3459 | #endif | ||
3460 | vxge_debug_entryexit(level_trace, | ||
3461 | "%s: %s:%d", vdev->ndev->name, __func__, __LINE__); | ||
3462 | 3451 | ||
3463 | memcpy(buf, vdev->ndev->name, IFNAMSIZ); | 3452 | vxge_debug_entryexit(vdev->level_trace, "%s: %s:%d", vdev->ndev->name, |
3453 | __func__, __LINE__); | ||
3454 | |||
3455 | memcpy(buf, dev->name, IFNAMSIZ); | ||
3464 | 3456 | ||
3465 | /* in 2.6 will call stop() if device is up */ | 3457 | /* in 2.6 will call stop() if device is up */ |
3466 | unregister_netdev(dev); | 3458 | unregister_netdev(dev); |
3467 | 3459 | ||
3468 | flush_scheduled_work(); | 3460 | flush_scheduled_work(); |
3469 | 3461 | ||
3470 | vxge_debug_init(level_trace, "%s: ethernet device unregistered", buf); | 3462 | vxge_debug_init(vdev->level_trace, "%s: ethernet device unregistered", |
3471 | vxge_debug_entryexit(level_trace, | 3463 | buf); |
3472 | "%s: %s:%d Exiting...", buf, __func__, __LINE__); | 3464 | vxge_debug_entryexit(vdev->level_trace, "%s: %s:%d Exiting...", buf, |
3465 | __func__, __LINE__); | ||
3473 | } | 3466 | } |
3474 | 3467 | ||
3475 | /* | 3468 | /* |
@@ -3992,8 +3985,8 @@ static int vxge_pm_resume(struct pci_dev *pdev) | |||
3992 | static pci_ers_result_t vxge_io_error_detected(struct pci_dev *pdev, | 3985 | static pci_ers_result_t vxge_io_error_detected(struct pci_dev *pdev, |
3993 | pci_channel_state_t state) | 3986 | pci_channel_state_t state) |
3994 | { | 3987 | { |
3995 | struct __vxge_hw_device *hldev = | 3988 | struct __vxge_hw_device *hldev = |
3996 | (struct __vxge_hw_device *) pci_get_drvdata(pdev); | 3989 | (struct __vxge_hw_device *)pci_get_drvdata(pdev); |
3997 | struct net_device *netdev = hldev->ndev; | 3990 | struct net_device *netdev = hldev->ndev; |
3998 | 3991 | ||
3999 | netif_device_detach(netdev); | 3992 | netif_device_detach(netdev); |
@@ -4022,8 +4015,8 @@ static pci_ers_result_t vxge_io_error_detected(struct pci_dev *pdev, | |||
4022 | */ | 4015 | */ |
4023 | static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev) | 4016 | static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev) |
4024 | { | 4017 | { |
4025 | struct __vxge_hw_device *hldev = | 4018 | struct __vxge_hw_device *hldev = |
4026 | (struct __vxge_hw_device *) pci_get_drvdata(pdev); | 4019 | (struct __vxge_hw_device *)pci_get_drvdata(pdev); |
4027 | struct net_device *netdev = hldev->ndev; | 4020 | struct net_device *netdev = hldev->ndev; |
4028 | 4021 | ||
4029 | struct vxgedev *vdev = netdev_priv(netdev); | 4022 | struct vxgedev *vdev = netdev_priv(netdev); |
@@ -4048,8 +4041,8 @@ static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev) | |||
4048 | */ | 4041 | */ |
4049 | static void vxge_io_resume(struct pci_dev *pdev) | 4042 | static void vxge_io_resume(struct pci_dev *pdev) |
4050 | { | 4043 | { |
4051 | struct __vxge_hw_device *hldev = | 4044 | struct __vxge_hw_device *hldev = |
4052 | (struct __vxge_hw_device *) pci_get_drvdata(pdev); | 4045 | (struct __vxge_hw_device *)pci_get_drvdata(pdev); |
4053 | struct net_device *netdev = hldev->ndev; | 4046 | struct net_device *netdev = hldev->ndev; |
4054 | 4047 | ||
4055 | if (netif_running(netdev)) { | 4048 | if (netif_running(netdev)) { |
@@ -4243,7 +4236,7 @@ static int vxge_probe_fw_update(struct vxgedev *vdev) | |||
4243 | static int __devinit | 4236 | static int __devinit |
4244 | vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | 4237 | vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) |
4245 | { | 4238 | { |
4246 | struct __vxge_hw_device *hldev; | 4239 | struct __vxge_hw_device *hldev; |
4247 | enum vxge_hw_status status; | 4240 | enum vxge_hw_status status; |
4248 | int ret; | 4241 | int ret; |
4249 | int high_dma = 0; | 4242 | int high_dma = 0; |
@@ -4689,34 +4682,25 @@ _exit0: | |||
4689 | * Description: This function is called by the Pci subsystem to release a | 4682 | * Description: This function is called by the Pci subsystem to release a |
4690 | * PCI device and free up all resource held up by the device. | 4683 | * PCI device and free up all resource held up by the device. |
4691 | */ | 4684 | */ |
4692 | static void __devexit | 4685 | static void __devexit vxge_remove(struct pci_dev *pdev) |
4693 | vxge_remove(struct pci_dev *pdev) | ||
4694 | { | 4686 | { |
4695 | struct __vxge_hw_device *hldev; | 4687 | struct __vxge_hw_device *hldev; |
4696 | struct vxgedev *vdev = NULL; | 4688 | struct vxgedev *vdev = NULL; |
4697 | struct net_device *dev; | 4689 | struct net_device *dev; |
4698 | int i = 0; | 4690 | int i = 0; |
4699 | #if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \ | ||
4700 | (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK)) | ||
4701 | u32 level_trace; | ||
4702 | #endif | ||
4703 | 4691 | ||
4704 | hldev = (struct __vxge_hw_device *) pci_get_drvdata(pdev); | 4692 | hldev = (struct __vxge_hw_device *)pci_get_drvdata(pdev); |
4705 | 4693 | ||
4706 | if (hldev == NULL) | 4694 | if (hldev == NULL) |
4707 | return; | 4695 | return; |
4696 | |||
4708 | dev = hldev->ndev; | 4697 | dev = hldev->ndev; |
4709 | vdev = netdev_priv(dev); | 4698 | vdev = netdev_priv(dev); |
4710 | 4699 | ||
4711 | #if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \ | 4700 | vxge_debug_entryexit(vdev->level_trace, "%s:%d", __func__, __LINE__); |
4712 | (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK)) | ||
4713 | level_trace = vdev->level_trace; | ||
4714 | #endif | ||
4715 | vxge_debug_entryexit(level_trace, | ||
4716 | "%s:%d", __func__, __LINE__); | ||
4717 | 4701 | ||
4718 | vxge_debug_init(level_trace, | 4702 | vxge_debug_init(vdev->level_trace, "%s : removing PCI device...", |
4719 | "%s : removing PCI device...", __func__); | 4703 | __func__); |
4720 | vxge_device_unregister(hldev); | 4704 | vxge_device_unregister(hldev); |
4721 | 4705 | ||
4722 | for (i = 0; i < vdev->no_of_vpath; i++) { | 4706 | for (i = 0; i < vdev->no_of_vpath; i++) { |
@@ -4734,16 +4718,16 @@ vxge_remove(struct pci_dev *pdev) | |||
4734 | /* we are safe to free it now */ | 4718 | /* we are safe to free it now */ |
4735 | free_netdev(dev); | 4719 | free_netdev(dev); |
4736 | 4720 | ||
4737 | vxge_debug_init(level_trace, | 4721 | vxge_debug_init(vdev->level_trace, "%s:%d Device unregistered", |
4738 | "%s:%d Device unregistered", __func__, __LINE__); | 4722 | __func__, __LINE__); |
4739 | 4723 | ||
4740 | vxge_hw_device_terminate(hldev); | 4724 | vxge_hw_device_terminate(hldev); |
4741 | 4725 | ||
4742 | pci_disable_device(pdev); | 4726 | pci_disable_device(pdev); |
4743 | pci_release_regions(pdev); | 4727 | pci_release_regions(pdev); |
4744 | pci_set_drvdata(pdev, NULL); | 4728 | pci_set_drvdata(pdev, NULL); |
4745 | vxge_debug_entryexit(level_trace, | 4729 | vxge_debug_entryexit(vdev->level_trace, "%s:%d Exiting...", __func__, |
4746 | "%s:%d Exiting...", __func__, __LINE__); | 4730 | __LINE__); |
4747 | } | 4731 | } |
4748 | 4732 | ||
4749 | static struct pci_error_handlers vxge_err_handler = { | 4733 | static struct pci_error_handlers vxge_err_handler = { |