Permalink
Browse files

igb: Use kmalloc_cachealign to allocate rx ring, tx ring and msix data

  • Loading branch information...
1 parent 55126ff commit 7b269c72ab753dc30bf21edc123cb300b961756b Sepherosa Ziehau committed Oct 7, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 sys/dev/netif/igb/if_igb.c
View
9 sys/dev/netif/igb/if_igb.c
@@ -1562,7 +1562,8 @@ igb_alloc_rings(struct igb_softc *sc)
/*
* Allocate TX descriptor rings and buffers
*/
- sc->tx_rings = kmalloc(sizeof(struct igb_tx_ring) * sc->tx_ring_cnt,
+ sc->tx_rings = kmalloc_cachealign(
+ sizeof(struct igb_tx_ring) * sc->tx_ring_cnt,
M_DEVBUF, M_WAITOK | M_ZERO);
for (i = 0; i < sc->tx_ring_cnt; ++i) {
struct igb_tx_ring *txr = &sc->tx_rings[i];
@@ -1580,7 +1581,8 @@ igb_alloc_rings(struct igb_softc *sc)
/*
* Allocate RX descriptor rings and buffers
*/
- sc->rx_rings = kmalloc(sizeof(struct igb_rx_ring) * sc->rx_ring_cnt,
+ sc->rx_rings = kmalloc_cachealign(
+ sizeof(struct igb_rx_ring) * sc->rx_ring_cnt,
M_DEVBUF, M_WAITOK | M_ZERO);
for (i = 0; i < sc->rx_ring_cnt; ++i) {
struct igb_rx_ring *rxr = &sc->rx_rings[i];
@@ -4042,7 +4044,8 @@ igb_msix_try_alloc(struct igb_softc *sc)
}
sc->msix_cnt = alloc_cnt;
- sc->msix_data = kmalloc(sizeof(struct igb_msix_data) * sc->msix_cnt,
+ sc->msix_data = kmalloc_cachealign(
+ sizeof(struct igb_msix_data) * sc->msix_cnt,
M_DEVBUF, M_WAITOK | M_ZERO);
for (x = 0; x < sc->msix_cnt; ++x) {
msix = &sc->msix_data[x];

0 comments on commit 7b269c7

Please sign in to comment.