本文整理汇总了C++中skb_unlink函数的典型用法代码示例。如果您正苦于以下问题:C++ skb_unlink函数的具体用法?C++ skb_unlink怎么用?C++ skb_unlink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skb_unlink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bfusb_send_bulk
static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
{
struct bfusb_data_scb *scb = (void *) skb->cb;
struct urb *urb = bfusb_get_completed(data);
int err, pipe;
BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len);
if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
return -ENOMEM;
pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, skb->len,
bfusb_tx_complete, skb);
scb->urb = urb;
skb_queue_tail(&data->pending_q, skb);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s bulk tx submit failed urb %p err %d",
data->hdev->name, urb, err);
skb_unlink(skb, &data->pending_q);
usb_free_urb(urb);
} else
atomic_inc(&data->pending_tx);
return err;
}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:31,代码来源:bfusb.c
示例2: bfusb_tx_complete
static void bfusb_tx_complete(struct urb *urb)
{
struct sk_buff *skb = (struct sk_buff *) urb->context;
struct bfusb_data *data = (struct bfusb_data *) skb->dev;
BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len);
atomic_dec(&data->pending_tx);
if (!test_bit(HCI_RUNNING, &data->hdev->flags))
return;
if (!urb->status)
data->hdev->stat.byte_tx += skb->len;
else
data->hdev->stat.err_tx++;
read_lock(&data->lock);
skb_unlink(skb, &data->pending_q);
skb_queue_tail(&data->completed_q, skb);
bfusb_tx_wakeup(data);
read_unlock(&data->lock);
}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:26,代码来源:bfusb.c
示例3: try_fill_recv
static void try_fill_recv(struct virtnet_info *vi)
{
struct sk_buff *skb;
struct scatterlist sg[1+MAX_SKB_FRAGS];
int num, err;
sg_init_table(sg, 1+MAX_SKB_FRAGS);
for (;;) {
skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN);
if (unlikely(!skb))
break;
skb_put(skb, MAX_PACKET_LEN);
vnet_hdr_to_sg(sg, skb);
num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
skb_queue_head(&vi->recv, skb);
err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, num, skb);
if (err) {
skb_unlink(skb, &vi->recv);
kfree_skb(skb);
break;
}
vi->num++;
}
if (unlikely(vi->num > vi->max))
vi->max = vi->num;
vi->rvq->vq_ops->kick(vi->rvq);
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:29,代码来源:virtio_net.c
示例4: start_xmit
static int start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
int num, err;
struct scatterlist sg[1+MAX_SKB_FRAGS];
struct virtio_net_hdr *hdr;
const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
DECLARE_MAC_BUF(mac);
sg_init_table(sg, 1+MAX_SKB_FRAGS);
pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest));
free_old_xmit_skbs(vi);
/* Encode metadata header at front. */
hdr = skb_vnet_hdr(skb);
if (skb->ip_summed == CHECKSUM_PARTIAL) {
hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
hdr->csum_start = skb->csum_start - skb_headroom(skb);
hdr->csum_offset = skb->csum_offset;
} else {
hdr->flags = 0;
hdr->csum_offset = hdr->csum_start = 0;
}
if (skb_is_gso(skb)) {
hdr->gso_size = skb_shinfo(skb)->gso_size;
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN)
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4_ECN;
else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP)
hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
else
BUG();
} else {
hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
hdr->gso_size = 0;
}
vnet_hdr_to_sg(sg, skb);
num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
__skb_queue_head(&vi->send, skb);
err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb);
if (err) {
pr_debug("%s: virtio not prepared to send\n", dev->name);
skb_unlink(skb, &vi->send);
netif_stop_queue(dev);
return NETDEV_TX_BUSY;
}
vi->svq->vq_ops->kick(vi->svq);
return 0;
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:57,代码来源:virtio_net.c
示例5: mesh_nexthop_lookup
/**
* ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame
*
* @next_hop: output argument for next hop address
* @skb: frame to be sent
* @dev: network device the frame will be sent through
*
* Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is
* found, the function will start a path discovery and queue the frame so it is
* sent when the path is resolved. This means the caller must not free the skb
* in this case.
*/
int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct sk_buff *skb_to_free = NULL;
struct mesh_path *mpath;
int err = 0;
rcu_read_lock();
mpath = mesh_path_lookup(skb->data, dev);
if (!mpath) {
mesh_path_add(skb->data, dev);
mpath = mesh_path_lookup(skb->data, dev);
if (!mpath) {
dev_kfree_skb(skb);
sdata->u.sta.mshstats.dropped_frames_no_route++;
err = -ENOSPC;
goto endlookup;
}
}
if (mpath->flags & MESH_PATH_ACTIVE) {
if (time_after(jiffies, mpath->exp_time -
msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time))
&& skb->pkt_type != PACKET_OTHERHOST
&& !(mpath->flags & MESH_PATH_RESOLVING)
&& !(mpath->flags & MESH_PATH_FIXED)) {
mesh_queue_preq(mpath,
PREQ_Q_F_START | PREQ_Q_F_REFRESH);
}
memcpy(next_hop, mpath->next_hop->addr,
ETH_ALEN);
} else {
if (!(mpath->flags & MESH_PATH_RESOLVING)) {
/* Start discovery only if it is not running yet */
mesh_queue_preq(mpath, PREQ_Q_F_START);
}
if (skb_queue_len(&mpath->frame_queue) >=
MESH_FRAME_QUEUE_LEN) {
skb_to_free = mpath->frame_queue.next;
skb_unlink(skb_to_free, &mpath->frame_queue);
}
skb_queue_tail(&mpath->frame_queue, skb);
if (skb_to_free)
mesh_path_discard_frame(skb_to_free, dev);
err = -ENOENT;
}
endlookup:
rcu_read_unlock();
return err;
}
开发者ID:DINKIN,项目名称:tuo,代码行数:67,代码来源:mesh_hwmp.c
示例6: brcmf_rx_frames
void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list)
{
struct sk_buff *skb, *pnext;
struct brcmf_if *ifp;
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr;
u8 ifidx;
int ret;
brcmf_dbg(DATA, "Enter\n");
skb_queue_walk_safe(skb_list, skb, pnext) {
skb_unlink(skb, skb_list);
/* process and remove protocol-specific header */
ret = brcmf_proto_hdrpull(drvr, drvr->fw_signals, &ifidx, skb);
ifp = drvr->iflist[ifidx];
if (ret || !ifp || !ifp->ndev) {
if ((ret != -ENODATA) && ifp)
ifp->stats.rx_errors++;
brcmu_pkt_buf_free_skb(skb);
continue;
}
skb->dev = ifp->ndev;
skb->protocol = eth_type_trans(skb, skb->dev);
if (skb->pkt_type == PACKET_MULTICAST)
ifp->stats.multicast++;
/* Process special event packets */
brcmf_fweh_process_skb(drvr, skb);
if (!(ifp->ndev->flags & IFF_UP)) {
brcmu_pkt_buf_free_skb(skb);
continue;
}
ifp->stats.rx_bytes += skb->len;
ifp->stats.rx_packets++;
if (in_interrupt())
netif_rx(skb);
else
/* If the receive is not processed inside an ISR,
* the softirqd must be woken explicitly to service the
* NET_RX_SOFTIRQ. This is handled by netif_rx_ni().
*/
netif_rx_ni(skb);
}
开发者ID:cyberphox,项目名称:monoev3kernel,代码行数:51,代码来源:dhd_linux.c
示例7: p54u_rx_cb
static void p54u_rx_cb(struct urb *urb)
{
struct sk_buff *skb = (struct sk_buff *) urb->context;
struct p54u_rx_info *info = (struct p54u_rx_info *)skb->cb;
struct ieee80211_hw *dev = info->dev;
struct p54u_priv *priv = dev->priv;
if (unlikely(urb->status)) {
info->urb = NULL;
usb_free_urb(urb);
return;
}
skb_unlink(skb, &priv->rx_queue);
skb_put(skb, urb->actual_length);
if (!priv->hw_type)
skb_pull(skb, sizeof(struct net2280_tx_hdr));
if (p54_rx(dev, skb)) {
skb = dev_alloc_skb(MAX_RX_SIZE);
if (unlikely(!skb)) {
usb_free_urb(urb);
/* TODO check rx queue length and refill *somewhere* */
return;
}
info = (struct p54u_rx_info *) skb->cb;
info->urb = urb;
info->dev = dev;
urb->transfer_buffer = skb_tail_pointer(skb);
urb->context = skb;
skb_queue_tail(&priv->rx_queue, skb);
} else {
if (!priv->hw_type)
skb_push(skb, sizeof(struct net2280_tx_hdr));
skb_reset_tail_pointer(skb);
skb_trim(skb, 0);
if (urb->transfer_buffer != skb_tail_pointer(skb)) {
/* this should not happen */
WARN_ON(1);
urb->transfer_buffer = skb_tail_pointer(skb);
}
skb_queue_tail(&priv->rx_queue, skb);
}
usb_submit_urb(urb, GFP_ATOMIC);
}
开发者ID:deepikateriar,项目名称:Onlive-Source-Backup,代码行数:49,代码来源:p54usb.c
示例8: brcmu_pktq_pflush
void
brcmu_pktq_pflush(struct pktq *pq, int prec, bool dir,
bool (*fn)(struct sk_buff *, void *), void *arg)
{
struct sk_buff_head *q;
struct sk_buff *p, *next;
q = &pq->q[prec].skblist;
skb_queue_walk_safe(q, p, next) {
if (fn == NULL || (*fn) (p, arg)) {
skb_unlink(p, q);
brcmu_pkt_buf_free_skb(p);
pq->len--;
}
}
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:16,代码来源:utils.c
示例9: tx_urb_complete
/**
* tx_urb_complete - completes the execution of an URB
* @urb: a URB
*
* This function is called if the URB has been transferred to a device or an
* error has happened.
*/
static void tx_urb_complete(struct urb *urb)
{
int r;
struct sk_buff *skb;
struct ieee80211_tx_info *info;
struct zd_usb *usb;
struct zd_usb_tx *tx;
skb = (struct sk_buff *)urb->context;
info = IEEE80211_SKB_CB(skb);
/*
* grab 'usb' pointer before handing off the skb (since
* it might be freed by zd_mac_tx_to_dev or mac80211)
*/
usb = &zd_hw_mac(info->rate_driver_data[0])->chip.usb;
tx = &usb->tx;
switch (urb->status) {
case 0:
break;
case -ESHUTDOWN:
case -EINVAL:
case -ENODEV:
case -ENOENT:
case -ECONNRESET:
case -EPIPE:
dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status);
break;
default:
dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status);
goto resubmit;
}
free_urb:
skb_unlink(skb, &usb->tx.submitted_skbs);
zd_mac_tx_to_dev(skb, urb->status);
usb_free_urb(urb);
tx_dec_submitted_urbs(usb);
return;
resubmit:
usb_anchor_urb(urb, &tx->submitted);
r = usb_submit_urb(urb, GFP_ATOMIC);
if (r) {
usb_unanchor_urb(urb);
dev_dbg_f(urb_dev(urb), "error resubmit urb %p %d\n", urb, r);
goto free_urb;
}
}
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:54,代码来源:zd_usb.c
示例10: shaper_kick
static void shaper_kick(struct shaper *shaper)
{
struct sk_buff *skb;
/*
* Walk the list (may be empty)
*/
while((skb=skb_peek(&shaper->sendq))!=NULL)
{
/*
* Each packet due to go out by now (within an error
* of SHAPER_BURST) gets kicked onto the link
*/
if(sh_debug)
printk("Clock = %ld, jiffies = %ld\n", SHAPERCB(skb)->shapeclock, jiffies);
if(time_before_eq(SHAPERCB(skb)->shapeclock, jiffies + SHAPER_BURST))
{
/*
* Pull the frame and get interrupts back on.
*/
skb_unlink(skb, &shaper->sendq);
if (shaper->recovery <
SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen)
shaper->recovery = SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen;
/*
* Pass on to the physical target device via
* our low level packet thrower.
*/
SHAPERCB(skb)->shapepend=0;
shaper_queue_xmit(shaper, skb); /* Fire */
}
else
break;
}
/*
* Next kick.
*/
if(skb!=NULL)
mod_timer(&shaper->timer, SHAPERCB(skb)->shapeclock);
}
开发者ID:IgnasD,项目名称:Tomato-RAF,代码行数:46,代码来源:shaper.c
示例11: bool
/*
* precedence based dequeue with match function. Passing a NULL pointer
* for the match function parameter is considered to be a wildcard so
* any packet on the queue is returned. In that case it is no different
* from brcmu_pktq_pdeq() above.
*/
struct sk_buff *brcmu_pktq_pdeq_match(struct pktq *pq, int prec,
bool (*match_fn)(struct sk_buff *skb,
void *arg), void *arg)
{
struct sk_buff_head *q;
struct sk_buff *p, *next;
q = &pq->q[prec].skblist;
skb_queue_walk_safe(q, p, next) {
if (match_fn == NULL || match_fn(p, arg)) {
skb_unlink(p, q);
pq->len--;
return p;
}
}
return NULL;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:23,代码来源:utils.c
示例12: spi_transmit_data
static int spi_transmit_data(struct spi_device *spi,
unsigned char *buf, size_t len)
{
int ret;
struct spi_message msg;
struct spi_transfer t = {
.len = len,
.tx_buf = buf,
.delay_usecs = 10,
};
spi_message_init(&msg);
spi_message_add_tail(&t, &msg);
ret = spi_sync(spi, &msg);
if (ret < 0)
mif_err("spi_sync() fail(%d)\n", ret);
return ret;
}
static int spi_boot_tx_skb(struct link_device *ld, struct io_device *iod,
struct sk_buff *skb)
{
int ret = -EINVAL;
struct spi_boot_link_device *sbld = to_spi_boot_link_dev(ld);
unsigned char *buf = skb->data + SIPC5_MIN_HEADER_SIZE;
int len = skb->len - SIPC5_MIN_HEADER_SIZE;
skb_queue_tail(&sbld->tx_q, skb);
ret = spi_transmit_data(sbld->spi, buf, len);
if (ret < 0) {
mif_err("spi_transmit_data() failed(%d)\n", ret);
goto exit;
}
exit:
skb_unlink(skb, &sbld->tx_q);
return ret;
}
开发者ID:friedrich420,项目名称:S6_AEL_Kernel_Multivariant_LL-5.1.1,代码行数:45,代码来源:link_device_spi.c
示例13: bfusb_rx_submit
static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
{
struct bfusb_data_scb *scb;
struct sk_buff *skb;
int err, pipe, size = HCI_MAX_FRAME_SIZE + 32;
BT_DBG("bfusb %p urb %p", data, urb);
if (!urb) {
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb)
return -ENOMEM;
}
skb = bt_skb_alloc(size, GFP_ATOMIC);
if (!skb) {
usb_free_urb(urb);
return -ENOMEM;
}
skb->dev = (void *) data;
scb = (struct bfusb_data_scb *) skb->cb;
scb->urb = urb;
pipe = usb_rcvbulkpipe(data->udev, data->bulk_in_ep);
usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, size,
bfusb_rx_complete, skb);
skb_queue_tail(&data->pending_q, skb);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s bulk rx submit failed urb %p err %d",
data->hdev->name, urb, err);
skb_unlink(skb, &data->pending_q);
kfree_skb(skb);
usb_free_urb(urb);
}
return err;
}
开发者ID:caseyparker,项目名称:linux,代码行数:43,代码来源:bfusb.c
示例14: nanopci_read
static ssize_t
nanopci_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
{
struct nano_pci_card *card = filp->private_data;
struct sk_buff *skb;
size_t n;
if(down_interruptible(&card->sem))
return -ERESTARTSYS;
while((skb = skb_peek(&card->rx_queue)) == NULL) {
up(&card->sem);
if(filp->f_flags & O_NONBLOCK)
return -EAGAIN;
if(wait_event_interruptible(card->rx_waitqueue,
!skb_queue_empty(&card->rx_queue)))
return -ERESTARTSYS;
if(down_interruptible(&card->sem))
return -ERESTARTSYS;
}
n = skb->len;
if(n > count)
n = count;
if(copy_to_user(buf, skb->data, n)) {
KDEBUG(ERROR, "EFAULT copying out data");
up(&card->sem);
return -EFAULT;
}
skb_pull(skb, n);
if(skb->len == 0) {
skb_unlink(skb, &card->rx_queue);
dev_kfree_skb(skb);
}
card->status.irq_handled = card->status.irq_count -
skb_queue_len(&card->rx_queue);
up(&card->sem);
return n;
}
开发者ID:CoreTech-Development,项目名称:buildroot-linux-kernel-m3,代码行数:41,代码来源:nano_pci_cdev.c
示例15: zd_usb_tx
/**
* zd_usb_tx: initiates transfer of a frame of the device
*
* @usb: the zd1211rw-private USB structure
* @skb: a &struct sk_buff pointer
*
* This function tranmits a frame to the device. It doesn't wait for
* completion. The frame must contain the control set and have all the
* control set information available.
*
* The function returns 0 if the transfer has been successfully initiated.
*/
int zd_usb_tx(struct zd_usb *usb, struct sk_buff *skb)
{
int r;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct usb_device *udev = zd_usb_to_usbdev(usb);
struct urb *urb;
struct zd_usb_tx *tx = &usb->tx;
if (!atomic_read(&tx->enabled)) {
r = -ENOENT;
goto out;
}
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) {
r = -ENOMEM;
goto out;
}
usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
skb->data, skb->len, tx_urb_complete, skb);
info->rate_driver_data[1] = (void *)jiffies;
skb_queue_tail(&tx->submitted_skbs, skb);
usb_anchor_urb(urb, &tx->submitted);
r = usb_submit_urb(urb, GFP_ATOMIC);
if (r) {
dev_dbg_f(zd_usb_dev(usb), "error submit urb %p %d\n", urb, r);
usb_unanchor_urb(urb);
skb_unlink(skb, &tx->submitted_skbs);
goto error;
}
tx_inc_submitted_urbs(usb);
return 0;
error:
usb_free_urb(urb);
out:
return r;
}
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:52,代码来源:zd_usb.c
示例16: hfa384x_wait
static int hfa384x_wait(struct net_device *dev, struct sk_buff *skb)
{
struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local;
struct hostap_usb_priv *hw_priv = local->hw_priv;
int res;
unsigned long flags;
res = wait_for_completion_interruptible_timeout(&hfa384x_cb(skb)->comp, 5 * HZ);
if (res > 0)
return 0;
if (res == 0) {
res = -ETIMEDOUT;
}
usb_kill_urb(&hw_priv->tx_urb);
// FIXME: rethink
spin_lock_irqsave(&hw_priv->tx_queue.lock, flags);
if (skb->next)
skb_unlink(skb, &hw_priv->tx_queue);
spin_unlock_irqrestore(&hw_priv->tx_queue.lock, flags);
return res;
}
开发者ID:lumag,项目名称:HostAP-USB,代码行数:24,代码来源:hostap_usb.c
示例17: sab8253xn_write2
/* not do -- makes minimum 64 bytes add crc, etc*/
int
sab8253xn_write2(struct sk_buff *skb, struct net_device *dev)
{
size_t cnt;
unsigned int flags;
SAB_PORT *priv = (SAB_PORT*) dev->priv;
struct sk_buff *substitute;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
if(dev->tbusy != 0) /* something of an error */
{
++(priv->Counters.tx_drops);
dev_kfree_skb_any(skb);
return -EBUSY; /* only during release */
}
#endif
if(priv->active2.transmit == NULL)
{
return -ENOMEM;
}
DEBUGPRINT((KERN_ALERT "sab8253x: sending IP packet(bytes):\n"));
DEBUGPRINT((KERN_ALERT "sab8253x: start address is %p.\n", skb->data));
cnt = skb->tail - skb->data;
cnt = MIN(cnt, sab8253xn_rbufsize);
if(cnt < ETH_ZLEN)
{
if((skb->end - skb->data) >= ETH_ZLEN)
{
skb->tail = (skb->data + ETH_ZLEN);
cnt = ETH_ZLEN;
}
else
{
substitute = dev_alloc_skb(ETH_ZLEN);
if(substitute == NULL)
{
dev_kfree_skb_any(skb);
return 0;
}
substitute->tail = (substitute->data + ETH_ZLEN);
memcpy(substitute->data, skb->data, cnt);
cnt = ETH_ZLEN;
dev_kfree_skb_any(skb);
skb = substitute;
}
}
save_flags(flags); cli();
if((priv->active2.transmit->Count & OWNER) == OWN_SAB)
{
++(priv->Counters.tx_drops);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
dev->tbusy = 1;
#else
netif_stop_queue (dev);
#endif
priv->tx_full = 1;
restore_flags(flags);
return 1;
}
restore_flags(flags);
#ifndef FREEINTERRUPT
if(priv->active2.transmit->HostVaddr != NULL)
{
register RING_DESCRIPTOR *freeme;
freeme = priv->active2.transmit;
do
{
skb_unlink((struct sk_buff*)freeme->HostVaddr);
dev_kfree_skb_any((struct sk_buff*)freeme->HostVaddr);
freeme->HostVaddr = NULL;
freeme = (RING_DESCRIPTOR*) freeme->VNext;
}
while(((freeme->Count & OWNER) != OWN_SAB) &&
(freeme->HostVaddr != NULL));
}
#endif
dev->trans_start = jiffies;
skb_queue_head(priv->sab8253xbuflist, skb);
priv->active2.transmit->HostVaddr = skb;
priv->active2.transmit->sendcrc = 1;
priv->active2.transmit->crcindex = 0;
priv->active2.transmit->crc = fn_calc_memory_crc32(skb->data, cnt);
priv->active2.transmit->Count = (OWN_SAB|cnt); /* must be this order */
priv->active2.transmit =
(RING_DESCRIPTOR*) priv->active2.transmit->VNext;
priv->Counters.transmitbytes += cnt;
sab8253x_start_txS(priv);
return 0;
}
开发者ID:GunioRobot,项目名称:MI424WR_GEN2_Rev_E-F,代码行数:96,代码来源:8253xnet.c
示例18: dn_nsp_check_xmit_queue
int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum)
{
struct dn_skb_cb *cb = DN_SKB_CB(skb);
struct dn_scp *scp = DN_SK(sk);
struct sk_buff *skb2, *n, *ack = NULL;
int wakeup = 0;
int try_retrans = 0;
unsigned long reftime = cb->stamp;
unsigned long pkttime;
unsigned short xmit_count;
unsigned short segnum;
skb_queue_walk_safe(q, skb2, n) {
struct dn_skb_cb *cb2 = DN_SKB_CB(skb2);
if (dn_before_or_equal(cb2->segnum, acknum))
ack = skb2;
/* printk(KERN_DEBUG "ack: %s %04x %04x\n", ack ? "ACK" : "SKIP", (int)cb2->segnum, (int)acknum); */
if (ack == NULL)
continue;
/* printk(KERN_DEBUG "check_xmit_queue: %04x, %d\n", acknum, cb2->xmit_count); */
/* Does _last_ packet acked have xmit_count > 1 */
try_retrans = 0;
/* Remember to wake up the sending process */
wakeup = 1;
/* Keep various statistics */
pkttime = cb2->stamp;
xmit_count = cb2->xmit_count;
segnum = cb2->segnum;
/* Remove and drop ack'ed packet */
skb_unlink(ack, q);
kfree_skb(ack);
ack = NULL;
/*
* We don't expect to see acknowledgements for packets we
* haven't sent yet.
*/
WARN_ON(xmit_count == 0);
/*
* If the packet has only been sent once, we can use it
* to calculate the RTT and also open the window a little
* further.
*/
if (xmit_count == 1) {
if (dn_equal(segnum, acknum))
dn_nsp_rtt(sk, (long)(pkttime - reftime));
if (scp->snd_window < scp->max_window)
scp->snd_window++;
}
/*
* Packet has been sent more than once. If this is the last
* packet to be acknowledged then we want to send the next
* packet in the send queue again (assumes the remote host does
* go-back-N error control).
*/
if (xmit_count > 1)
try_retrans = 1;
}
if (try_retrans)
dn_nsp_output(sk);
return wakeup;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:72,代码来源:dn_nsp_out.c
示例19: AMSDU_GetAggregatibleList
/* NOTE:
This function return a list of SKB which is proper to be aggregated.
If no proper SKB is found to do aggregation, SendList will only contain the input SKB.
*/
u8 AMSDU_GetAggregatibleList(
struct rtllib_device * ieee,
struct sk_buff * pCurSkb,
struct sk_buff_head *pSendList,
u8 queue_index,
bool is_ap
)
{
struct sk_buff *pSkb = NULL;
u16 nMaxAMSDUSize = 0;
u32 AggrSize = 0;
u32 nAggrSkbNum = 0;
u8 padding = 0;
struct sta_info *psta = NULL;
u8 *addr = (u8*)(pCurSkb->data);
struct sk_buff_head *header;
struct sk_buff *punlinkskb = NULL;
padding = ((4-pCurSkb->len%4)==4)?0:(4-pCurSkb->len%4);
AggrSize = AMSDU_SUBHEADER_LEN + pCurSkb->len + padding;
skb_queue_tail(pSendList, pCurSkb);
nAggrSkbNum++;
if (is_ap) {
#ifdef ASL
if((ieee->iw_mode == IW_MODE_MASTER || ieee->iw_mode == IW_MODE_APSTA) && (ieee->ap_state == RTLLIB_LINKED)){
psta = ap_get_stainfo(ieee, addr);
if(NULL != psta){
nMaxAMSDUSize = psta->htinfo.AMSDU_MaxSize;
}
else {
return 1;
}
}else
#endif
return 1;
}else {
if(ieee->iw_mode == IW_MODE_ADHOC){
psta = GetStaInfo(ieee, addr);
if(NULL != psta)
nMaxAMSDUSize = psta->htinfo.AMSDU_MaxSize;
else
return 1;
}else{
nMaxAMSDUSize = ieee->pHTInfo->nCurrent_AMSDU_MaxSize;
}
}
if(ieee->pHTInfo->ForcedAMSDUMode == HT_AGG_FORCE_ENABLE)
{
nMaxAMSDUSize = ieee->pHTInfo->ForcedAMSDUMaxSize;
}
if (is_ap) {
#ifdef ASL
header = (&ieee->skb_apaggQ[queue_index]);
#endif
} else
header = (&ieee->skb_aggQ[queue_index]);
pSkb = header->next;
while(pSkb != (struct sk_buff*)header)
{
if (is_ap) {
#ifdef ASL
if((ieee->iw_mode == IW_MODE_MASTER) ||(ieee->iw_mode == IW_MODE_APSTA))
{
if(memcmp(pCurSkb->data, pSkb->data, ETH_ALEN) != 0)
{
pSkb = pSkb->next;
continue;
}
}
#endif
} else {
if(ieee->iw_mode == IW_MODE_ADHOC)
{
if(memcmp(pCurSkb->data, pSkb->data, ETH_ALEN) != 0)
{
pSkb = pSkb->next;
continue;
}
}
}
if((AMSDU_SUBHEADER_LEN + pSkb->len + AggrSize < nMaxAMSDUSize) )
{
punlinkskb = pSkb;
pSkb = pSkb->next;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
skb_unlink(punlinkskb, header);
#else
/*
* __skb_unlink before linux2.6.14 does not use spinlock to protect list head.
* add spinlock function manually. john,2008/12/03
*/
//.........这里部分代码省略.........
开发者ID:UNwS,项目名称:rtl8192su,代码行数:101,代码来源:rtllib_tx.c
示例20: poll_rx
static void poll_rx(struct atm_dev *dev,int mbx)
{
struct zatm_dev *zatm_dev;
unsigned long pos;
u32 x;
int error;
EVENT("poll_rx\n",0,0);
zatm_dev = ZATM_DEV(dev);
pos = (zatm_dev->mbx_start[mbx] & ~0xffffUL) | zin(MTA(mbx));
while (x = zin(MWA(mbx)), (pos & 0xffff) != x) {
u32 *here;
struct sk_buff *skb;
struct atm_vcc *vcc;
int cells,size,chan;
EVENT("MBX: host 0x%lx, nic 0x%x\n",pos,x);
here = (u32 *) pos;
if (((pos += 16) & 0xffff) == zatm_dev->mbx_end[mbx])
pos = zatm_dev->mbx_start[mbx];
cells = here[0] & uPD98401_AAL5_SIZE;
#if 0
printk("RX IND: 0x%x, 0x%x, 0x%x, 0x%x\n",here[0],here[1],here[2],here[3]);
{
unsigned long *x;
printk("POOL: 0x%08x, 0x%08x\n",zpeekl(zatm_dev,
zatm_dev->pool_base),
zpeekl(zatm_dev,zatm_dev->pool_base+1));
x = (unsigned long *) here[2];
printk("[0..3] = 0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx\n",
x[0],x[1],x[2],x[3]);
}
#endif
error = 0;
if (here[3] & uPD98401_AAL5_ERR) {
error = (here[3] & uPD98401_AAL5_ES) >>
uPD98401_AAL5_ES_SHIFT;
if (error == uPD98401_AAL5_ES_DEACT ||
error == uPD98401_AAL5_ES_FREE) continue;
}
EVENT("error code 0x%x/0x%x\n",(here[3] & uPD98401_AAL5_ES) >>
uPD98401_AAL5_ES_SHIFT,error);
skb = ((struct rx_buffer_head *) bus_to_virt(here[2]))->skb;
__net_timestamp(skb);
#if 0
printk("[-3..0] 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n",((unsigned *) skb->data)[-3],
((unsigned *) skb->data)[-2],((unsigned *) skb->data)[-1],
((unsigned *) skb->data)[0]);
#endif
EVENT("skb 0x%lx, here 0x%lx\n",(unsigned long) skb,
(unsigned long) here);
#if 0
printk("dummy: 0x%08lx, 0x%08lx\n",dummy[0],dummy[1]);
#endif
size = error ? 0 : ntohs(((__be16 *) skb->data)[cells*
ATM_CELL_PAYLOAD/sizeof(u16)-3]);
EVENT("got skb 0x%lx, size %d\n",(unsigned long) skb,size);
chan = (here[3] & uPD98401_AAL5_CHAN) >>
uPD98401_AAL5_CHAN_SHIFT;
if (chan < zatm_dev->chans && zatm_dev->rx_map[chan]) {
int pos;
vcc = zatm_dev->rx_map[chan];
pos = ZATM_VCC(vcc)->pool;
if (skb == zatm_dev->last_free[pos])
zatm_dev->last_free[pos] = NULL;
skb_unlink(skb, zatm_dev->pool + pos);
}
else {
printk(KERN_ERR DEV_LABEL "(itf %d): RX indication "
"for non-existing channel\n",dev->number);
size = 0;
vcc = NULL;
event_dump();
}
if (error) {
static unsigned long silence = 0;
static int last_error = 0;
if (error != last_error ||
time_after(jiffies, silence) || silence == 0){
printk(KERN_WARNING DEV_LABEL "(itf %d): "
"chan %d error %s\n",dev->number,chan,
err_txt[error]);
last_error = error;
silence = (jiffies+2*HZ)|1;
}
size = 0;
}
if (size && (size > cells*ATM_CELL_PAYLOAD-ATM_AAL5_TRAILER ||
size <= (cells-1)*ATM_CELL_PAYLOAD-ATM_AAL5_TRAILER)) {
printk(KERN_ERR DEV_LABEL "(itf %d): size %d with %d "
"cells\n",dev->number,size,cells);
size = 0;
event_dump();
}
if (size > ATM_MAX_AAL5_PDU) {
printk(KERN_ERR DEV_LABEL "(itf %d): size too big "
"(%d)\n",dev->number,size);
size = 0;
event_dump();
//.........这里部分代码省略.........
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:101,代码来源:zatm.c
注:本文中的skb_unlink函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论