From patchwork Fri Jan 20 09:08:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 46223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp94286wrn; Fri, 20 Jan 2023 01:12:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXtyK17aeg8DeVxxuYixtIs0/VV99RZPPTsPjfW/vDguOg4erVwt088+6CGkGuOVUOI5XtdY X-Received: by 2002:a17:907:84ca:b0:82b:61db:92b8 with SMTP id oh10-20020a17090784ca00b0082b61db92b8mr13186710ejc.57.1674205969804; Fri, 20 Jan 2023 01:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674205969; cv=none; d=google.com; s=arc-20160816; b=oYFahgi/8LxeYLLPLisFmCM/KrHf5bz1vTA5lYieIs+NZUBsdThaEMfInytFPong+M /TZ0nPKrzvavYXZHQK7jKyxbCvAkoXGB60m6N9B8sUJ9cEVTSRqghjzg+KotNFLewacG 8UxEATPI6n7+jXVaEceCMtnd06D/i5CTxxKO29yjK9P6hZvjZBISWCF7aiNBVX/YLke+ FpfNC165LcUPpTN62Qrj+4SpS3197Co0XrN4i1SnQtip3q4HQ5WCghX/gj5Pladofb8G QUEzLWeqp+tsUSBUbHhrPSEdYtf24tJMOtBcUyXXlAh+XCwLuNCEluJ+0hWkX1AgD9Kw 5sRw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Vgm/GCPZJCL6O3t6D7h024xV/YH+W4AGJp+O5IZAVvw=; b=BmG1Vr8xkWjOL8lPilJMP8KXBNfv615BMENLloKeUx5gAbtpqlld2bp5RalcGZ0wzX JXva2AbB0CmYI8gXZFfzP1ivRMi9xwHUZnUdHJtCsUYoeOZ3dsirjzQBdKITH23o/rMa e8onIsOmcgqwsn3/ePoSBQa40AW8QOp2Dr9799FwMEV4XtJPGe8tY6hSC9A49IsOuneA dW+MQ3WPE3YgRG8kMxiaKcsp6dvMt17pORcx3dMBtTCsEro07uYkYUHrknSUiwjNsaK/ vWnVEkwV4I9iA4tjswKEsv2j6g+Xl5MdCPg5EVJbe5Wbzy0fBfFAN4voCIvo4WX1g74Q u+Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Fl3M2VPj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg34-20020a170907972200b0087766403eb7si7432472ejc.818.2023.01.20.01.12.25; Fri, 20 Jan 2023 01:12:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Fl3M2VPj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbjATJJP (ORCPT + 99 others); Fri, 20 Jan 2023 04:09:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjATJI5 (ORCPT ); Fri, 20 Jan 2023 04:08:57 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D116069B14; Fri, 20 Jan 2023 01:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1674205733; x=1705741733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8jLoDyoa4lILFvDnjI3K/TQTi2Daf4y+tiN3pIiYJlw=; b=Fl3M2VPjP3AAWQGRIR7d/i3xlIQ9UjXLLz3MOqKY0sajZowWfo0pnFBn a4jdKNx9OvBGxuCYB4x1XnsuszUHl7AOmHL2cZOBM8THrHo/hTtjwvqEh I6JhCRPaB5dSGuMEpci2zenk3hcXEHlOfsieiq9h2w+g6YFQbTY+WBBiA cnwyI9RCvpRFZLxQ0jvGEVYv+JvTW0SyGmgV9MyYMN4PSzfQGoEFr0STp RJtP/DHARKGJkx4yMuNBKJoYjjoCAhSVrUmml48e2r3P0DLDxd8cYcoMc wU17uChWO5ZV1DvpoGHUbBDUBa3viC+x6B2WjcEBRMum8msgLYckBgj6Z g==; X-IronPort-AV: E=Sophos;i="5.97,231,1669100400"; d="scan'208";a="196670237" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jan 2023 02:08:52 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 20 Jan 2023 02:08:51 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 20 Jan 2023 02:08:47 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , Randy Dunlap , "Casper Andersson" , Russell King , Wan Jiabing , "Nathan Huckleberry" , , , , "Steen Hegelund" , Daniel Machon , Horatiu Vultur , Lars Povlsen , Dan Carpenter , Michael Walle Subject: [PATCH net-next 3/8] net: microchip: sparx5: Add actionset type id information to rule Date: Fri, 20 Jan 2023 10:08:26 +0100 Message-ID: <20230120090831.20032-4-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230120090831.20032-1-steen.hegelund@microchip.com> References: <20230120090831.20032-1-steen.hegelund@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755532198889104624?= X-GMAIL-MSGID: =?utf-8?q?1755532198889104624?= This adds the actionset type id to the rule information. This is needed as we now have more than one actionset in a VCAP instance (IS0). Signed-off-by: Steen Hegelund --- .../net/ethernet/microchip/vcap/vcap_api.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c index 71f787a78295..26fa58d4a0cd 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c @@ -1675,6 +1675,39 @@ static int vcap_add_type_keyfield(struct vcap_rule *rule) return 0; } +/* Add the actionset typefield to the list of rule actionfields */ +static int vcap_add_type_actionfield(struct vcap_rule *rule) +{ + enum vcap_actionfield_set actionset = rule->actionset; + struct vcap_rule_internal *ri = to_intrule(rule); + enum vcap_type vt = ri->admin->vtype; + const struct vcap_field *fields; + const struct vcap_set *aset; + int ret = -EINVAL; + + aset = vcap_actionfieldset(ri->vctrl, vt, actionset); + if (!aset) + return ret; + if (aset->type_id == (u8)-1) /* No type field is needed */ + return 0; + + fields = vcap_actionfields(ri->vctrl, vt, actionset); + if (!fields) + return -EINVAL; + if (fields[VCAP_AF_TYPE].width > 1) { + ret = vcap_rule_add_action_u32(rule, VCAP_AF_TYPE, + aset->type_id); + } else { + if (aset->type_id) + ret = vcap_rule_add_action_bit(rule, VCAP_AF_TYPE, + VCAP_BIT_1); + else + ret = vcap_rule_add_action_bit(rule, VCAP_AF_TYPE, + VCAP_BIT_0); + } + return 0; +} + /* Add a keyset to a keyset list */ bool vcap_keyset_list_add(struct vcap_keyset_list *keysetlist, enum vcap_keyfield_set keyset) @@ -1858,6 +1891,7 @@ int vcap_val_rule(struct vcap_rule *rule, u16 l3_proto) return -EINVAL; } vcap_add_type_keyfield(rule); + vcap_add_type_actionfield(rule); /* Add default fields to this rule */ ri->vctrl->ops->add_default_fields(ri->ndev, ri->admin, rule);