search for: sg_init_one

Displaying 20 results from an estimated 930 matches for "sg_init_one".

2018 Apr 19
1
[PATCH v2 net 1/3] virtio_net: split out ctrl buffer
...hould know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); - vi->ctrl_status = ~0; - vi->ctrl_hdr.class = class; - vi->ctrl_hdr.cmd = cmd; + vi->ctrl->status = ~0; + vi->ctrl->hdr.class = class; + vi->ctrl->hdr.cmd = cmd; /* Add header */ - sg_init_one(&hdr, &vi->ctrl_hdr, sizeof(vi->ctrl_hdr)); + sg_init_one(&hdr, &vi->ctrl->hdr, sizeof(vi->ctrl->hdr)); sgs[out_num++] = &hdr; if (out) sgs[out_num++] = out; /* Add return status. */ - sg_init_one(&stat, &vi->ctrl_status, sizeof(vi->c...
2018 Apr 19
3
[PATCH net] virtio_net: split out ctrl buffer
...hould know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); - vi->ctrl_status = ~0; - vi->ctrl_hdr.class = class; - vi->ctrl_hdr.cmd = cmd; + vi->ctrl->status = ~0; + vi->ctrl->hdr.class = class; + vi->ctrl->hdr.cmd = cmd; /* Add header */ - sg_init_one(&hdr, &vi->ctrl_hdr, sizeof(vi->ctrl_hdr)); + sg_init_one(&hdr, &vi->ctrl->hdr, sizeof(vi->ctrl->hdr)); sgs[out_num++] = &hdr; if (out) sgs[out_num++] = out; /* Add return status. */ - sg_init_one(&stat, &vi->ctrl_status, sizeof(vi->c...
2015 Oct 28
2
[PATCH v2 1/3] virtio_net: Stop doing DMA from the stack
...ld know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); - ctrl.class = class; - ctrl.cmd = cmd; + buf = kmalloc(sizeof(*buf), GFP_ATOMIC); + if (!buf) + return false; + buf->status = ~0; + + buf->ctrl.class = class; + buf->ctrl.cmd = cmd; /* Add header */ - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); + sg_init_one(&hdr, &buf->ctrl, sizeof(buf->ctrl)); sgs[out_num++] = &hdr; if (out) sgs[out_num++] = out; /* Add return status. */ - sg_init_one(&stat, &status, sizeof(status)); + sg_init_one(&stat, &buf->status,...
2015 Oct 28
2
[PATCH v2 1/3] virtio_net: Stop doing DMA from the stack
...ld know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); - ctrl.class = class; - ctrl.cmd = cmd; + buf = kmalloc(sizeof(*buf), GFP_ATOMIC); + if (!buf) + return false; + buf->status = ~0; + + buf->ctrl.class = class; + buf->ctrl.cmd = cmd; /* Add header */ - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); + sg_init_one(&hdr, &buf->ctrl, sizeof(buf->ctrl)); sgs[out_num++] = &hdr; if (out) sgs[out_num++] = out; /* Add return status. */ - sg_init_one(&stat, &status, sizeof(status)); + sg_init_one(&stat, &buf->status,...
2015 Oct 28
0
[PATCH v2 1/3] virtio_net: Stop doing DMA from the stack
...= kmalloc(sizeof(*buf), GFP_ATOMIC); > + if (!buf) > + return false; This is problematic. The command is never retried, the error is propagated to userspace. > + buf->status = ~0; > + > + buf->ctrl.class = class; > + buf->ctrl.cmd = cmd; > /* Add header */ > - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); > + sg_init_one(&hdr, &buf->ctrl, sizeof(buf->ctrl)); > sgs[out_num++] = &hdr; > > if (out) > sgs[out_num++] = out; > > /* Add return status. */ > - sg_init_one(&stat, &status, sizeof(status)); > +...
2017 Jan 04
4
4.10 and -stable fix for virtio_blk and virtually mapped stacks
Without this fix attempts to do scsi passthrough on virtio_blk will crash the system on virtually mapped stacks, which is something happening during boot with many distros.
2017 Jan 04
4
4.10 and -stable fix for virtio_blk and virtually mapped stacks
Without this fix attempts to do scsi passthrough on virtio_blk will crash the system on virtually mapped stacks, which is something happening during boot with many distros.
2013 Dec 10
11
[PATCH net-next 1/3] virtio_net: set multicast filter list to host
...io_net: Add a MAC filter table Signed-off-by: Stephen Hemminger <stephen at networkplumber.org> --- a/drivers/net/virtio_net.c 2013-12-09 16:12:03.897891975 -0800 +++ b/drivers/net/virtio_net.c 2013-12-09 16:12:36.353164803 -0800 @@ -893,7 +893,7 @@ static bool virtnet_send_command(struct sg_init_one(&hdr, &ctrl, sizeof(ctrl)); sgs[out_num++] = &hdr; - if (out) + for (; out; out = sg_next(out)) sgs[out_num++] = out; if (in) sgs[out_num + in_num++] = in;
2013 Dec 10
11
[PATCH net-next 1/3] virtio_net: set multicast filter list to host
...io_net: Add a MAC filter table Signed-off-by: Stephen Hemminger <stephen at networkplumber.org> --- a/drivers/net/virtio_net.c 2013-12-09 16:12:03.897891975 -0800 +++ b/drivers/net/virtio_net.c 2013-12-09 16:12:36.353164803 -0800 @@ -893,7 +893,7 @@ static bool virtnet_send_command(struct sg_init_one(&hdr, &ctrl, sizeof(ctrl)); sgs[out_num++] = &hdr; - if (out) + for (; out; out = sg_next(out)) sgs[out_num++] = out; if (in) sgs[out_num + in_num++] = in;
2018 Nov 05
2
[PATCH 1/5] VSOCK: support fill mergeable rx buffer in guest
...57,25 @@ static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock, return 0; } +static int fill_mergeable_rx_buff(struct virtqueue *vq) +{ + void *page = NULL; + struct scatterlist sg; + int err; + + page = (void *)get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + sg_init_one(&sg, page, PAGE_SIZE); + + err = virtqueue_add_inbuf(vq, &sg, 1, page, GFP_KERNEL); + if (err < 0) + free_page((unsigned long) page); + + return err; +} + static void virtio_vsock_rx_fill(struct virtio_vsock *vsock) { int buf_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE; @@ -267,27 +287,3...
2018 Nov 05
2
[PATCH 1/5] VSOCK: support fill mergeable rx buffer in guest
...57,25 @@ static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock, return 0; } +static int fill_mergeable_rx_buff(struct virtqueue *vq) +{ + void *page = NULL; + struct scatterlist sg; + int err; + + page = (void *)get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + sg_init_one(&sg, page, PAGE_SIZE); + + err = virtqueue_add_inbuf(vq, &sg, 1, page, GFP_KERNEL); + if (err < 0) + free_page((unsigned long) page); + + return err; +} + static void virtio_vsock_rx_fill(struct virtio_vsock *vsock) { int buf_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE; @@ -267,27 +287,3...
2015 Oct 30
1
[PATCH v4 1/6] virtio-net: Stop doing DMA from the stack
...ack status = ~0; unsigned out_num = 0, tmp; /* Caller should know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); - ctrl.class = class; - ctrl.cmd = cmd; + vi->ctrl_status = ~0; + vi->ctrl_hdr.class = class; + vi->ctrl_hdr.cmd = cmd; /* Add header */ - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); + sg_init_one(&hdr, &vi->ctrl_hdr, sizeof(vi->ctrl_hdr)); sgs[out_num++] = &hdr; if (out) sgs[out_num++] = out; /* Add return status. */ - sg_init_one(&stat, &status, sizeof(status)); + sg_init_one(&stat, &vi->ctr...
2013 Dec 10
0
[PATCH net-next 2/3] virtio_net: remove unused parameter to send_command
.../* Caller should know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); @@ -895,16 +894,13 @@ static bool virtnet_send_command(struct for (; out; out = sg_next(out)) sgs[out_num++] = out; - if (in) - sgs[out_num + in_num++] = in; /* Add return status. */ sg_init_one(&stat, &status, sizeof(status)); - sgs[out_num + in_num++] = &stat; + sgs[out_num] = &stat; - BUG_ON(out_num + in_num > ARRAY_SIZE(sgs)); - BUG_ON(virtqueue_add_sgs(vi->cvq, sgs, out_num, in_num, vi, GFP_ATOMIC) - < 0); + BUG_ON(out_num + 1 > ARRAY_SIZE(sgs)); +...
2015 Oct 30
0
[PATCH v4 1/6] virtio-net: Stop doing DMA from the stack
...gt; /* Caller should know better */ > BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); > > - ctrl.class = class; > - ctrl.cmd = cmd; > + vi->ctrl_status = ~0; > + vi->ctrl_hdr.class = class; > + vi->ctrl_hdr.cmd = cmd; > /* Add header */ > - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); > + sg_init_one(&hdr, &vi->ctrl_hdr, sizeof(vi->ctrl_hdr)); > sgs[out_num++] = &hdr; > > if (out) > sgs[out_num++] = out; > > /* Add return status. */ > - sg_init_one(&stat, &status, sizeof(status)); &g...
2015 Oct 28
0
[PATCH v3 1/3] virtio_net: Stop doing DMA from the stack
...ld know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); - ctrl.class = class; - ctrl.cmd = cmd; + buf = kmalloc(sizeof(*buf), GFP_ATOMIC); + if (!buf) + return false; + buf->status = ~0; + + buf->ctrl.class = class; + buf->ctrl.cmd = cmd; /* Add header */ - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); + sg_init_one(&hdr, &buf->ctrl, sizeof(buf->ctrl)); sgs[out_num++] = &hdr; if (out) sgs[out_num++] = out; /* Add return status. */ - sg_init_one(&stat, &status, sizeof(status)); + sg_init_one(&stat, &buf->status,...
2015 Oct 28
0
[PATCH v3 1/3] virtio_net: Stop doing DMA from the stack
...VIRTIO_NET_F_CTRL_VQ)); > > - ctrl.class = class; > - ctrl.cmd = cmd; > + buf = kmalloc(sizeof(*buf), GFP_ATOMIC); > + if (!buf) > + return false; > + buf->status = ~0; > + > + buf->ctrl.class = class; > + buf->ctrl.cmd = cmd; > /* Add header */ > - sg_init_one(&hdr, &ctrl, sizeof(ctrl)); > + sg_init_one(&hdr, &buf->ctrl, sizeof(buf->ctrl)); > sgs[out_num++] = &hdr; > > if (out) > sgs[out_num++] = out; > > /* Add return status. */ > - sg_init_one(&stat, &status, sizeof(status)); > +...
2023 Mar 05
1
[PATCH net] virtio-net: unify notifications coalescing structs
...struct scatterlist sgs_tx, sgs_rx; - struct virtio_net_ctrl_coal_tx coal_tx; - struct virtio_net_ctrl_coal_rx coal_rx; + struct virtio_net_ctrl_coal coal_params; - coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs); - coal_tx.tx_max_packets = cpu_to_le32(ec->tx_max_coalesced_frames); - sg_init_one(&sgs_tx, &coal_tx, sizeof(coal_tx)); + coal_params.max_usecs = cpu_to_le32(ec->tx_coalesce_usecs); + coal_params.max_packets = cpu_to_le32(ec->tx_max_coalesced_frames); + sg_init_one(&sgs_tx, &coal_params, sizeof(coal_params)); if (!virtnet_send_command(vi, VIRTIO_NET_CTRL...
2008 May 26
1
[PATCH] virtio_rng: dont use vmalloced addresses for virtio
...nd the hwrng framework takes it 4 bytes at a * time. */ static struct virtqueue *vq; -static u32 random_data[16]; +static u32 *random_data; static unsigned int data_left; static DECLARE_COMPLETION(have_data); @@ -47,9 +47,9 @@ static void register_buffer(void) { struct scatterlist sg; - sg_init_one(&sg, &random_data, sizeof(random_data)); + sg_init_one(&sg, random_data, 64); /* There should always be room for one buffer. */ - if (vq->vq_ops->add_buf(vq, &sg, 0, 1, &random_data) != 0) + if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0) BUG();...
2008 May 26
1
[PATCH] virtio_rng: dont use vmalloced addresses for virtio
...nd the hwrng framework takes it 4 bytes at a * time. */ static struct virtqueue *vq; -static u32 random_data[16]; +static u32 *random_data; static unsigned int data_left; static DECLARE_COMPLETION(have_data); @@ -47,9 +47,9 @@ static void register_buffer(void) { struct scatterlist sg; - sg_init_one(&sg, &random_data, sizeof(random_data)); + sg_init_one(&sg, random_data, 64); /* There should always be room for one buffer. */ - if (vq->vq_ops->add_buf(vq, &sg, 0, 1, &random_data) != 0) + if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0) BUG();...
2023 Feb 16
0
[RFC PATCH v1 05/12] vsock/virtio: non-linear skb support
...omment just to be clear ;-) > int ret, in_sg = 0, out_sg = 0; > struct sk_buff *skb; > bool reply; >@@ -111,12 +112,30 @@ virtio_transport_send_pkt_work(struct work_struct *work) > > virtio_transport_deliver_tap_pkt(skb); > reply = virtio_vsock_skb_reply(skb); >+ sg_init_one(&bufs[0], virtio_vsock_hdr(skb), sizeof(*virtio_vsock_hdr(skb))); >+ sgs[out_sg++] = &bufs[0]; >+ >+ if (skb_is_nonlinear(skb)) { >+ int i; >+ >+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { >+ struct page *data_page = skb_shinfo(skb)->frags[i].bv...