本文整理汇总了C++中skb_set_tail_pointer函数的典型用法代码示例。如果您正苦于以下问题:C++ skb_set_tail_pointer函数的具体用法?C++ skb_set_tail_pointer怎么用?C++ skb_set_tail_pointer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skb_set_tail_pointer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_current_link
/**
* SIPC header_create() family functions
*
* Create SIPC5 header
*
* sipc5_hdr_create_skb()
* Create common SIPC5 header
*
* sipc5_hdr_create_legacy_rfs()
* Create SIPC5 header with IPC4.1 RFS header
* Because IMC modem used the 256KB rfs packet and RILD check the full
* packet with RFS header len, kernel remove the SIPC5 header and add the
* lagacy RFS header.
*
* sipc5_hdr_create_multifmt()
* TBD
*
* sipc5_hdr_create_skb_handover()
* Remove the ethernet frame When use `handover' with Network Bridge,
* user -> bridge device(rmnet0) -> real rmnet(xxxx_rmnet0) -> here.
* bridge device is ethernet device unlike xxxx_rmnet(net device).
* We remove the an ethernet header of skb before using skb->len,
* because bridge device added an ethernet header to skb.
*
* RETURN
* Returns the socket buffer that added SIPC5 header.
*
**/
static struct sk_buff *sipc5_hdr_create(struct io_device *iod,
struct sipc_hdr *hdr, struct sk_buff *skb)
{
struct sipc5_link_hdr *sipc5h;
struct link_device *ld = get_current_link(iod);
if (skb->len > 0xFFFF - SIPC5_HDR_LEN_MAX) {
sipc5h = (struct sipc5_link_hdr *)
skb_push(skb, SIPC5_HDR_LEN_EXT);
sipc5h->cfg = SIPC5_HDR_CFG_START | SIPC5_HDR_EXT;
*((u32 *)&sipc5h->len) = (u32)(skb->len);
} else {
sipc5h = (struct sipc5_link_hdr *)
skb_push(skb, SIPC5_HDR_LEN);
sipc5h->cfg = SIPC5_HDR_CFG_START;
sipc5h->len = (u16)(skb->len);
}
sipc5h->ch = iod->id;
/* Should check the alignment for dynamic switch link dev*/
if (ld->aligned) {
sipc5h->cfg |= SIPC5_HDR_PAD;
skb_set_tail_pointer(skb, SIPC_ALIGN(skb->len));
skb->len = SIPC_ALIGN(skb->len);
}
skbpriv(skb)->sipch = (void *)sipc5h;
return skb;
}
开发者ID:DerTeufel,项目名称:SGS3-Sourcedrops,代码行数:56,代码来源:sipc5_io_device.c
示例2: linux_if_rx
static int
linux_if_rx(struct vr_interface *vif, struct vr_packet *pkt)
{
int rc;
struct net_device *dev = (struct net_device *)vif->vif_os;
struct sk_buff *skb = vp_os_packet(pkt);
struct vr_ip *ip;
unsigned short network_off, transport_off, cksum_off = 0;
skb->data = pkt->vp_head + pkt->vp_data;
skb->len = pkt_len(pkt);
skb_set_tail_pointer(skb, pkt_head_len(pkt));
if (!dev) {
kfree_skb(skb);
goto exit_rx;
}
(void)__sync_fetch_and_add(&dev->stats.rx_bytes, skb->len);
(void)__sync_fetch_and_add(&dev->stats.rx_packets, 1);
/* this is only needed for mirroring */
if ((pkt->vp_flags & VP_FLAG_FROM_DP) &&
(pkt->vp_flags & VP_FLAG_CSUM_PARTIAL)) {
network_off = pkt_get_network_header_off(pkt);
ip = (struct vr_ip *)(pkt_data_at_offset(pkt, network_off));
transport_off = network_off + (ip->ip_hl * 4);
if (ip->ip_proto == VR_IP_PROTO_TCP)
cksum_off = offsetof(struct vr_tcp, tcp_csum);
else if (ip->ip_proto == VR_IP_PROTO_UDP)
开发者ID:sysbot,项目名称:contrail-vrouter,代码行数:31,代码来源:vr_host_interface.c
示例3: RND4
static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
{
u32 readsize, ret;
u8 *readbuf;
struct recv_priv *recv_priv;
struct recv_buf *recvbuf;
/* Patch for some SDIO Host 4 bytes issue */
/* ex. RK3188 */
readsize = RND4(size);
/* 3 1. alloc recvbuf */
recv_priv = &adapter->recvpriv;
recvbuf = rtw_dequeue_recvbuf(&recv_priv->free_recv_buf_queue);
if (!recvbuf) {
DBG_871X_LEVEL(_drv_err_, "%s: alloc recvbuf FAIL!\n", __func__);
return NULL;
}
/* 3 2. alloc skb */
if (!recvbuf->pskb) {
SIZE_PTR tmpaddr = 0;
SIZE_PTR alignment = 0;
recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
if (recvbuf->pskb) {
recvbuf->pskb->dev = adapter->pnetdev;
tmpaddr = (SIZE_PTR)recvbuf->pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
}
if (!recvbuf->pskb) {
DBG_871X("%s: alloc_skb fail! read =%d\n", __func__, readsize);
return NULL;
}
}
/* 3 3. read data from rxfifo */
readbuf = recvbuf->pskb->data;
ret = sdio_read_port(&adapter->iopriv.intf, WLAN_RX0FF_DEVICE_ID, readsize, readbuf);
if (ret == _FAIL) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("%s: read port FAIL!\n", __func__));
return NULL;
}
/* 3 4. init recvbuf */
recvbuf->len = size;
recvbuf->phead = recvbuf->pskb->head;
recvbuf->pdata = recvbuf->pskb->data;
skb_set_tail_pointer(recvbuf->pskb, size);
recvbuf->ptail = skb_tail_pointer(recvbuf->pskb);
recvbuf->pend = skb_end_pointer(recvbuf->pskb);
return recvbuf;
}
开发者ID:Lyude,项目名称:linux,代码行数:60,代码来源:sdio_ops.c
示例4: net1080_tx_fixup
static struct sk_buff *
net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
{
struct sk_buff *skb2;
struct nc_header *header = NULL;
struct nc_trailer *trailer = NULL;
int padlen = sizeof (struct nc_trailer);
int len = skb->len;
if (!((len + padlen + sizeof (struct nc_header)) & 0x01))
padlen++;
if (!skb_cloned(skb)) {
int headroom = skb_headroom(skb);
int tailroom = skb_tailroom(skb);
if (padlen <= tailroom &&
sizeof(struct nc_header) <= headroom)
/* There's enough head and tail room */
goto encapsulate;
if ((sizeof (struct nc_header) + padlen) <
(headroom + tailroom)) {
/* There's enough total room, so just readjust */
skb->data = memmove(skb->head
+ sizeof (struct nc_header),
skb->data, skb->len);
skb_set_tail_pointer(skb, len);
goto encapsulate;
}
}
/* Create a new skb to use with the correct size */
skb2 = skb_copy_expand(skb,
sizeof (struct nc_header),
padlen,
flags);
dev_kfree_skb_any(skb);
if (!skb2)
return skb2;
skb = skb2;
encapsulate:
/* header first */
header = (struct nc_header *) skb_push(skb, sizeof *header);
header->hdr_len = cpu_to_le16(sizeof (*header));
header->packet_len = cpu_to_le16(len);
header->packet_id = cpu_to_le16((u16)dev->xid++);
/* maybe pad; then trailer */
if (!((skb->len + sizeof *trailer) & 0x01))
*skb_put(skb, 1) = PAD_BYTE;
trailer = (struct nc_trailer *) skb_put(skb, sizeof *trailer);
put_unaligned(header->packet_id, &trailer->packet_id);
#if 0
netdev_dbg(dev->net, "frame >tx h %d p %d id %d\n",
header->hdr_len, header->packet_len,
header->packet_id);
#endif
return skb;
}
开发者ID:020gzh,项目名称:linux,代码行数:60,代码来源:net1080.c
示例5: r8712_recv_indicatepkt
void r8712_recv_indicatepkt(struct _adapter *padapter,
union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
struct __queue *pfree_recv_queue;
_pkt *skb;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
skb = precv_frame->u.hdr.pkt;
if (skb == NULL)
goto _recv_indicatepkt_drop;
skb->data = precv_frame->u.hdr.rx_data;
skb->len = precv_frame->u.hdr.len;
skb_set_tail_pointer(skb, skb->len);
if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1))
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb->ip_summed = CHECKSUM_NONE;
skb->dev = padapter->pnetdev;
skb->protocol = eth_type_trans(skb, padapter->pnetdev);
netif_rx(skb);
precv_frame->u.hdr.pkt = NULL; /* pointers to NULL before
* r8712_free_recvframe() */
r8712_free_recvframe(precv_frame, pfree_recv_queue);
return;
_recv_indicatepkt_drop:
/*enqueue back to free_recv_queue*/
if (precv_frame)
r8712_free_recvframe(precv_frame, pfree_recv_queue);
precvpriv->rx_drop++;
}
开发者ID:Abioy,项目名称:kasan,代码行数:33,代码来源:recv_linux.c
示例6: sd_recv_rxfifo
static struct recv_buf* sd_recv_rxfifo(PADAPTER padapter, u32 size)
{
u32 readsize, ret;
u8 *preadbuf;
struct recv_priv *precvpriv;
struct recv_buf *precvbuf;
readsize = size;
//3 1. alloc recvbuf
precvpriv = &padapter->recvpriv;
precvbuf = rtw_dequeue_recvbuf(&precvpriv->free_recv_buf_queue);
if (precvbuf == NULL) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("%s: alloc recvbuf FAIL!\n", __FUNCTION__));
return NULL;
}
//3 2. alloc skb
if (precvbuf->pskb == NULL) {
SIZE_PTR tmpaddr=0;
SIZE_PTR alignment=0;
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
if(precvbuf->pskb)
{
precvbuf->pskb->dev = padapter->pnetdev;
tmpaddr = (SIZE_PTR)precvbuf->pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
}
if (precvbuf->pskb == NULL) {
DBG_871X("%s: alloc_skb fail! read=%d\n", __FUNCTION__, readsize);
return NULL;
}
}
//3 3. read data from rxfifo
preadbuf = precvbuf->pskb->data;
// rtw_read_port(padapter, WLAN_RX0FF_DEVICE_ID, readsize, preadbuf);
ret = sdio_read_port(&padapter->iopriv.intf, WLAN_RX0FF_DEVICE_ID, readsize, preadbuf);
if (ret == _FAIL) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("%s: read port FAIL!\n", __FUNCTION__));
return NULL;
}
//3 4. init recvbuf
precvbuf->len = readsize;
precvbuf->phead = precvbuf->pskb->head;
precvbuf->pdata = precvbuf->pskb->data;
skb_set_tail_pointer(precvbuf->pskb, readsize);
precvbuf->ptail = skb_tail_pointer(precvbuf->pskb);
precvbuf->pend = skb_end_pointer(precvbuf->pskb);
return precvbuf;
}
开发者ID:OpenLD,项目名称:linux-wetek-3.10.y,代码行数:60,代码来源:sdio_ops.c
示例7: rtw_recv_indicatepkt
int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
_queue *pfree_recv_queue;
_pkt *skb;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
DBG_COUNTER(padapter->rx_logs.os_indicate);
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
skb = precv_frame->u.hdr.pkt;
if (skb == NULL)
{
RT_TRACE(_module_recv_osdep_c_, _drv_err_, ("rtw_recv_indicatepkt():skb ==NULL something wrong!!!!\n"));
goto _recv_indicatepkt_drop;
}
RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("rtw_recv_indicatepkt():skb != NULL !!!\n"));
RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("rtw_recv_indicatepkt():precv_frame->u.hdr.rx_head =%p precv_frame->hdr.rx_data =%p\n", precv_frame->u.hdr.rx_head, precv_frame->u.hdr.rx_data));
RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("precv_frame->hdr.rx_tail =%p precv_frame->u.hdr.rx_end =%p precv_frame->hdr.len =%d \n", precv_frame->u.hdr.rx_tail, precv_frame->u.hdr.rx_end, precv_frame->u.hdr.len));
skb->data = precv_frame->u.hdr.rx_data;
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
skb->len = precv_frame->u.hdr.len;
RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n", skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->len));
#ifdef CONFIG_AUTO_AP_MODE
if (0x8899 == pattrib->eth_type)
{
rtw_os_ksocket_send(padapter, precv_frame);
/* goto _recv_indicatepkt_drop; */
}
#endif /* CONFIG_AUTO_AP_MODE */
rtw_os_recv_indicate_pkt(padapter, skb, pattrib);
precv_frame->u.hdr.pkt = NULL; /* pointers to NULL before rtw_free_recvframe() */
rtw_free_recvframe(precv_frame, pfree_recv_queue);
RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n rtw_recv_indicatepkt :after rtw_os_recv_indicate_pkt!!!!\n"));
return _SUCCESS;
_recv_indicatepkt_drop:
/* enqueue back to free_recv_queue */
if (precv_frame)
rtw_free_recvframe(precv_frame, pfree_recv_queue);
DBG_COUNTER(padapter->rx_logs.os_indicate_err);
return _FAIL;
}
开发者ID:jasonabele,项目名称:rtl8723bs,代码行数:59,代码来源:recv_linux.c
示例8: rtw_skb_alloc
_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata)
{
u16 eth_type;
u8 *data_ptr;
_pkt *sub_skb;
struct rx_pkt_attrib *pattrib;
pattrib = &prframe->u.hdr.attrib;
#ifdef CONFIG_SKB_COPY
sub_skb = rtw_skb_alloc(nSubframe_Length + 12);
if(sub_skb)
{
skb_reserve(sub_skb, 12);
data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length);
_rtw_memcpy(data_ptr, (pdata + ETH_HLEN), nSubframe_Length);
}
else
#endif // CONFIG_SKB_COPY
{
sub_skb = rtw_skb_clone(prframe->u.hdr.pkt);
if(sub_skb)
{
sub_skb->data = pdata + ETH_HLEN;
sub_skb->len = nSubframe_Length;
skb_set_tail_pointer(sub_skb, nSubframe_Length);
}
else
{
DBG_871X("%s(): rtw_skb_clone() Fail!!!\n",__FUNCTION__);
return NULL;
}
}
eth_type = RTW_GET_BE16(&sub_skb->data[6]);
if (sub_skb->len >= 8 &&
((_rtw_memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) &&
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
_rtw_memcmp(sub_skb->data, rtw_bridge_tunnel_header, SNAP_SIZE) )) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */
skb_pull(sub_skb, SNAP_SIZE);
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
} else {
u16 len;
/* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len);
_rtw_memcpy(skb_push(sub_skb, 2), &len, 2);
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
}
return sub_skb;
}
开发者ID:neverhover,项目名称:rtl8821au,代码行数:55,代码来源:recv_linux.c
示例9: skb_headroom
static struct sk_buff *int51x1_tx_fixup(struct usbnet *dev,
struct sk_buff *skb, gfp_t flags)
{
int pack_len = skb->len;
int pack_with_header_len = pack_len + INT51X1_HEADER_SIZE;
int headroom = skb_headroom(skb);
int tailroom = skb_tailroom(skb);
int need_tail = 0;
__le16 *len;
/* */
if ((pack_with_header_len) < dev->maxpacket)
need_tail = dev->maxpacket - pack_with_header_len + 1;
/*
*/
else if (!(pack_with_header_len % dev->maxpacket))
need_tail = 1;
if (!skb_cloned(skb) &&
(headroom + tailroom >= need_tail + INT51X1_HEADER_SIZE)) {
if (headroom < INT51X1_HEADER_SIZE || tailroom < need_tail) {
skb->data = memmove(skb->head + INT51X1_HEADER_SIZE,
skb->data, skb->len);
skb_set_tail_pointer(skb, skb->len);
}
} else {
struct sk_buff *skb2;
skb2 = skb_copy_expand(skb,
INT51X1_HEADER_SIZE,
need_tail,
flags);
dev_kfree_skb_any(skb);
if (!skb2)
return NULL;
skb = skb2;
}
pack_len += need_tail;
pack_len &= 0x07ff;
len = (__le16 *) __skb_push(skb, INT51X1_HEADER_SIZE);
*len = cpu_to_le16(pack_len);
if(need_tail)
memset(__skb_put(skb, need_tail), 0, need_tail);
return skb;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:52,代码来源:int51x1.c
示例10: rndis_tx_fixup
static struct sk_buff *
rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
{
struct rndis_data_hdr *hdr;
struct sk_buff *skb2;
unsigned len = skb->len;
if (likely(!skb_cloned(skb))) {
int room = skb_headroom(skb);
/* enough head room as-is? */
if (unlikely((sizeof *hdr) <= room))
goto fill;
/* enough room, but needs to be readjusted? */
room += skb_tailroom(skb);
if (likely((sizeof *hdr) <= room)) {
skb->data = memmove(skb->head + sizeof *hdr,
skb->data, len);
skb_set_tail_pointer(skb, len);
goto fill;
}
}
/* create a new skb, with the correct size (and tailpad) */
skb2 = skb_copy_expand(skb, sizeof *hdr, 1, flags);
dev_kfree_skb_any(skb);
if (unlikely(!skb2))
return skb2;
skb = skb2;
/* fill out the RNDIS header. we won't bother trying to batch
* packets; Linux minimizes wasted bandwidth through tx queues.
*/
fill:
hdr = (void *) __skb_push(skb, sizeof *hdr);
memset(hdr, 0, sizeof *hdr);
hdr->msg_type = RNDIS_MSG_PACKET;
hdr->msg_len = cpu_to_le32(skb->len);
hdr->data_offset = ccpu2(sizeof(*hdr) - 8);
hdr->data_len = cpu_to_le32(len);
/* FIXME make the last packet always be short ... */
return skb;
}
开发者ID:amalrajt,项目名称:linux-sh4-2.6.23.17_stm23_A18B,代码行数:45,代码来源:rndis_host.c
示例11: rtw_recv_monitor
int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
{
int ret = _FAIL;
struct recv_priv *precvpriv;
_queue *pfree_recv_queue;
_pkt *skb;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rx_pkt_attrib *pattrib;
if (NULL == precv_frame)
goto _recv_drop;
pattrib = &precv_frame->u.hdr.attrib;
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
skb = precv_frame->u.hdr.pkt;
if (skb == NULL) {
DBG_871X("%s :skb==NULL something wrong!!!!\n", __func__);
goto _recv_drop;
}
skb->data = precv_frame->u.hdr.rx_data;
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
skb->len = precv_frame->u.hdr.len;
skb->ip_summed = CHECKSUM_NONE;
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = htons(0x0019); /* ETH_P_80211_RAW */
rtw_netif_rx(padapter->pnetdev, skb);
/* pointers to NULL before rtw_free_recvframe() */
precv_frame->u.hdr.pkt = NULL;
ret = _SUCCESS;
_recv_drop:
/* enqueue back to free_recv_queue */
if (precv_frame)
rtw_free_recvframe(precv_frame, pfree_recv_queue);
return ret;
}
开发者ID:neverhover,项目名称:rtl8821au,代码行数:45,代码来源:recv_linux.c
示例12: genelink_tx_fixup
static struct sk_buff *
genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
{
int padlen;
int length = skb->len;
int headroom = skb_headroom(skb);
int tailroom = skb_tailroom(skb);
__le32 *packet_count;
__le32 *packet_len;
// FIXME: magic numbers, bleech
padlen = ((skb->len + (4 + 4*1)) % 64) ? 0 : 1;
if ((!skb_cloned(skb))
&& ((headroom + tailroom) >= (padlen + (4 + 4*1)))) {
if ((headroom < (4 + 4*1)) || (tailroom < padlen)) {
skb->data = memmove(skb->head + (4 + 4*1),
skb->data, skb->len);
skb_set_tail_pointer(skb, skb->len);
}
} else {
struct sk_buff *skb2;
skb2 = skb_copy_expand(skb, (4 + 4*1) , padlen, flags);
dev_kfree_skb_any(skb);
skb = skb2;
if (!skb)
return NULL;
}
// attach the packet count to the header
packet_count = (__le32 *) skb_push(skb, (4 + 4*1));
packet_len = packet_count + 1;
*packet_count = cpu_to_le32(1);
*packet_len = cpu_to_le32(length);
// add padding byte
if ((skb->len % dev->maxpacket) == 0)
skb_put(skb, 1);
return skb;
}
开发者ID:mb3dot,项目名称:community-b3-kernel,代码行数:42,代码来源:gl620a.c
示例13: pkt_to_skb
struct cfpkt *cfpkt_append(struct cfpkt *dstpkt,
struct cfpkt *addpkt,
u16 expectlen)
{
struct sk_buff *dst = pkt_to_skb(dstpkt);
struct sk_buff *add = pkt_to_skb(addpkt);
u16 addlen = skb_headlen(add);
u16 neededtailspace;
struct sk_buff *tmp;
u16 dstlen;
u16 createlen;
if (unlikely(is_erronous(dstpkt) || is_erronous(addpkt))) {
cfpkt_destroy(addpkt);
return dstpkt;
}
if (expectlen > addlen)
neededtailspace = expectlen;
else
neededtailspace = addlen;
if (dst->tail + neededtailspace > dst->end) {
/* Create a dumplicate of 'dst' with more tail space */
struct cfpkt *tmppkt;
dstlen = skb_headlen(dst);
createlen = dstlen + neededtailspace;
tmppkt = cfpkt_create(createlen + PKT_PREFIX + PKT_POSTFIX);
if (tmppkt == NULL)
return NULL;
tmp = pkt_to_skb(tmppkt);
skb_set_tail_pointer(tmp, dstlen);
tmp->len = dstlen;
memcpy(tmp->data, dst->data, dstlen);
cfpkt_destroy(dstpkt);
dst = tmp;
}
memcpy(skb_tail_pointer(dst), add->data, skb_headlen(add));
cfpkt_destroy(addpkt);
dst->tail += addlen;
dst->len += addlen;
return skb_to_pkt(dst);
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:41,代码来源:cfpkt_skbuff.c
示例14: get_current_link
static struct sk_buff *sipc5_hdr_create_ipcloopback(struct io_device *iod,
struct sipc_hdr *hdr, struct sk_buff *skb)
{
struct sipc5_link_hdr *sipc5h;
struct link_device *ld = get_current_link(iod);
sipc5h = (struct sipc5_link_hdr *)
skb_push(skb, SIPC5_HDR_LEN);
sipc5h->cfg = SIPC5_HDR_CFG_START;
sipc5h->len = (u16)(skb->len);
mif_info("send ipcloopback data: %d\n", skb->len);
sipc5h->ch = SIPC5_CH_ID_FMT_0;
/* Should check the alignment for dynamic switch link dev*/
if (ld->aligned) {
sipc5h->cfg |= SIPC5_HDR_PAD;
skb_set_tail_pointer(skb, SIPC_ALIGN(skb->len));
skb->len = SIPC_ALIGN(skb->len);
}
skbpriv(skb)->sipch = (void *)sipc5h;
return skb;
}
开发者ID:lssjbrolli,项目名称:android_kernel_samsung_klimtlte,代码行数:23,代码来源:sipc5_io_device.c
示例15: pkt_to_skb
struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos)
{
struct sk_buff *skb2;
struct sk_buff *skb = pkt_to_skb(pkt);
struct cfpkt *tmppkt;
u8 *split = skb->data + pos;
u16 len2nd = skb_tail_pointer(skb) - split;
if (unlikely(is_erronous(pkt)))
return NULL;
if (skb->data + pos > skb_tail_pointer(skb)) {
PKT_ERROR(pkt, "trying to split beyond end of packet\n");
return NULL;
}
/* Create a new packet for the second part of the data */
tmppkt = cfpkt_create_pfx(len2nd + PKT_PREFIX + PKT_POSTFIX,
PKT_PREFIX);
if (tmppkt == NULL)
return NULL;
skb2 = pkt_to_skb(tmppkt);
if (skb2 == NULL)
return NULL;
/* Reduce the length of the original packet */
skb_set_tail_pointer(skb, pos);
skb->len = pos;
memcpy(skb2->data, split, len2nd);
skb2->tail += len2nd;
skb2->len += len2nd;
skb2->priority = skb->priority;
return skb_to_pkt(skb2);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:37,代码来源:cfpkt_skbuff.c
示例16: rtw_recv_indicatepkt
int rtw_recv_indicatepkt(struct adapter *padapter,
struct recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
struct __queue *pfree_recv_queue;
struct sk_buff *skb;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
skb = precv_frame->pkt;
if (!skb) {
RT_TRACE(_module_recv_osdep_c_, _drv_err_,
("rtw_recv_indicatepkt():skb == NULL something wrong!!!!\n"));
goto _recv_indicatepkt_drop;
}
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
("rtw_recv_indicatepkt():skb != NULL !!!\n"));
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
("rtw_recv_indicatepkt():precv_frame->rx_head =%p precv_frame->hdr.rx_data =%p\n",
precv_frame->rx_head, precv_frame->rx_data));
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
("precv_frame->hdr.rx_tail =%p precv_frame->rx_end =%p precv_frame->hdr.len =%d\n",
precv_frame->rx_tail, precv_frame->rx_end,
precv_frame->len));
skb->data = precv_frame->rx_data;
skb_set_tail_pointer(skb, precv_frame->len);
skb->len = precv_frame->len;
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
("skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n",
skb->head, skb->data, skb_tail_pointer(skb),
skb_end_pointer(skb), skb->len));
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
struct sk_buff *pskb2 = NULL;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
int bmcast = IS_MCAST(pattrib->dst);
if (memcmp(pattrib->dst, myid(&padapter->eeprompriv),
ETH_ALEN)) {
if (bmcast) {
psta = rtw_get_bcmc_stainfo(padapter);
pskb2 = skb_clone(skb, GFP_ATOMIC);
} else {
psta = rtw_get_stainfo(pstapriv, pattrib->dst);
}
if (psta) {
struct net_device *pnetdev;
pnetdev = (struct net_device *)padapter->pnetdev;
skb->dev = pnetdev;
skb_set_queue_mapping(skb, rtw_recv_select_queue(skb));
rtw_xmit_entry(skb, pnetdev);
if (bmcast)
skb = pskb2;
else
goto _recv_indicatepkt_end;
}
}
}
rcu_read_lock();
rcu_dereference(padapter->pnetdev->rx_handler_data);
rcu_read_unlock();
skb->ip_summed = CHECKSUM_NONE;
skb->dev = padapter->pnetdev;
skb->protocol = eth_type_trans(skb, padapter->pnetdev);
netif_rx(skb);
_recv_indicatepkt_end:
/* pointers to NULL before rtw_free_recvframe() */
precv_frame->pkt = NULL;
rtw_free_recvframe(precv_frame, pfree_recv_queue);
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
("\n rtw_recv_indicatepkt :after netif_rx!!!!\n"));
return _SUCCESS;
_recv_indicatepkt_drop:
/* enqueue back to free_recv_queue */
rtw_free_recvframe(precv_frame, pfree_recv_queue);
//.........这里部分代码省略.........
开发者ID:513855417,项目名称:linux,代码行数:101,代码来源:recv_linux.c
示例17: rtw_recv_indicatepkt
void rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
_queue *pfree_recv_queue;
_pkt *skb;
struct mlme_priv*pmlmepriv = &padapter->mlmepriv;
#ifdef CONFIG_RTL8712_TCP_CSUM_OFFLOAD_RX
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
#endif
_func_enter_;
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
#ifdef CONFIG_DRVEXT_MODULE
if (drvext_rx_handler(padapter, precv_frame->u.hdr.rx_data, precv_frame->u.hdr.len) == _SUCCESS)
{
rtw_free_recvframe(precv_frame, pfree_recv_queue);
return;
}
#endif
skb = precv_frame->u.hdr.pkt;
if(skb == NULL)
{
RT_TRACE(_module_recv_osdep_c_,_drv_err_,("rtw_recv_indicatepkt():skb==NULL something wrong!!!!\n"));
goto _recv_indicatepkt_drop;
}
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():skb != NULL !!!\n"));
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():precv_frame->u.hdr.rx_head=%p precv_frame->hdr.rx_data=%p\n", precv_frame->u.hdr.rx_head, precv_frame->u.hdr.rx_data));
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("precv_frame->hdr.rx_tail=%p precv_frame->u.hdr.rx_end=%p precv_frame->hdr.len=%d \n", precv_frame->u.hdr.rx_tail, precv_frame->u.hdr.rx_end, precv_frame->u.hdr.len));
skb->data = precv_frame->u.hdr.rx_data;
#ifdef NET_SKBUFF_DATA_USES_OFFSET
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
#else
skb->tail = precv_frame->u.hdr.rx_tail;
#endif
skb->len = precv_frame->u.hdr.len;
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("\n skb->head=%p skb->data=%p skb->tail=%p skb->end=%p skb->len=%d\n", skb->head, skb->data, skb->tail, skb->end, skb->len));
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
{
_pkt *pskb2=NULL;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
int bmcast = IS_MCAST(pattrib->dst);
//DBG_871X("bmcast=%d\n", bmcast);
if(_rtw_memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)==_FALSE)
{
psta = rtw_get_stainfo(pstapriv, pattrib->dst);
//DBG_871X("not ap psta=%p, addr=%pM\n", psta, pattrib->dst);
if(bmcast)
{
pskb2 = skb_clone(skb, GFP_ATOMIC);
}
if(psta)
{
//DBG_871X("directly forwarding to the xmit_entry\n");
//skb->ip_summed = CHECKSUM_NONE;
//skb->protocol = eth_type_trans(skb, pnetdev);
skb->dev = padapter->pnetdev;
rtw_xmit_entry(skb, padapter->pnetdev);
if(bmcast == _FALSE)
goto _recv_indicatepkt_end;
}
if(bmcast)
skb = pskb2;
}
else// to APself
{
//DBG_871X("to APSelf\n");
}
}
#ifdef CONFIG_RTL8712_TCP_CSUM_OFFLOAD_RX
if ( (pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1) ) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
//printk("CHECKSUM_UNNECESSARY \n");
//.........这里部分代码省略.........
开发者ID:FFTEAM,项目名称:open-duckbox-project-sh4-pingulux-git,代码行数:101,代码来源:recv_linux.c
示例18: eth_start_xmit
static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
struct net_device *net)
{
struct eth_dev *dev = netdev_priv(net);
int length = skb->len;
int retval=0;
struct usb_request *req = NULL;
unsigned long flags;
struct usb_ep *in;
u16 cdc_filter;
struct rndis_msg *msg = get_rndis_msg();
struct pkt_msg *r_q=NULL,*w_q = NULL;
int index;
struct sk_buff *skb_old;
spin_lock_irqsave(&dev->lock, flags);
if (dev->port_usb) {
in = dev->port_usb->in_ep;
cdc_filter = dev->port_usb->cdc_filter;
} else {
in = NULL;
cdc_filter = 0;
}
spin_unlock_irqrestore(&dev->lock, flags);
if (!in) {
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
/* apply outgoing CDC or RNDIS filters */
if (!is_promisc(cdc_filter)) {
u8 *dest = skb->data;
if (is_multicast_ether_addr(dest)) {
u16 type;
/* ignores USB_CDC_PACKET_TYPE_MULTICAST and host
* SET_ETHERNET_MULTICAST_FILTERS requests
*/
if (is_broadcast_ether_addr(dest))
type = USB_CDC_PACKET_TYPE_BROADCAST;
else
type = USB_CDC_PACKET_TYPE_ALL_MULTICAST;
if (!(cdc_filter & type)) {
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
}
/* ignores USB_CDC_PACKET_TYPE_DIRECTED */
}
skb_old=skb;
eth_alloc_req(net,&req,&w_q,skb);
if(req == NULL)
return NETDEV_TX_BUSY;
/* no buffer copies needed, unless the network stack did it
* or the hardware can't use skb buffers.
* or there's not enough space for extra headers we need
*/
if (dev->wrap) {
unsigned long flags;
spin_lock_irqsave(&dev->lock, flags);
if (dev->port_usb)
skb = dev->wrap(dev->port_usb, skb);
spin_unlock_irqrestore(&dev->lock, flags);
if (!skb)
goto drop;
length = skb->len;
}
/*
* Align data to 32bit if the dma controller requires it
*/
if (gadget_dma32(dev->gadget)) {
unsigned long align = (unsigned long)skb->data & 3;
if (WARN_ON(skb_headroom(skb) < align)) {
dev_kfree_skb_any(skb);
goto drop;
} else if (align) {
u8 *data = skb->data;
size_t len = skb_headlen(skb);
skb->data -= align;
memmove(skb->data, data, len);
skb_set_tail_pointer(skb, len);
}
}
retval = 0;
if(w_q==NULL)
retval = save_to_queue(dev,msg,skb,req,&w_q);
else if(skb!=skb_old)
update_sbks_in_queue(w_q,skb,skb_old);
if(retval == 0){
spin_lock_irqsave(&msg->buffer_lock, flags);
if(w_q && w_q->bit_map==FULL_BIT_MAP && (w_q->state != RNDIS_QUEUE_SEND)){
msg->last_sent = w_q->q_idx;
w_q->state = RNDIS_QUEUE_SEND;
//.........这里部分代码省略.........
开发者ID:dhs-shine,项目名称:sprd_project,代码行数:101,代码来源:u_ether.c
示例19: cdc_ncm_rx_fixup
static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
{
struct sk_buff *skb;
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
int len;
int nframes;
int x;
int offset;
struct usb_cdc_ncm_ndp16 *ndp16;
struct usb_cdc_ncm_dpe16 *dpe16;
int ndpoffset;
int loopcount = 50; /* arbitrary max preventing infinite loop */
ndpoffset = cdc_ncm_rx_verify_nth16(ctx, skb_in);
if (ndpoffset < 0)
goto error;
next_ndp:
nframes = cdc_ncm_rx_verify_ndp16(skb_in, ndpoffset);
if (nframes < 0)
goto error;
ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb_in->data + ndpoffset);
if (le32_to_cpu(ndp16->dwSignature) != USB_CDC_NCM_NDP16_NOCRC_SIGN) {
pr_debug("invalid DPT16 signature <%u>\n",
le32_to_cpu(ndp16->dwSignature));
goto err_ndp;
}
dpe16 = ndp16->dpe16;
for (x = 0; x < nframes; x++, dpe16++) {
offset = le16_to_cpu(dpe16->wDatagramIndex);
len = le16_to_cpu(dpe16->wDatagramLength);
/*
* CDC NCM ch. 3.7
* All entries after first NULL entry are to be ignored
*/
if ((offset == 0) || (len == 0)) {
if (!x)
goto err_ndp; /* empty NTB */
break;
}
/* sanity checking */
if (((offset + len) > skb_in->len) ||
(len > ctx->rx_max) || (len < ETH_HLEN)) {
pr_debug("invalid frame detected (ignored)"
"offset[%u]=%u, length=%u, skb=%p\n",
x, offset, len, skb_in);
if (!x)
goto err_ndp;
break;
} else {
skb = skb_clone(skb_in, GFP_ATOMIC);
if (!skb)
goto error;
skb->len = len;
skb->data = ((u8 *)skb_in->data) + offset;
skb_set_tail_pointer(skb, len);
usbnet_skb_return(dev, skb);
}
}
err_ndp:
/* are there more NDPs to process? */
ndpoffset = le16_to_cpu(ndp16->wNextNdpIndex);
if (ndpoffset && loopcount--)
goto next_ndp;
return 1;
error:
return 0;
}
开发者ID:smx-smx,项目名称:dsl-n55u,代码行数:75,代码来源:cdc_ncm.c
示例20: rtw_recv_indicatepkt
int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
_queue *pfree_recv_queue;
_pkt *skb;
struct mlme_priv*pmlmepriv = &padapter->mlmepriv;
#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
#endif
#ifdef CONFIG_BR_EXT
void *br_port = NULL;
#endif
_func_enter_;
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
#ifdef CONFIG_DRVEXT_MODULE
if (drvext_rx_handler(padapter, precv_frame->u.hdr.rx_data, precv_frame->u.hdr.len) == _SUCCESS)
{
goto _recv_indicatepkt_drop;
}
#endif
skb = precv_frame->u.hdr.pkt;
if(skb == NULL)
{
RT_TRACE(_module_recv_osdep_c_,_drv_err_,("rtw_recv_indicatepkt():skb==NULL something wrong!!!!\n"));
goto _recv_indicatepkt_drop;
}
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():skb != NULL !!!\n"));
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():precv_frame->u.hdr.rx_head=%p precv_frame->hdr.rx_data=%p\n", precv_frame->u.hdr.rx_head, precv_frame->u.hdr.rx_data));
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("precv_frame->hdr.rx_tail=%p precv_frame->u.hdr.rx_end=%p precv_frame->hdr.len=%d \n", precv_frame->u.hdr.rx_tail, precv_frame->u.hdr.rx_end, precv_frame->u.hdr.len));
skb->data = precv_frame->u.hdr.rx_data;
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
skb->len = precv_frame->u.hdr.len;
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("\n skb->head=%p skb->data=%p skb->tail=%p skb->end=%p skb->len=%d\n", skb->head, skb->data, skb->tail, skb->end, skb->len));
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
{
_pkt *pskb2=NULL;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
int bmcast = IS_MCAST(pattrib->dst);
//DBG_871X("bmcast=%d\n", bmcast);
if(_rtw_memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)==_FALSE)
{
//DBG_871X("not ap psta=%p, addr=%pM\n", psta, pattrib->dst);
if(bmcast)
{
psta = rtw_get_bcmc_stainfo(padapter);
pskb2 = rtw_skb_clone(skb);
} else {
psta = rtw_get_stainfo(pstapriv, pattrib->dst);
}
if(psta)
{
struct net_device *pnetdev= (struct net_device*)padapter->pnetdev;
//DBG_871X("directly forwarding to the rtw_xmit_entry\n");
//skb->ip_summed = CHECKSUM_NONE;
skb->dev = pnetdev;
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
skb_set_queue_mapping(skb, rtw_recv_select_queue(skb));
#endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)
_rtw_xmit_entry(skb, pnetdev);
if(bmcast)
skb = pskb2;
else
goto _recv_indicatepkt_end;
}
}
else// to APself
{
//DBG_871X("to APSelf\n");
}
}
#ifdef CONFIG_BR_EXT
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
br_port = padapter->pnetdev->br_port;
//.........这里部分代码省略.........
开发者ID:Anphamthanh,项目名称:rt8192cu,代码行数:101,代码来源:recv_linux.c
注:本文中的skb_set_tail_pointer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论