diff mbox series

[ovs-dev,V4,14/24] datapath: don't call pad_packet if not necessary

Message ID 20201012202511.21000-15-gvrose8192@gmail.com
State Accepted
Headers show
Series Add support for Linux kernels up to 5.8.x | expand

Commit Message

Gregory Rose Oct. 12, 2020, 8:25 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Upstream commit:
    commit 61ca533c0e94104c35fcb7858a23ec9a05d78143
    Author: Tonghao Zhang <xiangxia.m.yue@gmail.com>
    Date:   Thu Nov 14 23:51:08 2019 +0800

    net: openvswitch: don't call pad_packet if not necessary

    The nla_put_u16/nla_put_u32 makes sure that
    *attrlen is align. The call tree is that:

    nla_put_u16/nla_put_u32
      -> nla_put		attrlen = sizeof(u16) or sizeof(u32)
      -> __nla_put		attrlen
      -> __nla_reserve	attrlen
      -> skb_put(skb, nla_total_size(attrlen))

    nla_total_size returns the total length of attribute
    including padding.

    Cc: Joe Stringer <joe@ovn.org>
    Cc: William Tu <u9012063@gmail.com>
    Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
    Acked-by: Pravin B Shelar <pshelar@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/datapath.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

Comments

0-day Robot Oct. 12, 2020, 9:53 p.m. UTC | #1
Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Author Tonghao Zhang <xiangxia.m.yue@gmail.com> needs to sign off.
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Greg Rose <gvrose8192@gmail.com>
Lines checked: 76, Warnings: 1, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 22a08baa3..ddc0b4491 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -512,23 +512,17 @@  static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 	}
 
 	/* Add OVS_PACKET_ATTR_MRU */
-	if (upcall_info->mru) {
-		if (nla_put_u16(user_skb, OVS_PACKET_ATTR_MRU,
-				upcall_info->mru)) {
-			err = -ENOBUFS;
-			goto out;
-		}
-		pad_packet(dp, user_skb);
+	if (upcall_info->mru &&
+	    nla_put_u16(user_skb, OVS_PACKET_ATTR_MRU, upcall_info->mru)) {
+		err = -ENOBUFS;
+		goto out;
 	}
 
 	/* Add OVS_PACKET_ATTR_LEN when packet is truncated */
-	if (cutlen > 0) {
-		if (nla_put_u32(user_skb, OVS_PACKET_ATTR_LEN,
-				skb->len)) {
-			err = -ENOBUFS;
-			goto out;
-		}
-		pad_packet(dp, user_skb);
+	if (cutlen > 0 &&
+	    nla_put_u32(user_skb, OVS_PACKET_ATTR_LEN, skb->len)) {
+		err = -ENOBUFS;
+		goto out;
 	}
 
 	/* Add OVS_PACKET_ATTR_HASH */