help on skb functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

        I have working on the tunnel networking driver. My requirement is to perform operation, which is opposite to the skb_put. following is the code i have written.

if (tunnel->skb == NULL) {
int len;
tunnel->skb = netdev_alloc_skb(dev, sizeof(struct myprotocol_hdr));

/*Place holder for the mhdp packet count*/
len = skb_headroom(tunnel->skb);

skb_push(tunnel->skb, len);

memset(tunnel->skb->data, 0, len);

tunnel->skb->tail -= len;
tunnel->skb->len  -= len;
}

hdr_data = (struct data_info *) skb_put(tunnel->skb, sizeof(struct data_info));

Every time before calling the dev_queue_xmit i check whether the hardware is busy? if it is, then i call skb_put and add a structure at the end of header.
you can observe that, for the first time skb is allocated, skb->tail and skb->len are being decremented manually in order to avoid memory copy(as the
structure is added at the end of previous header). Is there any better function which can used instead.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux