From patchwork Mon Apr 25 01:13:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 66550 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp785007qge; Sun, 24 Apr 2016 18:14:01 -0700 (PDT) X-Received: by 10.107.2.3 with SMTP id 3mr17102219ioc.9.1461546841037; Sun, 24 Apr 2016 18:14:01 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a7si14809514igv.89.2016.04.24.18.14.00; Sun, 24 Apr 2016 18:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7F15761A3E; Mon, 25 Apr 2016 01:14:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 6E857619F5; Mon, 25 Apr 2016 01:13:31 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 810E561A07; Mon, 25 Apr 2016 01:13:24 +0000 (UTC) Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com [209.85.218.48]) by lists.linaro.org (Postfix) with ESMTPS id 61962619B3 for ; Mon, 25 Apr 2016 01:13:23 +0000 (UTC) Received: by mail-oi0-f48.google.com with SMTP id k142so163442591oib.1 for ; Sun, 24 Apr 2016 18:13:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3QFOS2FO9osO/e8ykyWePpD/nZopiM5jcDD0YSJwQJs=; b=SgsOPbDt5VjNxDIENKh08JMVBpnfYkw1n6GSfLCU9Kv6sUvQq9XuIQlVq5CR6B+kEd ilXCkBh1Zi0Db7G4ijKK1HbQeRWa5pSLHiPRaAR63HZroX75z/8SozSMjIcUmKxbfBFU Sg6SypwnT5SAeUQ9fU8J9+mEOJS5DXyEQUVSiFa73U6M/4+KO6cfAuemK5hdMKVk8KIL ntfY5Elz1R6rzZgDwWoGad75zETPQbYc32Gs2QC4IqD2xYTkTBTn/ps3H2M5Lut+0EQ/ x+7eh6tGScUor0Oo0axP43m5oIhoXIhyls1rl/2MwIix58VGae+gZfBQ4QyiMItxsBsL WsGQ== X-Gm-Message-State: AOPr4FVm0iMtmahN41cNv8VQdaar6CIwhYFCb/0t83y0DVYuSDsPOJGdHg0gO1oAGOWXCTUwavE= X-Received: by 10.157.40.9 with SMTP id m9mr14349434otb.23.1461546802934; Sun, 24 Apr 2016 18:13:22 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id t5sm2216138oie.18.2016.04.24.18.13.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Apr 2016 18:13:22 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 24 Apr 2016 20:13:15 -0500 Message-Id: <1461546799-18112-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461546799-18112-1-git-send-email-bill.fischofer@linaro.org> References: <1461546799-18112-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 1/5] linux-generic: packet: correct tail trunc logic X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Correct the calculation of number of segmnets to trim on odp_packet_trunc_tail() calls. Signed-off-by: Bill Fischofer --- platform/linux-generic/include/odp_packet_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 43607b0..9ea95c3 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -257,7 +257,7 @@ static inline int push_tail_seg(odp_packet_hdr_t *pkt_hdr, size_t len) static inline void pull_tail_seg(odp_packet_hdr_t *pkt_hdr) { - uint32_t extrasegs = (pkt_hdr->tailroom - 1) / pkt_hdr->buf_hdr.segsize; + uint32_t extrasegs = pkt_hdr->tailroom / pkt_hdr->buf_hdr.segsize; seg_free_tail(&pkt_hdr->buf_hdr, extrasegs); pkt_hdr->tailroom -= extrasegs * pkt_hdr->buf_hdr.segsize;