/*** * rtskb_queue_tail * @rtskb_head */ void rtskb_queue_tail(struct rtskb_head *list, struct rtskb *skb) { unsigned long flags; flags = rt_spin_lock_irqsave(&list->lock); __rtskb_queue_tail(list, skb); rt_spin_unlock_irqrestore(flags, &list->lock); }
static void __rtskb_pool_queue_tail(struct rtskb_pool *pool, struct rtskb *skb) { struct rtskb_queue *queue = &pool->queue; __rtskb_queue_tail(queue,skb); if (--pool->lock_count == 0) pool->lock_ops->unlock(pool->lock_cookie); }
/*** * rtskb_pool_init */ int rtskb_pool_init(void) { unsigned int i; int err = 0; struct rtskb* skb; rtskb_queue_head_init(&rtskb_pool); rtskb_cache = kmem_cache_create (RTSKB_CACHE, sizeof (struct rtskb), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if ( !rtskb_cache ) { rt_printk("RTnet: allocating 'rtskb_cache' failed."); return -ENOMEM; } rtskb_data_cache = kmem_cache_create (RTSKB_DATA_CACHE, SKB_DATA_ALIGN(rtskb_max_size), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if ( !rtskb_data_cache ) { rt_printk("RTnet: allocating 'rtskb_data_cache' failed."); return -ENOMEM; } for (i=0; i<rtskb_pool_default; i++) { skb = new_rtskb(); /* might return NULL */ if (skb) { __rtskb_queue_tail(&rtskb_pool, skb); } else { printk("%s(): new_rtskb() returned NULL, qlen=%d\n", __FUNCTION__, rtskb_pool.qlen); break; } } if ( (inc_pool_srq=rt_request_srq (0, inc_pool_handler, 0)) < 0) { rt_printk("RTnet: allocating 'inc_pool_srq=%d' failed.\n", inc_pool_srq); return inc_pool_srq; } if ( (dec_pool_srq=rt_request_srq (0, dec_pool_handler, 0)) < 0) { rt_printk("RTnet: allocating 'dec_pool_srq=%d' failed.\n", dec_pool_srq); return dec_pool_srq; } return err; }