[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <59837EB2.9010009@gmail.com>
Date: Thu, 03 Aug 2017 12:51:14 -0700
From: John Fastabend <john.fastabend@...il.com>
To: Tom Herbert <tom@...ntonium.net>, netdev@...r.kernel.org
CC: rohit@...ntonium.net
Subject: Re: [PATCH net-next 2/3] skbuff: Function to send an skbuf on a socket
On 07/28/2017 04:22 PM, Tom Herbert wrote:
> Add skb_send_sock to send an skbuff on a socket within the kernel.
> Arguments include an offset so that an skbuf might be sent in mulitple
> calls (e.g. send buffer limit is hit).
>
> Signed-off-by: Tom Herbert <tom@...ntonium.net>
> ---
[...]
> +/* Send skb data on a socket. Socket must be locked. */
> +int skb_send_sock_locked(struct sock *sk, struct sk_buff *skb, int offset,
> + int len)
> +{
> + unsigned int orig_len = len;
> + struct sk_buff *head = skb;
> + unsigned short fragidx;
> + int slen, ret;
> +
> +do_frag_list:
> +
> + /* Deal with head data */
> + while (offset < skb_headlen(skb) && len) {
> + struct kvec kv;
> + struct msghdr msg;
> +
> + slen = min_t(int, len, skb_headlen(skb) - offset);
> + kv.iov_base = skb->data + offset;
> + kv.iov_len = len;
^^^^^^
This should be slen right?
> + memset(&msg, 0, sizeof(msg));
> +
> + ret = kernel_sendmsg_locked(sk, &msg, &kv, 1, slen);
> + if (ret <= 0)
> + goto error;
> +
> + offset += ret;
> + len -= ret;
> + }
> +
Thanks,
John
Powered by blists - more mailing lists