From patchwork Thu Nov 3 08:05:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 14748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp385842wru; Thu, 3 Nov 2022 01:12:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46e+JwXBCiAyi4IfXWte5N15ly3Fp0hYnQ2zYAcDtk/d/muO5/G43t/JL8Bxh2WZppoavm X-Received: by 2002:a05:6402:1004:b0:464:778:c516 with SMTP id c4-20020a056402100400b004640778c516mr6689193edu.348.1667463178019; Thu, 03 Nov 2022 01:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667463178; cv=none; d=google.com; s=arc-20160816; b=w5S1ThKx4XYnt8vsSCJXR6C5B23t//5uNIIBfcO4AcxVyDMppie8EOx5Cwwlunm9Jn ygyyyPpgeW17wvlnFmQBkM2PSTd61MMHRR+meKjgeEoH3Rw1I4ZLStGW6hagSuAYCxzw 27Or9/3ufByRNEz+Z33MfPTd51PhBeQmQPoHXGl8vjOOn2Y08IDWsL4gtW8pvH6ZsvOC 3tRXODLQDlSMPVU96M46uJpPa2OYkZL5pAt9OEqhAtMq/tYsJCyqPZ78P8Ix6W47uhK6 CPIIqB7Nl/r9/ee1RGTKuDM0fDTqDJDun/p6bvN+dEARRG1C9Zm3FyLUN7JcDAHmz0AI G9xg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fS4DJahcVA2UhQt/JNGie83+2z6izS1F4W13/rxGNm4=; b=lFw2vGbyFNGK42LpaRaltQOkSSgo6RzSvIHKBsjs12ujyFZgAfx+hRIdaJ+H/6MJPJ nF+L0BtcGarOYiOH3KeTbClkN7JEHTUp9hnHAAzjQbQai3M0DrGavw5yYXbT3IakLdnC sE7JMiln6dJY4UfLWgF5uDER1TOwLCwhd4MGrEZtOQgMeCpxP0s64EdtbEfK43CoLhMi I7PIg24nntb/YYi81hiduT4d1sqC0ttn4P0klcB9JmTJ2bbdTiUnprb1RCsxE1bBu9Sa tDVqx7uhrzzFcaAHfFNSlgQr6W0oNxFUcJSiXxEw6W8k4CJf8h8K7PnTTo8vtCBjkArO nLGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=InuQdXLN; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a508d15000000b0045cd7614e59si418259eds.451.2022.11.03.01.12.34; Thu, 03 Nov 2022 01:12:58 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=InuQdXLN; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbiKCIFu (ORCPT + 99 others); Thu, 3 Nov 2022 04:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbiKCIFq (ORCPT ); Thu, 3 Nov 2022 04:05:46 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F245FBC; Thu, 3 Nov 2022 01:05:37 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1667462735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fS4DJahcVA2UhQt/JNGie83+2z6izS1F4W13/rxGNm4=; b=InuQdXLNdJEbwbOizXDL3/qF1pQ/iPdwCCTgkGMGrshmAoKY/UcBvtgSO37qh1NxUaJ5jw iC+bznIjEmrB+mXVxFGnoFnhUbHbKGQ8rWfIkyZQzL+rvnAjTVWrMKskgpKS1zqEvWUagz 5MZfU9d3bLS8c4UhhXeN0B7QEGW+ofI= From: Cai Huoqing To: kuba@kernel.org Cc: Cai Huoqing , "David S. Miller" , Eric Dumazet , Paolo Abeni , Zhengchao Shao , Qiao Ma , Bin Chen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 1/3] net: hinic: Convert the cmd code from decimal to hex to be more readable Date: Thu, 3 Nov 2022 16:05:09 +0800 Message-Id: <20221103080525.26885-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,UPPERCASE_50_75 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?1748461869116079814?= X-GMAIL-MSGID: =?utf-8?q?1748461869116079814?= The print cmd code is in hex, so using hex cmd code intead of decimal is easy to check the value with print info. Signed-off-by: Cai Huoqing --- v1->v2: 1.Add net-next prefix. The comments link: https://lore.kernel.org/lkml/20221027110241.0340abdf@kernel.org/ v2->v3: 1.Merge PATCH 3/3 to this series. v3->v4: 1.Revert the empty lines. The comments link: https://lore.kernel.org/lkml/20221102203640.1bda5d74@kernel.org/ .../net/ethernet/huawei/hinic/hinic_hw_dev.h | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h index d2d89b0a5ef0..6dae116a11f8 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h @@ -46,104 +46,104 @@ enum hinic_port_cmd { HINIC_PORT_CMD_VF_REGISTER = 0x0, HINIC_PORT_CMD_VF_UNREGISTER = 0x1, - HINIC_PORT_CMD_CHANGE_MTU = 2, + HINIC_PORT_CMD_CHANGE_MTU = 0x2, - HINIC_PORT_CMD_ADD_VLAN = 3, - HINIC_PORT_CMD_DEL_VLAN = 4, + HINIC_PORT_CMD_ADD_VLAN = 0x3, + HINIC_PORT_CMD_DEL_VLAN = 0x4, - HINIC_PORT_CMD_SET_PFC = 5, + HINIC_PORT_CMD_SET_PFC = 0x5, - HINIC_PORT_CMD_SET_MAC = 9, - HINIC_PORT_CMD_GET_MAC = 10, - HINIC_PORT_CMD_DEL_MAC = 11, + HINIC_PORT_CMD_SET_MAC = 0x9, + HINIC_PORT_CMD_GET_MAC = 0xA, + HINIC_PORT_CMD_DEL_MAC = 0xB, - HINIC_PORT_CMD_SET_RX_MODE = 12, + HINIC_PORT_CMD_SET_RX_MODE = 0xC, - HINIC_PORT_CMD_GET_PAUSE_INFO = 20, - HINIC_PORT_CMD_SET_PAUSE_INFO = 21, + HINIC_PORT_CMD_GET_PAUSE_INFO = 0x14, + HINIC_PORT_CMD_SET_PAUSE_INFO = 0x15, - HINIC_PORT_CMD_GET_LINK_STATE = 24, + HINIC_PORT_CMD_GET_LINK_STATE = 0x18, - HINIC_PORT_CMD_SET_LRO = 25, + HINIC_PORT_CMD_SET_LRO = 0x19, - HINIC_PORT_CMD_SET_RX_CSUM = 26, + HINIC_PORT_CMD_SET_RX_CSUM = 0x1A, - HINIC_PORT_CMD_SET_RX_VLAN_OFFLOAD = 27, + HINIC_PORT_CMD_SET_RX_VLAN_OFFLOAD = 0x1B, - HINIC_PORT_CMD_GET_PORT_STATISTICS = 28, + HINIC_PORT_CMD_GET_PORT_STATISTICS = 0x1C, - HINIC_PORT_CMD_CLEAR_PORT_STATISTICS = 29, + HINIC_PORT_CMD_CLEAR_PORT_STATISTICS = 0x1D, - HINIC_PORT_CMD_GET_VPORT_STAT = 30, + HINIC_PORT_CMD_GET_VPORT_STAT = 0x1E, - HINIC_PORT_CMD_CLEAN_VPORT_STAT = 31, + HINIC_PORT_CMD_CLEAN_VPORT_STAT = 0x1F, - HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 37, + HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 0x25, - HINIC_PORT_CMD_SET_PORT_STATE = 41, + HINIC_PORT_CMD_SET_PORT_STATE = 0x29, - HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 43, + HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 0x2B, - HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 44, + HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 0x2C, - HINIC_PORT_CMD_SET_RSS_HASH_ENGINE = 45, + HINIC_PORT_CMD_SET_RSS_HASH_ENGINE = 0x2D, - HINIC_PORT_CMD_GET_RSS_HASH_ENGINE = 46, + HINIC_PORT_CMD_GET_RSS_HASH_ENGINE = 0x2E, - HINIC_PORT_CMD_GET_RSS_CTX_TBL = 47, + HINIC_PORT_CMD_GET_RSS_CTX_TBL = 0x2F, - HINIC_PORT_CMD_SET_RSS_CTX_TBL = 48, + HINIC_PORT_CMD_SET_RSS_CTX_TBL = 0x30, - HINIC_PORT_CMD_RSS_TEMP_MGR = 49, + HINIC_PORT_CMD_RSS_TEMP_MGR = 0x31, - HINIC_PORT_CMD_RD_LINE_TBL = 57, + HINIC_PORT_CMD_RD_LINE_TBL = 0x39, - HINIC_PORT_CMD_RSS_CFG = 66, + HINIC_PORT_CMD_RSS_CFG = 0x42, - HINIC_PORT_CMD_FWCTXT_INIT = 69, + HINIC_PORT_CMD_FWCTXT_INIT = 0x45, - HINIC_PORT_CMD_GET_LOOPBACK_MODE = 72, - HINIC_PORT_CMD_SET_LOOPBACK_MODE, + HINIC_PORT_CMD_GET_LOOPBACK_MODE = 0x48, + HINIC_PORT_CMD_SET_LOOPBACK_MODE = 0x49, - HINIC_PORT_CMD_ENABLE_SPOOFCHK = 78, + HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4E, - HINIC_PORT_CMD_GET_MGMT_VERSION = 88, + HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58, - HINIC_PORT_CMD_SET_FUNC_STATE = 93, + HINIC_PORT_CMD_SET_FUNC_STATE = 0x5D, - HINIC_PORT_CMD_GET_GLOBAL_QPN = 102, + HINIC_PORT_CMD_GET_GLOBAL_QPN = 0x66, - HINIC_PORT_CMD_SET_VF_RATE = 105, + HINIC_PORT_CMD_SET_VF_RATE = 0x69, - HINIC_PORT_CMD_SET_VF_VLAN = 106, + HINIC_PORT_CMD_SET_VF_VLAN = 0x6A, - HINIC_PORT_CMD_CLR_VF_VLAN, + HINIC_PORT_CMD_CLR_VF_VLAN = 0x6B, - HINIC_PORT_CMD_SET_TSO = 112, + HINIC_PORT_CMD_SET_TSO = 0x70, - HINIC_PORT_CMD_UPDATE_FW = 114, + HINIC_PORT_CMD_UPDATE_FW = 0x72, - HINIC_PORT_CMD_SET_RQ_IQ_MAP = 115, + HINIC_PORT_CMD_SET_RQ_IQ_MAP = 0x73, - HINIC_PORT_CMD_LINK_STATUS_REPORT = 160, + HINIC_PORT_CMD_LINK_STATUS_REPORT = 0xA0, - HINIC_PORT_CMD_UPDATE_MAC = 164, + HINIC_PORT_CMD_UPDATE_MAC = 0xA4, - HINIC_PORT_CMD_GET_CAP = 170, + HINIC_PORT_CMD_GET_CAP = 0xAA, - HINIC_PORT_CMD_GET_LINK_MODE = 217, + HINIC_PORT_CMD_GET_LINK_MODE = 0xD9, - HINIC_PORT_CMD_SET_SPEED = 218, + HINIC_PORT_CMD_SET_SPEED = 0xDA, - HINIC_PORT_CMD_SET_AUTONEG = 219, + HINIC_PORT_CMD_SET_AUTONEG = 0xDB, - HINIC_PORT_CMD_GET_STD_SFP_INFO = 240, + HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0, - HINIC_PORT_CMD_SET_LRO_TIMER = 244, + HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4, - HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 249, + HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9, - HINIC_PORT_CMD_GET_SFP_ABS = 251, + HINIC_PORT_CMD_GET_SFP_ABS = 0xFB, }; /* cmd of mgmt CPU message for HILINK module */ From patchwork Thu Nov 3 08:05:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 14744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp385461wru; Thu, 3 Nov 2022 01:12:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7y9RBD/U0we11pEI9cinM2+f8WvvFQJ/HS8B6ais+iyjJ5rQFOSww/YmyproY1kOvQHvxy X-Received: by 2002:a17:902:e8c3:b0:177:f078:7871 with SMTP id v3-20020a170902e8c300b00177f0787871mr29400759plg.90.1667463129709; Thu, 03 Nov 2022 01:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667463129; cv=none; d=google.com; s=arc-20160816; b=mhiSpxtuFTCLPdGKmpWWvBf0nwRbi8z5yVzTFTk85xo/jthnqcM1H0H1j9wpgqInPi ySo90jwP7t0bbptbddyB9YEVstFGhIICgrqNfO4GGBM2tAoX9SXkbLEGLjQKVQowJWLX jjk3Oa68nCluTgD+9nHLtCgSZvamznc6grKUNsog3Z8VrggRp60rTKQmsQioz0PNJq92 RfUzyMJ6tsX4UA7BCwzUVfKMHOGinRpvSscjHDJzK6nr/nVw4wrIT0aNVUEdaNuheY0x McnGy15aa6gYJHbe2T0kSLHBpWZQAaBYxCberqjg+tbsCrWnok8SpqkMPa+US3225zQM jC0g== 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=KXDPv2/ZwRaQ02PvgLOVXufHCivJRziSuAAjiAwQMy8=; b=k/+M7y5DyZfNWpWATwE8+/nvhkvq7G3hCMbIVeMBiPGIlA22/N7vCzLlRXWEeBZnqJ lbR+HMY/8TUlCTRhgFmQMesaUAFOUzPG3HJ9mmdA/5UebmNW6xU+6ZoUygVVK3w3KrvK mgsv8rJ0VeGzBIG/GKmDkWv+gqOCQnfINbvzC3FubRhFR3jTIz3NtCgkYrFxDFgQyCDw vUIbVTwYhupxEzdPJufFs61aMc1+rAfaKxpQQB8f+PV6Q9z6PBKibyLCHazh3ScnB96E QIKz3ugS/mldd8IXJ6UJ2vjcH47my7h8GU/qtaOMrU2Z6LQUAqFTr+DmmZz7FUezw2LE Fi4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Cl019427; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a63180b000000b0046ef5b35735si211788pgl.654.2022.11.03.01.11.56; Thu, 03 Nov 2022 01:12:09 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=Cl019427; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231406AbiKCIGX (ORCPT + 99 others); Thu, 3 Nov 2022 04:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231522AbiKCIGD (ORCPT ); Thu, 3 Nov 2022 04:06:03 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2533642A; Thu, 3 Nov 2022 01:06:00 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1667462759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KXDPv2/ZwRaQ02PvgLOVXufHCivJRziSuAAjiAwQMy8=; b=Cl019427bsLnW5Of0TRHVTVd4jds9NwHttYU0ZlhSd+p3iDGYPOOrBv2ZlQl7agf64jehm A5UUnWXGAFWqw84g56bDWObPbLyo+sJoE3BRFdSPgcRgtHWw4xEb5nK8IYHy3YetDPPAjS lmwtU4XfvO20CNSwmMtKyTAFwHHhTs8= From: Cai Huoqing To: kuba@kernel.org Cc: Cai Huoqing , "David S. Miller" , Eric Dumazet , Paolo Abeni , Zhengchao Shao , Qiao Ma , Bin Chen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 2/3] net: hinic: Add control command support for VF PMD driver in DPDK Date: Thu, 3 Nov 2022 16:05:10 +0800 Message-Id: <20221103080525.26885-2-cai.huoqing@linux.dev> In-Reply-To: <20221103080525.26885-1-cai.huoqing@linux.dev> References: <20221103080525.26885-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,UPPERCASE_50_75 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?1748461818831649894?= X-GMAIL-MSGID: =?utf-8?q?1748461818831649894?= HINIC has a mailbox for PF-VF communication and the VF driver could send port control command to PF driver via mailbox. The control command only can be set to register in PF, so add support in PF driver for VF PMD driver control command when VF PMD driver work with linux PF driver. Then, no need to add handlers to nic_vf_cmd_msg_handler[], because the host driver just forwards it to the firmware. Actually the firmware works on a coprocessor MGMT_CPU(inside the NIC) which will recv and deal with these commands. Signed-off-by: Cai Huoqing --- v1->v2: 1.Update the commit messsage. 2.Add net-next prefix. The comments link: https://lore.kernel.org/lkml/20221031195805.74e22089@kernel.org/ v2->v3: 1.Merge PATCH 3/3 to this series. .../net/ethernet/huawei/hinic/hinic_hw_dev.h | 66 +++++++++++++++++++ .../net/ethernet/huawei/hinic/hinic_sriov.c | 18 +++++ 2 files changed, 84 insertions(+) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h index 6dae116a11f8..6b5797e69781 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h @@ -51,6 +51,9 @@ enum hinic_port_cmd { HINIC_PORT_CMD_ADD_VLAN = 0x3, HINIC_PORT_CMD_DEL_VLAN = 0x4, + HINIC_PORT_CMD_SET_ETS = 0x7, + HINIC_PORT_CMD_GET_ETS = 0x8, + HINIC_PORT_CMD_SET_PFC = 0x5, HINIC_PORT_CMD_SET_MAC = 0x9, @@ -59,6 +62,8 @@ enum hinic_port_cmd { HINIC_PORT_CMD_SET_RX_MODE = 0xC, + HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE = 0xD, + HINIC_PORT_CMD_GET_PAUSE_INFO = 0x14, HINIC_PORT_CMD_SET_PAUSE_INFO = 0x15, @@ -81,6 +86,7 @@ enum hinic_port_cmd { HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 0x25, HINIC_PORT_CMD_SET_PORT_STATE = 0x29, + HINIC_PORT_CMD_GET_PORT_STATE = 0x30, HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 0x2B, @@ -100,17 +106,29 @@ enum hinic_port_cmd { HINIC_PORT_CMD_RSS_CFG = 0x42, + HINIC_PORT_CMD_GET_PHY_TYPE = 0x44, + HINIC_PORT_CMD_FWCTXT_INIT = 0x45, HINIC_PORT_CMD_GET_LOOPBACK_MODE = 0x48, HINIC_PORT_CMD_SET_LOOPBACK_MODE = 0x49, + HINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE = 0x4A, + HINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE = 0x4B, + HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4E, HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58, + HINIC_PORT_CMD_GET_PORT_TYPE = 0x5B, + HINIC_PORT_CMD_SET_FUNC_STATE = 0x5D, + HINIC_PORT_CMD_GET_PORT_ID_BY_FUNC_ID = 0x5E, + + HINIC_PORT_CMD_GET_DMA_CS = 0x64, + HINIC_PORT_CMD_SET_DMA_CS = 0x65, + HINIC_PORT_CMD_GET_GLOBAL_QPN = 0x66, HINIC_PORT_CMD_SET_VF_RATE = 0x69, @@ -125,25 +143,73 @@ enum hinic_port_cmd { HINIC_PORT_CMD_SET_RQ_IQ_MAP = 0x73, + HINIC_PORT_CMD_SET_PFC_THD = 0x75, + HINIC_PORT_CMD_LINK_STATUS_REPORT = 0xA0, + HINIC_PORT_CMD_SET_LOSSLESS_ETH = 0xA3, + HINIC_PORT_CMD_UPDATE_MAC = 0xA4, HINIC_PORT_CMD_GET_CAP = 0xAA, + HINIC_PORT_CMD_UP_TC_ADD_FLOW = 0xAF, + HINIC_PORT_CMD_UP_TC_DEL_FLOW = 0xB0, + HINIC_PORT_CMD_UP_TC_GET_FLOW = 0xB1, + + HINIC_PORT_CMD_UP_TC_FLUSH_TCAM = 0xB2, + + HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK = 0xB3, + + HINIC_PORT_CMD_UP_TC_ENABLE = 0xB4, + + HINIC_PORT_CMD_UP_TC_GET_TCAM_BLOCK = 0xB5, + + HINIC_PORT_CMD_SET_IPSU_MAC = 0xCB, + HINIC_PORT_CMD_GET_IPSU_MAC = 0xCC, + + HINIC_PORT_CMD_SET_XSFP_STATUS = 0xD4, + HINIC_PORT_CMD_GET_LINK_MODE = 0xD9, HINIC_PORT_CMD_SET_SPEED = 0xDA, HINIC_PORT_CMD_SET_AUTONEG = 0xDB, + HINIC_PORT_CMD_CLEAR_QP_RES = 0xDD, + + HINIC_PORT_CMD_SET_SUPER_CQE = 0xDE, + + HINIC_PORT_CMD_SET_VF_COS = 0xDF, + HINIC_PORT_CMD_GET_VF_COS = 0xE1, + + HINIC_PORT_CMD_CABLE_PLUG_EVENT = 0xE5, + + HINIC_PORT_CMD_LINK_ERR_EVENT = 0xE6, + + HINIC_PORT_CMD_SET_COS_UP_MAP = 0xE8, + + HINIC_PORT_CMD_RESET_LINK_CFG = 0xEB, + HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0, + HINIC_PORT_CMD_FORCE_PKT_DROP = 0xF3, + HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4, + HINIC_PORT_CMD_SET_VHD_CFG = 0xF7, + + HINIC_PORT_CMD_SET_LINK_FOLLOW = 0xF8, + HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9, HINIC_PORT_CMD_GET_SFP_ABS = 0xFB, + + HINIC_PORT_CMD_Q_FILTER = 0xFC, + + HINIC_PORT_CMD_TCAM_FILTER = 0xFE, + + HINIC_PORT_CMD_SET_VLAN_FILTER = 0xFF, }; /* cmd of mgmt CPU message for HILINK module */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c index f7e05b41385b..ee357088d021 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c @@ -489,6 +489,24 @@ static struct vf_cmd_check_handle nic_cmd_support_vf[] = { {HINIC_PORT_CMD_UPDATE_MAC, hinic_mbox_check_func_id_8B}, {HINIC_PORT_CMD_GET_CAP, hinic_mbox_check_func_id_8B}, {HINIC_PORT_CMD_GET_LINK_MODE, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_GET_VF_COS, NULL}, + {HINIC_PORT_CMD_SET_VHD_CFG, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_SET_VLAN_FILTER, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_Q_FILTER, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_TCAM_FILTER, NULL}, + {HINIC_PORT_CMD_UP_TC_ADD_FLOW, NULL}, + {HINIC_PORT_CMD_UP_TC_DEL_FLOW, NULL}, + {HINIC_PORT_CMD_UP_TC_FLUSH_TCAM, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_UP_TC_ENABLE, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_CABLE_PLUG_EVENT, NULL}, + {HINIC_PORT_CMD_LINK_ERR_EVENT, NULL}, + {HINIC_PORT_CMD_SET_PORT_STATE, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_SET_ETS, NULL}, + {HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE, NULL}, + {HINIC_PORT_CMD_RESET_LINK_CFG, hinic_mbox_check_func_id_8B}, + {HINIC_PORT_CMD_SET_LINK_FOLLOW, NULL}, + {HINIC_PORT_CMD_CLEAR_QP_RES, NULL}, }; #define CHECK_IPSU_15BIT 0X8000 From patchwork Thu Nov 3 08:05:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 14743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp385251wru; Thu, 3 Nov 2022 01:11:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55OP/ZETvEIZo/amB7XdPUu9EcmRKFslp1eQ7jLnUFPqpqRL+oitd681MRdh+z8BkUnypM X-Received: by 2002:a05:6402:1710:b0:463:69ac:a679 with SMTP id y16-20020a056402171000b0046369aca679mr19027127edu.184.1667463104717; Thu, 03 Nov 2022 01:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667463104; cv=none; d=google.com; s=arc-20160816; b=o1fObLqMoOZT1iXA9ZhjuhXLav1QH/2xAVakdRzygRi3G7nsruniAZgiwgQqrJrAuD BRwQ73STMS69hz8I3Cw2Fh21FjF6xpx92J/dxoyGzgC4Zsbb91BfkMDSgNbm5hav5PSs 1R+T4jcS6c5qj+Q6OKtwNHtFLu+ex/VxJnHMfEDYq6ZXe/9x87qbCrZD51nN7blyhpUA Y/QZ3IVfIlnx7Z/3Z/KGCgCzD9He2n8s6lnsAsA2qRiRYSyVIYiQVvRhuwqbqQlC1nlf /Gv2Y8V2u1PWVS2apMjJgJaHs+TrEtYr1TTyJwQHc1xAHsRXDsv+9HMBbPu3CwEoULQd VWNA== 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=MrBR4SF/8VnGnxEIBn/xM0y9bHddbWKFSWf1ZZc7fnI=; b=vq4gg/9hqqBXne3t+CtVdf7GScb57voNtW1vrmZ9aHK1ftSXfiN2kGjnqT3AgJEJ+R 3OTMZefXSctqdFAF9VZoifquYgzUhVn0bU05vxD26zikvtlS/QkzY0FNHO7ifoPQPFlS lNUZO29ly744byACcg2KldKinbZ9T9aTBs0efeyNhfPUHmVTv5K9lfaFBge5LSRcrGJ4 IH1p3+mMbSYzXtBBDQmGTwuYykrBUWOQj/xOhSUJFEDKqaXJQaCQg1RZYM39/FZ1uC3j tUiYuxkBejFwcKxM+NZZZ6055tEvHxoUUtw1qc0pHME0lNMurfnAkYvYXKPWdKqTmw8G ZAaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wqMthqfY; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a17090658d100b0078db1343eedsi505181ejs.774.2022.11.03.01.11.20; Thu, 03 Nov 2022 01:11:44 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=wqMthqfY; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231584AbiKCIGm (ORCPT + 99 others); Thu, 3 Nov 2022 04:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231609AbiKCIGV (ORCPT ); Thu, 3 Nov 2022 04:06:21 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3080760DB; Thu, 3 Nov 2022 01:06:17 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1667462775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MrBR4SF/8VnGnxEIBn/xM0y9bHddbWKFSWf1ZZc7fnI=; b=wqMthqfYcVa4A5dv5mz6RYdQvJXkwpHvTj29SmRgaEc5krBIjM2bsncvtVhdx89qULiC6Y m/RT75u/YhgoWp1XjgKZIkF81f17K51eQTdkg1iaoHMtJYxX5MwYDqOaSqS+sUzw/xRg3P 3mf1OTWiKN+6xTKESKmUO7y4WXiwQUo= From: Cai Huoqing To: kuba@kernel.org Cc: Cai Huoqing , "David S. Miller" , Eric Dumazet , Paolo Abeni , Zhengchao Shao , Qiao Ma , Bin Chen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 3/3] net: hinic: Add support for configuration of rx-vlan-filter by ethtool Date: Thu, 3 Nov 2022 16:05:11 +0800 Message-Id: <20221103080525.26885-3-cai.huoqing@linux.dev> In-Reply-To: <20221103080525.26885-1-cai.huoqing@linux.dev> References: <20221103080525.26885-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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?1748461792677411610?= X-GMAIL-MSGID: =?utf-8?q?1748461792677411610?= When ethtool config rx-vlan-filter, the driver will send control command to firmware, then set to hardware in this patch. Signed-off-by: Cai Huoqing --- v1->v3: 1.Merge this patch to the series. comments link: https://lore.kernel.org/lkml/20221101214059.464a1d42@kernel.org/ .../net/ethernet/huawei/hinic/hinic_main.c | 10 ++++++ .../net/ethernet/huawei/hinic/hinic_port.c | 33 +++++++++++++++++++ .../net/ethernet/huawei/hinic/hinic_port.h | 12 +++++++ 3 files changed, 55 insertions(+) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 9d4d795e1081..977c41473ab7 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -1092,6 +1092,16 @@ static int set_features(struct hinic_dev *nic_dev, } } + if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { + ret = hinic_set_vlan_fliter(nic_dev, + !!(features & + NETIF_F_HW_VLAN_CTAG_FILTER)); + if (ret) { + err = ret; + failed_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + } + } + if (err) { nic_dev->netdev->features = features ^ failed_features; return -EIO; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port.c b/drivers/net/ethernet/huawei/hinic/hinic_port.c index 0a39c3dffa9a..9406237c461e 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_port.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_port.c @@ -447,6 +447,39 @@ int hinic_set_rx_vlan_offload(struct hinic_dev *nic_dev, u8 en) return 0; } +int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en) +{ + struct hinic_hwdev *hwdev = nic_dev->hwdev; + struct hinic_hwif *hwif = hwdev->hwif; + struct pci_dev *pdev = hwif->pdev; + struct hinic_vlan_filter vlan_filter; + u16 out_size = sizeof(vlan_filter); + int err; + + if (!hwdev) + return -EINVAL; + + vlan_filter.func_idx = HINIC_HWIF_FUNC_IDX(hwif); + vlan_filter.enable = en; + + err = hinic_port_msg_cmd(hwdev, HINIC_PORT_CMD_SET_VLAN_FILTER, + &vlan_filter, sizeof(vlan_filter), + &vlan_filter, &out_size); + if (vlan_filter.status == HINIC_MGMT_CMD_UNSUPPORTED) { + err = HINIC_MGMT_CMD_UNSUPPORTED; + } else if ((err == HINIC_MBOX_VF_CMD_ERROR) && + HINIC_IS_VF(hwif)) { + err = HINIC_MGMT_CMD_UNSUPPORTED; + } else if (err || !out_size || vlan_filter.status) { + dev_err(&pdev->dev, + "Failed to set vlan fliter, err: %d, status: 0x%x, out size: 0x%x\n", + err, vlan_filter.status, out_size); + err = -EINVAL; + } + + return err; +} + int hinic_set_max_qnum(struct hinic_dev *nic_dev, u8 num_rqs) { struct hinic_hwdev *hwdev = nic_dev->hwdev; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port.h b/drivers/net/ethernet/huawei/hinic/hinic_port.h index c9ae3d4dc547..c8694ac7c702 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_port.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_port.h @@ -351,6 +351,16 @@ struct hinic_vlan_cfg { u8 rsvd1[5]; }; +struct hinic_vlan_filter { + u8 status; + u8 version; + u8 rsvd0[6]; + + u16 func_idx; + u8 rsvd1[2]; + u32 enable; +}; + struct hinic_rss_template_mgmt { u8 status; u8 version; @@ -831,6 +841,8 @@ int hinic_get_vport_stats(struct hinic_dev *nic_dev, int hinic_set_rx_vlan_offload(struct hinic_dev *nic_dev, u8 en); +int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en); + int hinic_get_mgmt_version(struct hinic_dev *nic_dev, u8 *mgmt_ver); int hinic_set_link_settings(struct hinic_hwdev *hwdev,