search for: skb_put

Displaying 20 results from an estimated 164 matches for "skb_put".

2009 Jan 19
1
Non-linear skbs apparently prevent NFQUEUE from working properly
...wire that are sent from one domU to another while they travel over the dom0 bridge. This has worked fine as long as I was tinkering with UDP packets only - but when I try to reinject TCP frames with an increased length, I run into a BUG() because net/netfilter/nfnetlink_queue.c:nfqnl_mangle() calls skb_put() which requires the skb to be aligned, which it apparently isn''t in a Xen environment. I''ve ported my network scenario to a Usermode Linux setup and it''s working perfectly fine there, so I presume this has something to do with Xen''s network driver implementatio...
2023 Feb 16
0
[RFC PATCH v1 06/12] vsock/virtio: non-linear skb handling for TAP dev
...*/ > pkt_hdr = virtio_vsock_hdr(pkt); > payload_len = pkt->len; >- payload_buf = pkt->data; > > skb = alloc_skb(sizeof(*hdr) + sizeof(*pkt_hdr) + payload_len, > GFP_ATOMIC); >@@ -160,7 +191,13 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) > skb_put_data(skb, pkt_hdr, sizeof(*pkt_hdr)); > > if (payload_len) { >- skb_put_data(skb, payload_buf, payload_len); >+ if (skb_is_nonlinear(skb)) { >+ void *data = skb_put(skb, payload_len); >+ >+ virtio_transport_copy_nonlinear_skb(skb, data, payload_len); >+ } else { >...
2008 Apr 18
4
[0/6] [NET]: virtio SG/TSO patches
Hi: Here are the patches I used for testing KVM with virtio-net using TSO. There are three patches for the tun device which are basically Rusty's patches with the mmap turned into copying (for correctness). Two patches are for the virtio-net frontend, one required to support receiving SG/TSO, and the other useful for testing SG per se. The other patch is to the KVM backend to make all this
2008 Apr 18
4
[0/6] [NET]: virtio SG/TSO patches
Hi: Here are the patches I used for testing KVM with virtio-net using TSO. There are three patches for the tun device which are basically Rusty's patches with the mmap turned into copying (for correctness). Two patches are for the virtio-net frontend, one required to support receiving SG/TSO, and the other useful for testing SG per se. The other patch is to the KVM backend to make all this
2018 Sep 06
1
[PATCH net-next 10/11] tap: accept an array of XDP buffs through sendmsg()
..._hdr_sz); > + > + skb = build_skb(xdp->data_hard_start, buflen); > + if (!skb) { > + err = -ENOMEM; > + goto err; > + } So fundamentally why is it called XDP? We just build and skb, don't we? > + > + skb_reserve(skb, xdp->data - xdp->data_hard_start); > + skb_put(skb, xdp->data_end - xdp->data); > + > + skb_set_network_header(skb, ETH_HLEN); > + skb_reset_mac_header(skb); > + skb->protocol = eth_hdr(skb)->h_proto; > + > + if (vnet_hdr_len) { > + err = virtio_net_hdr_to_skb(skb, gso, tap_is_little_endian(q)); > + if (err...
2023 Feb 16
0
[RFC PATCH v1 07/12] vsock/virtio: MGS_ZEROCOPY flag support
...o_transport_init_zcopy_skb(vsk, skb, iter, true); >+} >+ >+static int virtio_transport_copy_payload(struct sk_buff *skb, >+ struct vsock_sock *vsk, >+ struct virtio_vsock_pkt_info *info, >+ size_t len) >+{ >+ void *payload; >+ int err; >+ >+ payload = skb_put(skb, len); >+ err = memcpy_from_msg(payload, info->msg, len); >+ if (err) >+ return -1; >+ >+ if (msg_data_left(info->msg)) >+ return 0; >+ >+ if (info->type == VIRTIO_VSOCK_TYPE_SEQPACKET) { >+ struct virtio_vsock_hdr *hdr; >+ >+ hdr = virtio_vsock_hdr...
2008 Jan 23
1
[PATCH 1/3] Cleanup and simplify virtnet header
1) Turn GSO on virtio net into an all-or-nothing (keep checksumming separate). Having multiple bits is a pain: if you can't support something you should handle it in software, which is still a performance win. 2) Make VIRTIO_NET_HDR_GSO_ECN a flag in the header, so it can apply to IPv6 or v4. 3) Rename VIRTIO_NET_F_NO_CSUM to VIRTIO_NET_F_CSUM (ie. means we do checksumming). 4)
2008 Jan 23
1
[PATCH 1/3] Cleanup and simplify virtnet header
1) Turn GSO on virtio net into an all-or-nothing (keep checksumming separate). Having multiple bits is a pain: if you can't support something you should handle it in software, which is still a performance win. 2) Make VIRTIO_NET_HDR_GSO_ECN a flag in the header, so it can apply to IPv6 or v4. 3) Rename VIRTIO_NET_F_NO_CSUM to VIRTIO_NET_F_CSUM (ie. means we do checksumming). 4)
2018 Sep 06
2
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...if (!skb) > - return ERR_PTR(-ENOMEM); > + if (!skb) { > + skb = ERR_PTR(-ENOMEM); > + goto out; So goto out will skip put_page, and we did do get_page above. Seems wrong. You should goto err_skb or something like this. > + } > > skb_reserve(skb, pad - delta); > skb_put(skb, len); > - get_page(alloc_frag->page); > - alloc_frag->offset += buflen; > > return skb; > > -err_redirect: > - put_page(alloc_frag->page); > err_xdp: > + alloc_frag->offset -= buflen; > + put_page(alloc_frag->page); > +out: Out here isn...
2018 Sep 06
2
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...if (!skb) > - return ERR_PTR(-ENOMEM); > + if (!skb) { > + skb = ERR_PTR(-ENOMEM); > + goto out; So goto out will skip put_page, and we did do get_page above. Seems wrong. You should goto err_skb or something like this. > + } > > skb_reserve(skb, pad - delta); > skb_put(skb, len); > - get_page(alloc_frag->page); > - alloc_frag->offset += buflen; > > return skb; > > -err_redirect: > - put_page(alloc_frag->page); > err_xdp: > + alloc_frag->offset -= buflen; > + put_page(alloc_frag->page); > +out: Out here isn...
2016 Feb 21
1
[PATCH] virtio_net: switch to build_skb for mrg_rxbuf
...NET_SKB_OFF VNET_SKB_LEN(VNET_SKB_PAD) + +static struct sk_buff *vnet_build_skb(struct virtnet_info *vi, + void *buf, + unsigned int len, unsigned int truesize) +{ + struct sk_buff *skb = build_skb(buf, truesize); + + if (!skb) + return NULL; + + skb_reserve(skb, VNET_SKB_PAD); + skb_put(skb, VNET_SKB_LEN(len)); + + return skb; +} + static struct sk_buff *receive_mergeable(struct net_device *dev, struct virtnet_info *vi, struct receive_queue *rq, @@ -354,14 +374,13 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, unsigned int len) { void...
2016 Feb 21
1
[PATCH] virtio_net: switch to build_skb for mrg_rxbuf
...NET_SKB_OFF VNET_SKB_LEN(VNET_SKB_PAD) + +static struct sk_buff *vnet_build_skb(struct virtnet_info *vi, + void *buf, + unsigned int len, unsigned int truesize) +{ + struct sk_buff *skb = build_skb(buf, truesize); + + if (!skb) + return NULL; + + skb_reserve(skb, VNET_SKB_PAD); + skb_put(skb, VNET_SKB_LEN(len)); + + return skb; +} + static struct sk_buff *receive_mergeable(struct net_device *dev, struct virtnet_info *vi, struct receive_queue *rq, @@ -354,14 +374,13 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, unsigned int len) { void...
2018 Sep 06
2
[PATCH net-next 06/11] tuntap: split out XDP logic
...uct sk_buff *tun_build_skb(struct tun_struct *tun, > build: > skb = build_skb(buf, buflen); > if (!skb) { > + put_page(alloc_frag->page); > skb = ERR_PTR(-ENOMEM); > goto out; > } > > - skb_reserve(skb, pad - delta); > + skb_reserve(skb, pad); > skb_put(skb, len); > > return skb; > > err_xdp: > - alloc_frag->offset -= buflen; > - put_page(alloc_frag->page); > + this_cpu_inc(tun->pcpu_stats->rx_dropped); This fixes bug in previous patch which dropped it. OK :) > out: > rcu_read_unlock(); > lo...
2018 Sep 06
2
[PATCH net-next 06/11] tuntap: split out XDP logic
...uct sk_buff *tun_build_skb(struct tun_struct *tun, > build: > skb = build_skb(buf, buflen); > if (!skb) { > + put_page(alloc_frag->page); > skb = ERR_PTR(-ENOMEM); > goto out; > } > > - skb_reserve(skb, pad - delta); > + skb_reserve(skb, pad); > skb_put(skb, len); > > return skb; > > err_xdp: > - alloc_frag->offset -= buflen; > - put_page(alloc_frag->page); > + this_cpu_inc(tun->pcpu_stats->rx_dropped); This fixes bug in previous patch which dropped it. OK :) > out: > rcu_read_unlock(); > lo...
2018 Sep 12
14
[PATCH net-next V2 00/11] vhost_net TX batching
Hi all: This series tries to batch submitting packets to underlayer socket through msg_control during sendmsg(). This is done by: 1) Doing userspace copy inside vhost_net 2) Build XDP buff 3) Batch at most 64 (VHOST_NET_BATCH) XDP buffs and submit them once through msg_control during sendmsg(). 4) Underlayer sockets can use XDP buffs directly when XDP is enalbed, or build skb based on XDP
2018 Sep 12
14
[PATCH net-next V2 00/11] vhost_net TX batching
Hi all: This series tries to batch submitting packets to underlayer socket through msg_control during sendmsg(). This is done by: 1) Doing userspace copy inside vhost_net 2) Build XDP buff 3) Batch at most 64 (VHOST_NET_BATCH) XDP buffs and submit them once through msg_control during sendmsg(). 4) Underlayer sockets can use XDP buffs directly when XDP is enalbed, or build skb based on XDP
2018 Sep 06
22
[PATCH net-next 00/11] Vhost_net TX batching
Hi all: This series tries to batch submitting packets to underlayer socket through msg_control during sendmsg(). This is done by: 1) Doing userspace copy inside vhost_net 2) Build XDP buff 3) Batch at most 64 (VHOST_NET_BATCH) XDP buffs and submit them once through msg_control during sendmsg(). 4) Underlayer sockets can use XDP buffs directly when XDP is enalbed, or build skb based on XDP
2013 Nov 14
2
[PATCH] virtio-net: mergeable buffer size should include virtio-net header
...,11 @@ static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp) struct skb_vnet_hdr *hdr; int err; - skb = __netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN, gfp); + skb = __netdev_alloc_skb_ip_align(vi->dev, GOOD_PACKET_LEN, gfp); if (unlikely(!skb)) return -ENOMEM; - skb_put(skb, MAX_PACKET_LEN); + skb_put(skb, GOOD_PACKET_LEN); hdr = skb_vnet_hdr(skb); sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr); @@ -542,20 +544,20 @@ static int add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp) int err; if (gfp & __GFP_WAIT) { - if (skb_page_f...
2013 Nov 14
2
[PATCH] virtio-net: mergeable buffer size should include virtio-net header
...,11 @@ static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp) struct skb_vnet_hdr *hdr; int err; - skb = __netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN, gfp); + skb = __netdev_alloc_skb_ip_align(vi->dev, GOOD_PACKET_LEN, gfp); if (unlikely(!skb)) return -ENOMEM; - skb_put(skb, MAX_PACKET_LEN); + skb_put(skb, GOOD_PACKET_LEN); hdr = skb_vnet_hdr(skb); sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr); @@ -542,20 +544,20 @@ static int add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp) int err; if (gfp & __GFP_WAIT) { - if (skb_page_f...
2013 Nov 12
12
[PATCH net-next 1/4] virtio-net: mergeable buffer size should include virtio-net header
...,11 @@ static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp) struct skb_vnet_hdr *hdr; int err; - skb = __netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN, gfp); + skb = __netdev_alloc_skb_ip_align(vi->dev, GOOD_PACKET_LEN, gfp); if (unlikely(!skb)) return -ENOMEM; - skb_put(skb, MAX_PACKET_LEN); + skb_put(skb, GOOD_PACKET_LEN); hdr = skb_vnet_hdr(skb); sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr); @@ -542,20 +544,20 @@ static int add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp) int err; if (gfp & __GFP_WAIT) { - if (skb_page_f...