From patchwork Fri Feb 17 08:11:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 94117 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp58502qgi; Fri, 17 Feb 2017 00:13:14 -0800 (PST) X-Received: by 10.55.99.139 with SMTP id x133mr5991919qkb.317.1487319194786; Fri, 17 Feb 2017 00:13:14 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p12si7000721qte.223.2017.02.17.00.13.14; Fri, 17 Feb 2017 00:13:14 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EB96460EA1; Fri, 17 Feb 2017 08:13:13 +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_H3, RCVD_IN_MSPIKE_WL, 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 4180960C56; Fri, 17 Feb 2017 08:13:10 +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 5F76D60C56; Fri, 17 Feb 2017 08:12:14 +0000 (UTC) Received: from mail-pg0-f45.google.com (mail-pg0-f45.google.com [74.125.83.45]) by lists.linaro.org (Postfix) with ESMTPS id 849E760A3E for ; Fri, 17 Feb 2017 08:12:12 +0000 (UTC) Received: by mail-pg0-f45.google.com with SMTP id v184so13750872pgv.3 for ; Fri, 17 Feb 2017 00:12:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/8QaItPWUOWQwm+1po5y55Ud/qiCuH8xCn1QXGzb74Y=; b=PyFNtStTbIKExKPsLvrUHKAKonzxU2rXNNYhBJzQhb1kYsoh2F1XgDTS8bnp1J04Q8 1lYf+bh8sJsXEuCdoviI9xBGnORw7YI2qkQZTmVd7zWq/KCmDx+ERJLtADzZMQzshNHV fRaH5RXQZSiDoXYDUDljocF2CbXGI8OZw7KViyAryVY4XIwja4Qjyrp+zEtPSPhmvWcu UFSXx8aoBLLzfcAITQNDv3gcPGJZEbCkp9XTRExnV+cgIuQgBFuhA5wwCAVJObrQSe8y h2o+aGEdtAVh378QczZou2sp4We07+D2WNg7R6ZnMqo2AYtZRC66BYMfWM8wZIy3oL+X 8g1A== X-Gm-Message-State: AMke39kCAiYSVU4QkWZCOZYVoDxY9nmUnZfhcatLgeNdS5XLMPrFYb3JE1R6aACKcpiLmSfa/I8= X-Received: by 10.99.3.5 with SMTP id 5mr8600781pgd.150.1487319131635; Fri, 17 Feb 2017 00:12:11 -0800 (PST) Received: from localhost.localdomain ([171.61.89.98]) by smtp.gmail.com with ESMTPSA id 75sm17738530pfp.80.2017.02.17.00.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 00:12:11 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 17 Feb 2017 13:41:49 +0530 Message-Id: <1487319110-2842-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 Subject: [lng-odp] [PATCHv1 1/2] linux-generic: classification: implement eth type packet matching rule 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" Adds implementation for outer and inner ethernet type packet matching rule Signed-off-by: Balasubramanian Manoharan --- .../include/odp_classification_inlines.h | 40 +++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index c9517d6..2747db8 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -332,19 +332,43 @@ static inline int verify_pmr_custom_frame(const uint8_t *pkt_addr, return 0; } -static inline int verify_pmr_eth_type_0(const uint8_t *pkt_addr ODP_UNUSED, - odp_packet_hdr_t *pkt_hdr ODP_UNUSED, - pmr_term_value_t *term_value ODP_UNUSED) +static inline int verify_pmr_eth_type_0(const uint8_t *pkt_addr, + odp_packet_hdr_t *pkt_hdr, + pmr_term_value_t *term_value) { - ODP_UNIMPLEMENTED(); + const _odp_ethhdr_t *eth; + uint16_t ethtype; + + if (!pkt_hdr->p.input_flags.vlan_qinq) + return 0; + + eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); + ethtype = odp_be_to_cpu_16(eth->type); + + if (term_value->match.value == (ethtype & term_value->match.mask)) + return 1; + return 0; } -static inline int verify_pmr_eth_type_x(const uint8_t *pkt_addr ODP_UNUSED, - odp_packet_hdr_t *pkt_hdr ODP_UNUSED, - pmr_term_value_t *term_value ODP_UNUSED) +static inline int verify_pmr_eth_type_x(const uint8_t *pkt_addr, + odp_packet_hdr_t *pkt_hdr, + pmr_term_value_t *term_value) { - ODP_UNIMPLEMENTED(); + const _odp_ethhdr_t *eth; + uint16_t ethtype; + const _odp_vlanhdr_t *vlan; + + if (!pkt_hdr->p.input_flags.vlan_qinq) + return 0; + + eth = (const _odp_ethhdr_t *)(pkt_addr + pkt_hdr->p.l2_offset); + vlan = (const _odp_vlanhdr_t *)(eth + 1); + ethtype = odp_be_to_cpu_16(vlan->type); + + if (term_value->match.value == (ethtype & term_value->match.mask)) + return 1; + return 0; } #ifdef __cplusplus