From patchwork Thu Oct 27 16:44:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 79759 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp749193edx; Thu, 27 Oct 2016 09:44:51 -0700 (PDT) X-Received: by 10.176.16.67 with SMTP id g3mr6475829uab.54.1477586691335; Thu, 27 Oct 2016 09:44:51 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l124si3730593vki.149.2016.10.27.09.44.50; Thu, 27 Oct 2016 09:44:51 -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 8058A61BA0; Thu, 27 Oct 2016 16:44:50 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 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 93A8860DBA; Thu, 27 Oct 2016 16:44:44 +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 C5ED960E20; Thu, 27 Oct 2016 16:44:42 +0000 (UTC) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by lists.linaro.org (Postfix) with ESMTPS id BF26F60A2E for ; Thu, 27 Oct 2016 16:44:41 +0000 (UTC) Received: by mail-oi0-f44.google.com with SMTP id n202so56987011oig.3 for ; Thu, 27 Oct 2016 09:44:41 -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; bh=L0WdxoZmit5YN+TfejKsv3p6hbw5nLZKUY5poBNpz9Q=; b=UQCvbQlxOAiI3l10N2en58s3IJWp0i4Y4Zc2H6dLFEzAy1N01YWkriPWw1LK3JT9Yw UBUqNoGgMyYF4kdL/PvvagLb7eofuC1TDG8iL60w8jCg28Pd/QcXPe73hG5V/phwxo67 z2Pd+Z7P1zzyiNark6w6i3ZnMc8u6QJo2m9wYDnOIAzjqoWlqOkl0S8eTpZIABSUBKcq hHQraKJR6xw4VdEi80mcb/KBHcpniWE5Gr8tQEHOmJJ5CwsDg28TOly8TPMuAWD8s9WC AYjNm8Z60Z714j0EZwsCCDIa/n4wOiFg0aKHoRdIt4kO2wAik8pOZe8mwMbsEtj0Y2qB IZhw== X-Gm-Message-State: ABUngvd45y81gJyDSHGrf1ICOfflPc6xeCqwmaoLUmdnelQOVpb2TlyXzZnBVJ2j6wEqtasf/yI= X-Received: by 10.157.56.44 with SMTP id i41mr6979031otc.93.1477586681298; Thu, 27 Oct 2016 09:44:41 -0700 (PDT) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id u93sm2460433otb.8.2016.10.27.09.44.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Oct 2016 09:44:40 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 27 Oct 2016 11:44:39 -0500 Message-Id: <1477586679-30626-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 X-Topics: patch Subject: [lng-odp] [PATCHv2] linux-generic: packet: add fall through comments to parser 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding comments to the parser's switch statement to document the fact that fall through is intentional. Signed-off-by: Bill Fischofer --- Changes for v2: - Address Maxim's comments on comment alignment platform/linux-generic/odp_packet.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.4 diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 714794a..c2b26fd 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, switch (prs->parsed_layers) { case LAYER_NONE: + /* Fall through */ + case LAYER_L2: { const _odp_ethhdr_t *eth; @@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, if (layer == LAYER_L2) return prs->error_flags.all != 0; } + /* Fall through */ + case LAYER_L3: { offset = prs->l3_offset; @@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, if (layer == LAYER_L3) return prs->error_flags.all != 0; } + /* Fall through */ + case LAYER_L4: { offset = prs->l4_offset; @@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, prs->parsed_layers = LAYER_L4; break; } + case LAYER_ALL: break;