From patchwork Fri Dec 8 12:01:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Kavanagh X-Patchwork-Id: 846183 X-Patchwork-Delegate: ian.stokes@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ytWG70TT4z9s71 for ; Fri, 8 Dec 2017 23:03:26 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 534BCCA8; Fri, 8 Dec 2017 12:02:09 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5F3DEC98 for ; Fri, 8 Dec 2017 12:02:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 08C78189 for ; Fri, 8 Dec 2017 12:02:06 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Dec 2017 04:02:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,377,1508828400"; d="scan'208";a="16548174" Received: from silpixa00380299.ir.intel.com ([10.237.222.17]) by orsmga002.jf.intel.com with ESMTP; 08 Dec 2017 04:02:04 -0800 From: Mark Kavanagh To: dev@openvswitch.org, qiudayu@chinac.com Date: Fri, 8 Dec 2017 12:01:51 +0000 Message-Id: <1512734518-103757-3-git-send-email-mark.b.kavanagh@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1512734518-103757-1-git-send-email-mark.b.kavanagh@intel.com> References: <1512734518-103757-1-git-send-email-mark.b.kavanagh@intel.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [RFC PATCH V4 2/9] dp-packet: fix reset_packet for multi-seg mbufs X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When adjusting the size of a dp_packet, dp_packet_set_data() should be invoked before dp_packet_set_size(),since for DPDK multi-segment mbufs, the former will use the segments's data_off and buf_len to derive the frame size that should be set (this behaviour is introduced in a subsequent commit). Currently, in dp_packet_reset_packet(), that order is reversed. Swap the order of same to resolve. Signed-off-by: Mark Kavanagh --- lib/dp-packet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dp-packet.h b/lib/dp-packet.h index b4b721c..47502ad 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -569,8 +569,8 @@ dp_packet_set_data(struct dp_packet *b, void *data) static inline void dp_packet_reset_packet(struct dp_packet *b, int off) { - dp_packet_set_size(b, dp_packet_size(b) - off); dp_packet_set_data(b, ((unsigned char *) dp_packet_data(b) + off)); + dp_packet_set_size(b, dp_packet_size(b) - off); dp_packet_reset_offsets(b); }