[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C9FCB8.7070201@cogentembedded.com>
Date: Wed, 26 Jun 2013 00:25:28 +0400
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Vlad Yasevich <vyasevic@...hat.com>
CC: netdev@...r.kernel.org, mst@...hat.com, eric.dumazet@...il.com,
davem@...emloft.net
Subject: Re: [PATCHv2 net-next 4/4] macvtap: Perform GSO on forwarding path.
Hello.
On 06/26/2013 12:04 AM, Vlad Yasevich wrote:
> When macvtap forwards skb to its tap, it needs to check
> if GSO needs to be performed. This is sometimes necessary
> when the HW device performed GRO, but the guest reading
> from the tap does not support it (ex: Windows 7).
> Signed-off-by: Vlad Yasevich <vyasevic@...hat.com>
> ---
> drivers/net/macvtap.c | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 7eab019..e370b79 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -276,14 +276,43 @@ static void macvtap_del_queues(struct net_device *dev)
> */
> static int macvtap_forward(struct net_device *dev, struct sk_buff *skb)
> {
> + struct macvlan_dev *vlan = netdev_priv(dev);
> struct macvtap_queue *q = macvtap_get_queue(dev, skb);
> + netdev_features_t features;
> if (!q)
> goto drop;
>
> if (skb_queue_len(&q->sk.sk_receive_queue) >= dev->tx_queue_len)
> goto drop;
>
> - skb_queue_tail(&q->sk.sk_receive_queue, skb);
> + skb->dev = dev;
> + /* Apply the forward feature mask so that we perform segmentation
> + * according to users wishes.
> + */
> + features = netif_skb_features(skb) & vlan->tap_features;
> + if (netif_needs_gso(skb, features)) {
> + struct sk_buff *segs = __skb_gso_segment(skb, features, false);
> +
> + if (IS_ERR(segs))
> + goto drop;
> +
> + if (!segs) {
> + skb_queue_tail(&q->sk.sk_receive_queue, skb);
> + goto wake_up;
> + }
> +
> + kfree_skb(skb);
> + while (segs) {
> + struct sk_buff *nskb = segs->next;
> +
> + segs->next = NULL;
> + skb_queue_tail(&q->sk.sk_receive_queue, segs);
> + segs = nskb;
> + }
> + } else
> + skb_queue_tail(&q->sk.sk_receive_queue, skb);
According to Documentation/CodingStyle chapter 3, you should have {}
on both branches of *if* statement, if one branch has it.
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists