diff options
| author | Pyun YongHyeon <yongari@FreeBSD.org> | 2010-09-27 18:34:04 +0000 |
|---|---|---|
| committer | Pyun YongHyeon <yongari@FreeBSD.org> | 2010-09-27 18:34:04 +0000 |
| commit | 232910c04b13929bcdfdc3d45c8a35b97d2c85ea (patch) | |
| tree | 02f6de3c07272a2dafb418b3a77ab8e2a5302cac | |
| parent | 7b79cb9e33d5d3d96df7c7d65ccfceb389feb7e5 (diff) | |
Notes
| -rw-r--r-- | sys/dev/e1000/if_em.c | 22 | ||||
| -rw-r--r-- | sys/dev/e1000/if_em.h | 2 | ||||
| -rw-r--r-- | sys/dev/e1000/if_igb.c | 17 | ||||
| -rw-r--r-- | sys/dev/e1000/if_igb.h | 2 | ||||
| -rw-r--r-- | sys/dev/e1000/if_lem.c | 22 | ||||
| -rw-r--r-- | sys/dev/e1000/if_lem.h | 2 | ||||
| -rw-r--r-- | sys/dev/ixgb/if_ixgb.c | 17 | ||||
| -rw-r--r-- | sys/dev/ixgb/if_ixgb.h | 2 | ||||
| -rw-r--r-- | sys/dev/ixgbe/ixgbe.c | 17 | ||||
| -rw-r--r-- | sys/dev/ixgbe/ixgbe.h | 2 |
10 files changed, 86 insertions, 19 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 7655cd253b71..11681c3acf2d 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -576,6 +576,15 @@ em_attach(device_t dev) goto err_pci; } + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_late; + } + /* ** Start from a known state, this is ** important in reading the nvm and @@ -674,6 +683,7 @@ err_late: if_free(adapter->ifp); err_pci: em_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); EM_CORE_LOCK_DESTROY(adapter); return (error); @@ -739,6 +749,7 @@ em_detach(device_t dev) em_free_receive_structures(adapter); em_release_hw_control(adapter); + free(adapter->mta, M_DEVBUF); return (0); } @@ -1996,6 +2007,9 @@ em_set_multi(struct adapter *adapter) IOCTL_DEBUGOUT("em_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); + if (adapter->hw.mac.type == e1000_82542 && adapter->hw.revision_id == E1000_REVISION_2) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); @@ -2006,13 +2020,6 @@ em_set_multi(struct adapter *adapter) msec_delay(5); } - /* Allocate temporary memory to setup array */ - mta = malloc(sizeof(u8) * - (ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (mta == NULL) - panic("em_set_multi memory failure\n"); - #if __FreeBSD_version < 800000 IF_ADDR_LOCK(ifp); #else @@ -2050,7 +2057,6 @@ em_set_multi(struct adapter *adapter) if (adapter->hw.bus.pci_cmd_word & CMD_MEM_WRT_INVALIDATE) e1000_pci_set_mwi(&adapter->hw); } - free(mta, M_DEVBUF); } diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 225a8d08b8ee..d164edb18592 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -391,6 +391,8 @@ struct adapter { bool has_manage; bool has_amt; + /* Multicast array memory */ + u8 *mta; /* Info about the board itself */ uint8_t link_active; uint16_t link_speed; diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index 44375fca2a34..b9e31561519a 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -494,6 +494,15 @@ igb_attach(device_t dev) goto err_pci; } + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_late; + } + /* ** Start from a known state, this is ** important in reading the nvm and @@ -597,6 +606,7 @@ err_late: if_free(adapter->ifp); err_pci: igb_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); IGB_CORE_LOCK_DESTROY(adapter); return (error); @@ -667,6 +677,7 @@ igb_detach(device_t dev) igb_free_transmit_structures(adapter); igb_free_receive_structures(adapter); + free(adapter->mta, M_DEVBUF); IGB_CORE_LOCK_DESTROY(adapter); @@ -1831,12 +1842,16 @@ igb_set_multi(struct adapter *adapter) struct ifnet *ifp = adapter->ifp; struct ifmultiaddr *ifma; u32 reg_rctl = 0; - u8 mta[MAX_NUM_MULTICAST_ADDRESSES * ETH_ADDR_LEN]; + u8 *mta; int mcnt = 0; IOCTL_DEBUGOUT("igb_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(uint8_t) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES); + #if __FreeBSD_version < 800000 IF_ADDR_LOCK(ifp); #else diff --git a/sys/dev/e1000/if_igb.h b/sys/dev/e1000/if_igb.h index 3c8cb39c2d47..d896c41dd3fd 100644 --- a/sys/dev/e1000/if_igb.h +++ b/sys/dev/e1000/if_igb.h @@ -423,6 +423,8 @@ struct adapter { u32 rx_mbuf_sz; u32 rx_mask; + /* Multicast array memory */ + u8 *mta; /* Misc stats maintained by the driver */ unsigned long dropped_pkts; unsigned long mbuf_defrag_failed; diff --git a/sys/dev/e1000/if_lem.c b/sys/dev/e1000/if_lem.c index 470cdec2d118..5cd617109842 100644 --- a/sys/dev/e1000/if_lem.c +++ b/sys/dev/e1000/if_lem.c @@ -538,6 +538,15 @@ lem_attach(device_t dev) adapter->rx_desc_base = (struct e1000_rx_desc *)adapter->rxdma.dma_vaddr; + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_hw_init; + } + /* ** Start from a known state, this is ** important in reading the nvm and @@ -666,6 +675,7 @@ err_pci: if (adapter->ifp != NULL) if_free(adapter->ifp); lem_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); EM_TX_LOCK_DESTROY(adapter); EM_RX_LOCK_DESTROY(adapter); EM_CORE_LOCK_DESTROY(adapter); @@ -752,6 +762,7 @@ lem_detach(device_t dev) } lem_release_hw_control(adapter); + free(adapter->mta, M_DEVBUF); EM_TX_LOCK_DESTROY(adapter); EM_RX_LOCK_DESTROY(adapter); EM_CORE_LOCK_DESTROY(adapter); @@ -1931,6 +1942,9 @@ lem_set_multi(struct adapter *adapter) IOCTL_DEBUGOUT("lem_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); + if (adapter->hw.mac.type == e1000_82542 && adapter->hw.revision_id == E1000_REVISION_2) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); @@ -1941,13 +1955,6 @@ lem_set_multi(struct adapter *adapter) msec_delay(5); } - /* Allocate temporary memory to setup array */ - mta = malloc(sizeof(u8) * - (ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (mta == NULL) - panic("lem_set_multi memory failure\n"); - #if __FreeBSD_version < 800000 IF_ADDR_LOCK(ifp); #else @@ -1985,7 +1992,6 @@ lem_set_multi(struct adapter *adapter) if (adapter->hw.bus.pci_cmd_word & CMD_MEM_WRT_INVALIDATE) e1000_pci_set_mwi(&adapter->hw); } - free(mta, M_DEVBUF); } diff --git a/sys/dev/e1000/if_lem.h b/sys/dev/e1000/if_lem.h index 7dc10b581ded..2f76aa8041b1 100644 --- a/sys/dev/e1000/if_lem.h +++ b/sys/dev/e1000/if_lem.h @@ -339,6 +339,8 @@ struct adapter { bool has_manage; bool has_amt; + /* Multicast array memory */ + u8 *mta; /* Info about the board itself */ uint8_t link_active; uint16_t link_speed; diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c index 3eb49c2df092..2f52a8ae44d8 100644 --- a/sys/dev/ixgb/if_ixgb.c +++ b/sys/dev/ixgb/if_ixgb.c @@ -328,6 +328,15 @@ ixgb_attach(device_t dev) } adapter->rx_desc_base = (struct ixgb_rx_desc *) adapter->rxdma.dma_vaddr; + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u_int8_t) * IXGB_ETH_LENGTH_OF_ADDRESS * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_hw_init; + } + /* Initialize the hardware */ if (ixgb_hardware_init(adapter)) { printf("ixgb%d: Unable to initialize the hardware\n", @@ -356,6 +365,7 @@ err_pci: if_free(adapter->ifp); ixgb_free_pci_resources(adapter); sysctl_ctx_free(&adapter->sysctl_ctx); + free(adapter->mta, M_DEVBUF); return (error); } @@ -416,6 +426,7 @@ ixgb_detach(device_t dev) adapter->next->prev = adapter->prev; if (adapter->prev != NULL) adapter->prev->next = adapter->next; + free(adapter->mta, M_DEVBUF); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); ifp->if_timer = 0; @@ -1082,7 +1093,7 @@ static void ixgb_set_multi(struct adapter * adapter) { u_int32_t reg_rctl = 0; - u_int8_t mta[MAX_NUM_MULTICAST_ADDRESSES * IXGB_ETH_LENGTH_OF_ADDRESS]; + u_int8_t *mta; struct ifmultiaddr *ifma; int mcnt = 0; struct ifnet *ifp = adapter->ifp; @@ -1090,6 +1101,10 @@ ixgb_set_multi(struct adapter * adapter) IOCTL_DEBUGOUT("ixgb_set_multi: begin"); IF_ADDR_LOCK(ifp); + mta = adapter->mta; + bzero(mta, sizeof(u_int8_t) * IXGB_ETH_LENGTH_OF_ADDRESS * + MAX_NUM_MULTICAST_ADDRESSES); + #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else diff --git a/sys/dev/ixgb/if_ixgb.h b/sys/dev/ixgb/if_ixgb.h index c2f0acffee83..129de32e7f46 100644 --- a/sys/dev/ixgb/if_ixgb.h +++ b/sys/dev/ixgb/if_ixgb.h @@ -344,6 +344,8 @@ struct adapter { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; + /* Multicast array memory */ + u_int8_t *mta; /* Misc stats maintained by the driver */ unsigned long dropped_pkts; unsigned long mbuf_alloc_failed; diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index f2839600864e..968690284f3d 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -500,6 +500,15 @@ ixgbe_attach(device_t dev) goto err_out; } + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_late; + } + /* Initialize the shared code */ error = ixgbe_init_shared_code(hw); if (error == IXGBE_ERR_SFP_NOT_PRESENT) { @@ -568,6 +577,7 @@ err_out: if (adapter->ifp != NULL) if_free(adapter->ifp); ixgbe_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); return (error); } @@ -649,6 +659,7 @@ ixgbe_detach(device_t dev) ixgbe_free_transmit_structures(adapter); ixgbe_free_receive_structures(adapter); + free(adapter->mta, M_DEVBUF); IXGBE_CORE_LOCK_DESTROY(adapter); return (0); @@ -1794,7 +1805,7 @@ static void ixgbe_set_multi(struct adapter *adapter) { u32 fctrl; - u8 mta[MAX_NUM_MULTICAST_ADDRESSES * IXGBE_ETH_LENGTH_OF_ADDRESS]; + u8 *mta; u8 *update_ptr; struct ifmultiaddr *ifma; int mcnt = 0; @@ -1802,6 +1813,10 @@ ixgbe_set_multi(struct adapter *adapter) IOCTL_DEBUGOUT("ixgbe_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * + MAX_NUM_MULTICAST_ADDRESSES); + fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); if (ifp->if_flags & IFF_PROMISC) diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 820f73ae0db6..c6f76cdc820b 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -380,6 +380,8 @@ struct adapter { u32 rx_mask; u32 rx_process_limit; + /* Multicast array memory */ + u8 *mta; #ifdef IXGBE_TIMESYNC u64 last_stamp; u64 last_sec; |
