From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vlad Yasevich <vyasevic@redhat.com>
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
kvm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Eric Dumazet <edumazet@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next 2/8] skb: api to report errors for zero copy skbs
Date: Tue, 30 Oct 2012 17:54:36 +0200 [thread overview]
Message-ID: <20121030155436.GB7256@redhat.com> (raw)
In-Reply-To: <508FF5D0.6080107@redhat.com>
On Tue, Oct 30, 2012 at 11:44:16AM -0400, Vlad Yasevich wrote:
> On 10/29/2012 11:49 AM, Michael S. Tsirkin wrote:
> >Orphaning frags for zero copy skbs needs to allocate data in atomic
> >context so is has a chance to fail. If it does we currently discard
> >the skb which is safe, but we don't report anything to the caller,
> >so it can not recover by e.g. disabling zero copy.
> >
> >Add an API to free skb reporting such errors: this is used
> >by tun in case orphaning frags fails.
> >
> >Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >---
> > include/linux/skbuff.h | 1 +
> > net/core/skbuff.c | 19 +++++++++++++++++++
> > 2 files changed, 20 insertions(+)
> >
> >diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> >index 8bac11b..0644432 100644
> >--- a/include/linux/skbuff.h
> >+++ b/include/linux/skbuff.h
> >@@ -568,6 +568,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
> > }
> >
> > extern void kfree_skb(struct sk_buff *skb);
> >+extern void skb_tx_error(struct sk_buff *skb, int err);
> > extern void consume_skb(struct sk_buff *skb);
> > extern void __kfree_skb(struct sk_buff *skb);
> > extern struct kmem_cache *skbuff_head_cache;
> >diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> >index eb31f6e..ad99c64 100644
> >--- a/net/core/skbuff.c
> >+++ b/net/core/skbuff.c
> >@@ -635,6 +635,25 @@ void kfree_skb(struct sk_buff *skb)
> > EXPORT_SYMBOL(kfree_skb);
> >
> > /**
> >+ * kfree_skb_on_error - report an sk_buff xmit error
> >+ * @skb: buffer that triggered an error
> >+ *
> >+ * Report xmit error if a device callback is tracking this skb.
> >+ */
>
> Nit: Comment doesn't match new function.
>
> -vlad
Good catch, thanks.
> >+void skb_tx_error(struct sk_buff *skb, int err)
> >+{
> >+ if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
> >+ struct ubuf_info *uarg;
> >+
> >+ uarg = skb_shinfo(skb)->destructor_arg;
> >+ if (uarg->callback)
> >+ uarg->callback(uarg, err);
> >+ skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY;
> >+ }
> >+}
> >+EXPORT_SYMBOL(skb_tx_error);
> >+
> >+/**
> > * consume_skb - free an skbuff
> > * @skb: buffer to free
> > *
> >
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vlad Yasevich <vyasevic@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Duyck <alexander.h.duyck@intel.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/8] skb: api to report errors for zero copy skbs
Date: Tue, 30 Oct 2012 17:54:36 +0200 [thread overview]
Message-ID: <20121030155436.GB7256@redhat.com> (raw)
In-Reply-To: <508FF5D0.6080107@redhat.com>
On Tue, Oct 30, 2012 at 11:44:16AM -0400, Vlad Yasevich wrote:
> On 10/29/2012 11:49 AM, Michael S. Tsirkin wrote:
> >Orphaning frags for zero copy skbs needs to allocate data in atomic
> >context so is has a chance to fail. If it does we currently discard
> >the skb which is safe, but we don't report anything to the caller,
> >so it can not recover by e.g. disabling zero copy.
> >
> >Add an API to free skb reporting such errors: this is used
> >by tun in case orphaning frags fails.
> >
> >Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >---
> > include/linux/skbuff.h | 1 +
> > net/core/skbuff.c | 19 +++++++++++++++++++
> > 2 files changed, 20 insertions(+)
> >
> >diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> >index 8bac11b..0644432 100644
> >--- a/include/linux/skbuff.h
> >+++ b/include/linux/skbuff.h
> >@@ -568,6 +568,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
> > }
> >
> > extern void kfree_skb(struct sk_buff *skb);
> >+extern void skb_tx_error(struct sk_buff *skb, int err);
> > extern void consume_skb(struct sk_buff *skb);
> > extern void __kfree_skb(struct sk_buff *skb);
> > extern struct kmem_cache *skbuff_head_cache;
> >diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> >index eb31f6e..ad99c64 100644
> >--- a/net/core/skbuff.c
> >+++ b/net/core/skbuff.c
> >@@ -635,6 +635,25 @@ void kfree_skb(struct sk_buff *skb)
> > EXPORT_SYMBOL(kfree_skb);
> >
> > /**
> >+ * kfree_skb_on_error - report an sk_buff xmit error
> >+ * @skb: buffer that triggered an error
> >+ *
> >+ * Report xmit error if a device callback is tracking this skb.
> >+ */
>
> Nit: Comment doesn't match new function.
>
> -vlad
Good catch, thanks.
> >+void skb_tx_error(struct sk_buff *skb, int err)
> >+{
> >+ if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
> >+ struct ubuf_info *uarg;
> >+
> >+ uarg = skb_shinfo(skb)->destructor_arg;
> >+ if (uarg->callback)
> >+ uarg->callback(uarg, err);
> >+ skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY;
> >+ }
> >+}
> >+EXPORT_SYMBOL(skb_tx_error);
> >+
> >+/**
> > * consume_skb - free an skbuff
> > * @skb: buffer to free
> > *
> >
next prev parent reply other threads:[~2012-10-30 15:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 15:49 [PATCH net-next 0/8] enable/disable zero copy tx dynamically Michael S. Tsirkin
2012-10-29 15:49 ` Michael S. Tsirkin
2012-10-29 15:49 ` [PATCH net-next 1/8] skb: report completion status for zero copy skbs Michael S. Tsirkin
2012-10-29 15:49 ` Michael S. Tsirkin
2012-10-29 15:49 ` [PATCH net-next 2/8] skb: api to report errors " Michael S. Tsirkin
2012-10-29 15:49 ` Michael S. Tsirkin
2012-10-30 15:44 ` Vlad Yasevich
2012-10-30 15:54 ` Michael S. Tsirkin [this message]
2012-10-30 15:54 ` Michael S. Tsirkin
2012-10-30 15:44 ` Vlad Yasevich
2012-10-29 15:49 ` [PATCH net-next 3/8] tun: report orphan frags errors to zero copy callback Michael S. Tsirkin
2012-10-29 15:49 ` Michael S. Tsirkin
2012-10-29 15:49 ` [PATCH net-next 8/8] vhost-net: reduce vq polling on tx zerocopy Michael S. Tsirkin
2012-10-29 15:49 ` Michael S. Tsirkin
2012-10-30 15:47 ` Vlad Yasevich
2012-10-30 15:54 ` Michael S. Tsirkin
2012-10-30 15:54 ` Michael S. Tsirkin
2012-10-30 15:47 ` Vlad Yasevich
2012-10-29 15:49 ` [PATCH net-next 4/8] vhost-net: cleanup macros for DMA status tracking Michael S. Tsirkin
2012-10-29 15:49 ` Michael S. Tsirkin
2012-10-29 15:50 ` [PATCH net-next 5/8] vhost: track zero copy failures using DMA length Michael S. Tsirkin
2012-10-29 15:50 ` Michael S. Tsirkin
2012-10-29 15:50 ` [PATCH net-next 6/8] vhost: move -net specific code out Michael S. Tsirkin
2012-10-29 15:50 ` Michael S. Tsirkin
2012-10-29 15:50 ` [PATCH net-next 7/8] vhost-net: select tx zero copy dynamically Michael S. Tsirkin
2012-10-29 15:50 ` Michael S. Tsirkin
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=20121030155436.GB7256@redhat.com \
--to=mst@redhat.com \
--cc=Ian.Campbell@citrix.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=vyasevic@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.