aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ixgb
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2010-09-27 18:34:04 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2010-09-27 18:34:04 +0000
commit232910c04b13929bcdfdc3d45c8a35b97d2c85ea (patch)
tree02f6de3c07272a2dafb418b3a77ab8e2a5302cac /sys/dev/ixgb
parent7b79cb9e33d5d3d96df7c7d65ccfceb389feb7e5 (diff)
Notes
Diffstat (limited to 'sys/dev/ixgb')
-rw-r--r--sys/dev/ixgb/if_ixgb.c17
-rw-r--r--sys/dev/ixgb/if_ixgb.h2
2 files changed, 18 insertions, 1 deletions
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;