Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp781959rwb; Tue, 27 Sep 2022 04:45:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dW7ZzR7QFM+slrskdJC+S2WMj+CI1ZuSIpBaDhq3iWdL2e7voGNiZJqMwXpJl/zYY/AM2 X-Received: by 2002:a17:907:6e17:b0:783:7839:ff3f with SMTP id sd23-20020a1709076e1700b007837839ff3fmr8824961ejc.300.1664279156358; Tue, 27 Sep 2022 04:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664279156; cv=none; d=google.com; s=arc-20160816; b=yLTeeMnSzNEBzuua3/c9zxOT5bsIKQ4v1QiYvtz2tVuyzCtCgPv4WIQdNtaKfFHQF8 fpLVkuz67ylSY3XwWwxGayhbgQ6Vy1EjaC5hKDtvkDDm3cUclL0H68meGM/TWOc0Qhv5 3rPdl6LTkK9hbhpbm+xXv8bysVvVGWwejYARoGcy7K/NjeYfHjuBGV+GLwMcxELBZgBr V+ZHmbAbqRBJKXwe8YdJDdy4rwCejaLgY6l7vN96F/H+mKCCQ29qFW5IFrsDMaCQxTmE /vzwV1YCbJlZRM2KsVbJRRXuzqmmTSiW9Ei/ePu0GZsCUPpiDxOOV+onH1cAuZIdx7DR UH1w== 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; bh=u55thRd3UAdbb0jmL/2u+txhZja65JBINnjFoA5LO60=; b=hpn4NQQ4jzyah4AXPGnI0XoU8hLv8kEBNgBc63/DWaCyA8OwyxoY85RhmUpUtn6SOf mguFGViR4STe5hGQxdTxeB4Cm72defFO7niqG+76/ihpA/Mth0mCBJAuXCaFnQeOlIKJ TG7H8s0zUmx74fCN1xNoOJwBjDmeVWqCCQ+oHGraxW5ZTahWrmHUZZwpx3uVlnnFE4NP fI9QGqlPnr8ZzeQS4nkW6BFGe/4xXcsbQHfSe4oGp6ZeJ4e3DMDPFRj1PqfbLPM9U8hv sRiB24K398n5PBmZ67kU5uGPc5JSe7hxBCr9qztoEJbi3CIJoaoL6JHG/dw0fJ/DGXHF oMBQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a50d4cd000000b00445dba83badsi1320035edj.395.2022.09.27.04.45.30; Tue, 27 Sep 2022 04:45:56 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232025AbiI0LPh (ORCPT + 99 others); Tue, 27 Sep 2022 07:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbiI0LPB (ORCPT ); Tue, 27 Sep 2022 07:15:01 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9DCE4A103; Tue, 27 Sep 2022 04:14:57 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4McH5D5RtfzpV4D; Tue, 27 Sep 2022 19:12:00 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 27 Sep 2022 19:14:55 +0800 Received: from localhost.localdomain (10.69.192.56) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 27 Sep 2022 19:14:55 +0800 From: Guangbin Huang To: , CC: , , , , , , Subject: [PATCH net-next 1/4] net: hns3: refine the tcam key convert handle Date: Tue, 27 Sep 2022 19:12:02 +0800 Message-ID: <20220927111205.18060-2-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220927111205.18060-1-huangguangbin2@huawei.com> References: <20220927111205.18060-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 From: Jian Shen The expression '(k ^ ~v)' is exaclty '(k & v)', and '(k & v) & k' is exaclty 'k & v'. So simplify the expression for tcam key convert. It also add necessary brackets for them. Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 495b639b0dc2..59bfacc687c9 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -827,15 +827,10 @@ struct hclge_vf_vlan_cfg { * Then for input key(k) and mask(v), we can calculate the value by * the formulae: * x = (~k) & v - * y = (k ^ ~v) & k + * y = k & v */ -#define calc_x(x, k, v) (x = ~(k) & (v)) -#define calc_y(y, k, v) \ - do { \ - const typeof(k) _k_ = (k); \ - const typeof(v) _v_ = (v); \ - (y) = (_k_ ^ ~_v_) & (_k_); \ - } while (0) +#define calc_x(x, k, v) ((x) = ~(k) & (v)) +#define calc_y(y, k, v) ((y) = (k) & (v)) #define HCLGE_MAC_STATS_FIELD_OFF(f) (offsetof(struct hclge_mac_stats, f)) #define HCLGE_STATS_READ(p, offset) (*(u64 *)((u8 *)(p) + (offset))) -- 2.33.0