#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/slab.h>
-#include <linux/idr.h>
+#include <linux/xarray.h>
#include <asm/io.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
if (card->scd2vc[j] != NULL)
free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc);
}
- idr_destroy(&card->idr);
dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT,
card->rsq.org, card->rsq.dma);
dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
card->efbie = 1; /* To prevent push_rxbufs from enabling the interrupt */
- idr_init(&card->idr);
+ xa_init_flags(&card->handles, XA_FLAGS_ALLOC);
/* Pre-allocate some huge buffers */
skb_queue_head_init(&card->hbpool.queue);
static void push_rxbufs(ns_dev * card, struct sk_buff *skb)
{
struct sk_buff *handle1, *handle2;
- int id1, id2;
+ int id1, id2, ret;
u32 addr1, addr2;
u32 stat;
unsigned long flags;
card->lbfqc += 2;
}
- id1 = idr_alloc(&card->idr, handle1, 0, 0, GFP_ATOMIC);
- if (id1 < 0)
+ ret = xa_alloc(&card->handles, &id1, handle1, xa_limit_31b,
+ GFP_ATOMIC);
+ if (ret < 0)
goto out;
- id2 = idr_alloc(&card->idr, handle2, 0, 0, GFP_ATOMIC);
- if (id2 < 0)
+ ret = xa_alloc(&card->handles, &id2, handle2, xa_limit_31b,
+ GFP_ATOMIC);
+ if (ret < 0) {
+ xa_erase(&card->handles, id1);
goto out;
+ }
spin_lock_irqsave(&card->res_lock, flags);
while (CMD_BUSY(card)) ;
struct sk_buff *oldbuf;
oldbuf = card->rcbuf;
- card->rcbuf = idr_find(&card->idr,
+ card->rcbuf = xa_load(&card->handles,
ns_rcqe_nextbufhandle(card->rawcell));
card->rawch = NS_PRV_DMA(card->rcbuf);
card->rawcell = (struct ns_rcqe *)
card->lbfqc = ns_stat_lfbqc_get(stat);
id = le32_to_cpu(rsqe->buffer_handle);
- skb = idr_remove(&card->idr, id);
+ skb = xa_erase(&card->handles, id);
if (!skb) {
RXPRINTK(KERN_ERR
"nicstar%d: skb not found!\n", card->index);