From: John Fastabend <john.fastabend@gmail.com>
To: Tom Herbert <tom@quantonium.net>, netdev@vger.kernel.org
Cc: rohit@quantonium.net
Subject: Re: [PATCH net-next 2/3] skbuff: Function to send an skbuf on a socket
Date: Thu, 03 Aug 2017 12:51:14 -0700 [thread overview]
Message-ID: <59837EB2.9010009@gmail.com> (raw)
In-Reply-To: <20170728232243.3040-3-tom@quantonium.net>
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@quantonium.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
next prev parent reply other threads:[~2017-08-03 19:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 23:22 [PATCH net-next 0/3] net: Infrastructure changes for [kz]proxy Tom Herbert
2017-07-28 23:22 ` [PATCH net-next 1/3] proto_ops: Add locked held versions of sendmsg and sendpage Tom Herbert
2017-08-03 19:49 ` John Fastabend
2017-08-03 20:21 ` John Fastabend
2017-08-03 21:07 ` Tom Herbert
2017-07-28 23:22 ` [PATCH net-next 2/3] skbuff: Function to send an skbuf on a socket Tom Herbert
2017-08-03 19:51 ` John Fastabend [this message]
2017-07-28 23:22 ` [PATCH net-next 3/3] strparser: Generalize strparser Tom Herbert
2017-10-19 17:42 ` Eric Dumazet
[not found] ` <CALx6S3765-5oT6UtSQVts4KwWz3F3ub2vhDWO7YemYZPPM0EjA@mail.gmail.com>
2017-10-19 20:18 ` John Fastabend
2017-08-01 22:26 ` [PATCH net-next 0/3] net: Infrastructure changes for [kz]proxy David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59837EB2.9010009@gmail.com \
--to=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rohit@quantonium.net \
--cc=tom@quantonium.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).