netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qin Chuanyu <qinchuanyu@huawei.com>
To: <davem@davemloft.net>, "Michael S. Tsirkin" <mst@redhat.com>
Cc: KVM list <kvm@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: [PATCH] openvswitch: orphan frags on local receive
Date: Mon, 24 Feb 2014 21:15:12 +0800	[thread overview]
Message-ID: <530B45E0.20009@huawei.com> (raw)

with vhost tx zero_copy, guest nic might get hang when host reserving
skb in socket queue delivered by guest, the case has been solved in
tun, it also been needed by openvswitch. This could easily happened
when a LAST_ACK state tcp occuring between guest and host.

Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>
---
  net/openvswitch/vport-internal_dev.c |    3 +++
  net/openvswitch/vport.c              |    1 +
  2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/openvswitch/vport-internal_dev.c 
b/net/openvswitch/vport-internal_dev.c
index 729c687..adb25e2 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -212,6 +212,9 @@ static int internal_dev_recv(struct vport *vport, 
struct sk_buff *skb)
  	struct net_device *netdev = netdev_vport_priv(vport)->dev;
  	int len;

+	if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
+		return -NET_RX_DROP;
+
  	len = skb->len;

  	skb_dst_drop(skb);
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 208dd9a..04172d6 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -383,6 +383,7 @@ int ovs_vport_send(struct vport *vport, struct 
sk_buff *skb)
  		u64_stats_update_end(&stats->syncp);
  	} else if (sent < 0) {
  		ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
+		skb_tx_error(skb);
  		kfree_skb(skb);
  	} else
  		ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
-- 
1.7.3.1.msysgit.0


             reply	other threads:[~2014-02-24 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 13:15 Qin Chuanyu [this message]
2014-02-24 13:30 ` [PATCH] openvswitch: orphan frags on local receive Michael S. Tsirkin
2014-02-24 14:45 ` Zoltan Kiss
2014-02-25  2:07   ` Qin Chuanyu

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=530B45E0.20009@huawei.com \
    --to=qinchuanyu@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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).