Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3423881pxf; Mon, 29 Mar 2021 01:39:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi9BO4fgXObl6k3UPksBAtmWuvZMkwMfe27o4tOWyUvdZkviZSL3WO6V/DY8tjfSKFDeTr X-Received: by 2002:a17:907:2d9f:: with SMTP id gt31mr27178395ejc.233.1617007177585; Mon, 29 Mar 2021 01:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007177; cv=none; d=google.com; s=arc-20160816; b=Ju3JruTccM2cLlxlSmyZZT9pGDh5QpysWl5ChCx8IAh8dJDNboD8qGgRe30xH+quLg ko+coT07tknxAlsn+DgVGW1VHQDPA0c1ajdKGWnUIQnBB6/2o68oB4/OusNZme2eES9W DppAs8m9zf4zewONznwAhLb9zeCkx811SFoRDLkrI0rvVZnGdwQJSy7PICEa7ePc0BCm l9CRP2l9OrdKAFIEpx5NIulOgDCMDJFWLolqOl1Kvsb5daT6Fub5oC6VSvqLzxnkW+od 3pjTfCIp0JpG64svP7zg2shvChdnsjpqhLCwhLYpNDi5BcX50ksYcx00oGlFkTh1goMP /MYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f3A7TjTgZ9KB7ZC+X15r/RDs5hHS3CBGhBSdHy0rLa4=; b=Fo3rsGQYeV5VRkuRVihygOUBn8qcBKU90PfpjiqXH0xtraxUiPwmshw7eRyN75dvIH UFzuhO9fqJdNZHEfxiKQA/pKQPUs3jY9gTJLRzv3Qat683QSQeLPpp10LTNMwL4AYEXk Bs/nirQy1qQUc56nrRWcq6zWMYB6OVmIpLrxOSseLtD+thUJ5dA2t6PR70pZwoSDvLpm fN30N12wY3388h2/8U8VeEIUW66i9jORvMGKJi/ClkmpqDxcuiDWWjOD0XdMo7SuBKo3 rVkon9lYVRGSzB2tDR8qgpkQm58VU8LOB39oMvJZj0G7C3oWlNGxE3zlo/4pcVG7a8s8 XCcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o2eOCleY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si12236093edc.6.2021.03.29.01.39.15; Mon, 29 Mar 2021 01:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o2eOCleY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234750AbhC2IhR (ORCPT + 99 others); Mon, 29 Mar 2021 04:37:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:39332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233969AbhC2IWp (ORCPT ); Mon, 29 Mar 2021 04:22:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0107C6044F; Mon, 29 Mar 2021 08:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006153; bh=nkqi4Jbyl0Uzy75QU92FnrknwYWEDlHlfIZNVoCIv+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2eOCleY14GS3a3UHsCclPhhcpbCqtesKu12pLppcMgyjwh92s/Tq52lXlYWBaC6o jxRZbus/jA1C0TZ9K6Fp2fR2TOuqsQrU7UVWP5amVShBJ50ZLGqygD+7nFORH/KZ63 v2vtON3ZREpO2FGIg7J430RYDFBc7+ppJWaUvvAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Louis Peens , Simon Horman , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 136/221] nfp: flower: fix unsupported pre_tunnel flows Date: Mon, 29 Mar 2021 09:57:47 +0200 Message-Id: <20210329075633.723005706@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Louis Peens [ Upstream commit 982e5ee23d764fe6158f67a7813d416335e978b0 ] There are some pre_tunnel flows combinations which are incorrectly being offloaded without proper support, fix these. - Matching on MPLS is not supported for pre_tun. - Match on IPv4/IPv6 layer must be present. - Destination MAC address must match pre_tun.dev MAC Fixes: 120ffd84a9ec ("nfp: flower: verify pre-tunnel rules") Signed-off-by: Louis Peens Signed-off-by: Simon Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../ethernet/netronome/nfp/flower/offload.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 1c59aff2163c..d72225d64a75 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1142,6 +1142,12 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, return -EOPNOTSUPP; } + if (!(key_layer & NFP_FLOWER_LAYER_IPV4) && + !(key_layer & NFP_FLOWER_LAYER_IPV6)) { + NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: match on ipv4/ipv6 eth_type must be present"); + return -EOPNOTSUPP; + } + /* Skip fields known to exist. */ mask += sizeof(struct nfp_flower_meta_tci); ext += sizeof(struct nfp_flower_meta_tci); @@ -1152,6 +1158,13 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, mask += sizeof(struct nfp_flower_in_port); ext += sizeof(struct nfp_flower_in_port); + /* Ensure destination MAC address matches pre_tun_dev. */ + mac = (struct nfp_flower_mac_mpls *)ext; + if (memcmp(&mac->mac_dst[0], flow->pre_tun_rule.dev->dev_addr, 6)) { + NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: dest MAC must match output dev MAC"); + return -EOPNOTSUPP; + } + /* Ensure destination MAC address is fully matched. */ mac = (struct nfp_flower_mac_mpls *)mask; if (!is_broadcast_ether_addr(&mac->mac_dst[0])) { @@ -1159,6 +1172,11 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, return -EOPNOTSUPP; } + if (mac->mpls_lse) { + NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: MPLS not supported"); + return -EOPNOTSUPP; + } + mask += sizeof(struct nfp_flower_mac_mpls); ext += sizeof(struct nfp_flower_mac_mpls); if (key_layer & NFP_FLOWER_LAYER_IPV4 || -- 2.30.1