From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UPPERCASE_50_75, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 182D1C10F13 for ; Tue, 16 Apr 2019 08:47:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA59320821 for ; Tue, 16 Apr 2019 08:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbfDPIrZ (ORCPT ); Tue, 16 Apr 2019 04:47:25 -0400 Received: from mail-eopbgr750057.outbound.protection.outlook.com ([40.107.75.57]:55864 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726753AbfDPIrZ (ORCPT ); Tue, 16 Apr 2019 04:47:25 -0400 Received: from DM5PR07CA0086.namprd07.prod.outlook.com (2603:10b6:4:ae::15) by DM3PR07MB2169.namprd07.prod.outlook.com (2a01:111:e400:5980::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.17; Tue, 16 Apr 2019 08:46:43 +0000 Received: from DM3NAM05FT040.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::205) by DM5PR07CA0086.outlook.office365.com (2603:10b6:4:ae::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1813.11 via Frontend Transport; Tue, 16 Apr 2019 08:46:43 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by DM3NAM05FT040.mail.protection.outlook.com (10.152.98.154) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1792.7 via Frontend Transport; Tue, 16 Apr 2019 08:46:42 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 16 Apr 2019 01:46:42 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x3G8kfdY016939; Tue, 16 Apr 2019 01:46:41 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x3G8kfAk016938; Tue, 16 Apr 2019 01:46:41 -0700 From: Sudarsana Reddy Kalluru To: , CC: Subject: [PATCH net-next 1/2] bnx2x: Replace magic numbers with macro definitions. Date: Tue, 16 Apr 2019 01:46:12 -0700 Message-ID: <20190416084613.16897-2-skalluru@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190416084613.16897-1-skalluru@marvell.com> References: <20190416084613.16897-1-skalluru@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Matching-Connectors: 131998780033564168;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(136003)(39860400002)(2980300002)(1110001)(339900001)(199004)(189003)(47776003)(11346002)(69596002)(446003)(305945005)(476003)(486006)(16586007)(42186006)(2616005)(97736004)(316002)(1076003)(85426001)(110136005)(86362001)(2906002)(126002)(356004)(336012)(6666004)(36756003)(105606002)(50466002)(48376002)(53936002)(8936002)(76176011)(81156014)(80596001)(76130400001)(8676002)(4326008)(51416003)(498600001)(81166006)(106466001)(6636002)(68736007)(26826003)(50226002)(87636003)(5660300002)(26005)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR07MB2169;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63d106df-f7cb-4ab3-cdb2-08d6c2480d1b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600140)(711020)(4605104)(2017052603328);SRVR:DM3PR07MB2169; X-MS-TrafficTypeDiagnostic: DM3PR07MB2169: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 000947967F X-Microsoft-Antispam-Message-Info: /I2FPDacAV3sF7ZPpdBSYNF/vB84IPFdGk2Jb5U7af4FKQOAcfiLkzSkN4NlVtxGNQZM1/NXP/F5CT4KINT2+YlG4CpC+6jerp1mNi2kPiCyTzWKEqnodocFjLUZqiNr5g2f9Swc5p4D2YekZ1AQkoYRPqkH9pJhsNgA0uiBGMxQlDtlCMpZncogA2s5m/8D3rrIeF/saB/U2FK3LbMg5C8G8HjCiTFjROquvU3l7l8xYtb3tztFVw7UCxLkizMZWCeL6ln2hBKc9j+haKTPd1yHOD5hyj+HS8XEtyrCKmg58fgbxtQ+Wya+VDL2Ea39R+7wPA67adBwBJ0gN1YQxU25PsCEosqf90vW974pMVy9dg7rmsEbuY3+AvF5iDlbcPJxm7NqVGs1jKGHlcpt/72R+/n5LHgHicTJ1kE1aZ8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2019 08:46:42.8710 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63d106df-f7cb-4ab3-cdb2-08d6c2480d1b X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2169 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch performs code cleanup by defining macros for the ptp-timestamp filters. Signed-off-by: Sudarsana Reddy Kalluru Signed-off-by: Ariel Elior --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 50 ++++++++++++++---------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 626b491..0ebc526 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -15376,27 +15376,45 @@ static int bnx2x_enable_ptp_packets(struct bnx2x *bp) return 0; } +#define BNX2X_PTP_TX_ON_PARAM_MASK 0x6AA +#define BNX2X_PTP_TX_ON_RULE_MASK 0x3EEE +#define BNX2X_PTP_V1_L4_PARAM_MASK 0x7EE +#define BNX2X_PTP_V1_L4_RULE_MASK 0x3FFE +#define BNX2X_PTP_V2_L4_PARAM_MASK 0x7EA +#define BNX2X_PTP_V2_L4_RULE_MASK 0x3FEE +#define BNX2X_PTP_V2_L2_PARAM_MASK 0x6BF +#define BNX2X_PTP_V2_L2_RULE_MASK 0x3EFF +#define BNX2X_PTP_V2_PARAM_MASK 0x6AA +#define BNX2X_PTP_V2_RULE_MASK 0x3EEE + int bnx2x_configure_ptp_filters(struct bnx2x *bp) { int port = BP_PORT(bp); + u32 param, rule; int rc; if (!bp->hwtstamp_ioctl_called) return 0; + param = port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK : + NIG_REG_P0_TLLH_PTP_PARAM_MASK; + rule = port ? NIG_REG_P1_TLLH_PTP_RULE_MASK : + NIG_REG_P0_TLLH_PTP_RULE_MASK; switch (bp->tx_type) { case HWTSTAMP_TX_ON: bp->flags |= TX_TIMESTAMPING_EN; - REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK : - NIG_REG_P0_TLLH_PTP_PARAM_MASK, 0x6AA); - REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_RULE_MASK : - NIG_REG_P0_TLLH_PTP_RULE_MASK, 0x3EEE); + REG_WR(bp, param, BNX2X_PTP_TX_ON_PARAM_MASK); + REG_WR(bp, rule, BNX2X_PTP_TX_ON_RULE_MASK); break; case HWTSTAMP_TX_ONESTEP_SYNC: BNX2X_ERR("One-step timestamping is not supported\n"); return -ERANGE; } + param = port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : + NIG_REG_P0_LLH_PTP_PARAM_MASK; + rule = port ? NIG_REG_P1_LLH_PTP_RULE_MASK : + NIG_REG_P0_LLH_PTP_RULE_MASK; switch (bp->rx_filter) { case HWTSTAMP_FILTER_NONE: break; @@ -15410,30 +15428,24 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp) case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: bp->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; /* Initialize PTP detection for UDP/IPv4 events */ - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7EE); - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FFE); + REG_WR(bp, param, BNX2X_PTP_V1_L4_PARAM_MASK); + REG_WR(bp, rule, BNX2X_PTP_V1_L4_RULE_MASK); break; case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; /* Initialize PTP detection for UDP/IPv4 or UDP/IPv6 events */ - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7EA); - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FEE); + REG_WR(bp, param, BNX2X_PTP_V2_L4_PARAM_MASK); + REG_WR(bp, rule, BNX2X_PTP_V2_L4_RULE_MASK); break; case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; /* Initialize PTP detection L2 events */ - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x6BF); - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3EFF); + REG_WR(bp, param, BNX2X_PTP_V2_L2_PARAM_MASK); + REG_WR(bp, rule, BNX2X_PTP_V2_L2_RULE_MASK); break; case HWTSTAMP_FILTER_PTP_V2_EVENT: @@ -15441,10 +15453,8 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp) case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; /* Initialize PTP detection L2, UDP/IPv4 or UDP/IPv6 events */ - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x6AA); - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3EEE); + REG_WR(bp, param, BNX2X_PTP_V2_PARAM_MASK); + REG_WR(bp, rule, BNX2X_PTP_V2_RULE_MASK); break; } -- 1.8.3.1