From patchwork Fri May 25 18:43:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136984 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3944136lji; Fri, 25 May 2018 11:45:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr4YKO+xeEB4irljTBz5rMVj5olj0gELw/7JxrIFSFPBx9+Kz+pDvi75qCFWM+iXGNmOK5q X-Received: by 2002:a62:b2d0:: with SMTP id z77-v6mr3715576pfl.122.1527273956893; Fri, 25 May 2018 11:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527273956; cv=none; d=google.com; s=arc-20160816; b=l+K6rpSikGmpnHQvrB/WpZdSI28AUdI907O6yPZ2Shbl6SgQDWqQWzkqliSlttv4d9 0ZOIPJJuAMDP9SaJdfvdC4XePN3+3Nct5JM5pRWxZguJsBTEOWD0oaA9rtOwGzVPKT/2 LOKj47S/VrmULqeuBO05sgyxb06rVUa+ax53DESxDII5Lhhm4r61zCZnGoG1amqiN0S8 pjVvXje94raydiJwYIknC/ZbL+O1t4tdjDQAHS1/nB5kXMIQ7w1ebUrJ4jlFiRC0ibaY rwTf5PRLVK0z9hfkPLoHkAgtOa6QPJKhwm3FtGhrArFFemf0t2oLKebLFEFfgd4GbsFu /f3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=b6/z9JDaMTA5FmoPdZflqq13174DJuCQAikK0+wrOxY=; b=WDxGYoUibq4R31mgJH6AYZuM8rec6ViW5zBinU3ZIYRXlVM3wjVZ4CsAEIdKBFmrxW tL0JzfXi83DimscrhNT1ZXDhZpdtNp9ccjZFRWkD4/o4dTCa9hW0bR7HDa+P7u2Dtl6K 6UTWa3fMPhG4DkXrQlbLTO/dPvnl2b+9ThYvzY3/KRQh99rSj4Ph+93tQuWQpKn0UVC/ 9j9opTT+vQCQ2P9zRn+BhUa4WeyoSrzcNYdJ9nS1lGSXazsmcm3GPZwVRJLqBYGSggU3 bmhc7mvCKsS72LJ+48kv60APsBfVJPl/clfPZEOSUKYLhQ3z7/ydwgGgZLlG2LrUinZ0 r8cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b37-v6si24273645plb.377.2018.05.25.11.45.56; Fri, 25 May 2018 11:45:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968271AbeEYSpy (ORCPT + 30 others); Fri, 25 May 2018 14:45:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8143 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S968165AbeEYSpO (ORCPT ); Fri, 25 May 2018 14:45:14 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 482CD9167E35B; Sat, 26 May 2018 02:45:01 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Sat, 26 May 2018 02:44:53 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 11/12] net: hns3: Adds support for led locate command for copper port Date: Fri, 25 May 2018 19:43:06 +0100 Message-ID: <20180525184307.36288-12-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180525184307.36288-1-salil.mehta@huawei.com> References: <20180525184307.36288-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen Firmware now supports control of all leds. Existing HNS3 driver code only supported led locate command over SFP Fibre ports. But now it is also supported over copper port. This patch removes existing not needed code for the led locate command and updates the led control command between driver and firmware. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 12 ++------ .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 35 +++------------------- 2 files changed, 6 insertions(+), 41 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index de2f6f1..d9aaa76 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -817,21 +817,13 @@ struct hclge_reset_cmd { #define HCLGE_NIC_CMQ_DESC_NUM 1024 #define HCLGE_NIC_CMQ_DESC_NUM_S 3 -#define HCLGE_LED_PORT_SPEED_STATE_S 0 -#define HCLGE_LED_PORT_SPEED_STATE_M GENMASK(5, 0) -#define HCLGE_LED_ACTIVITY_STATE_S 0 -#define HCLGE_LED_ACTIVITY_STATE_M GENMASK(1, 0) -#define HCLGE_LED_LINK_STATE_S 0 -#define HCLGE_LED_LINK_STATE_M GENMASK(1, 0) #define HCLGE_LED_LOCATE_STATE_S 0 #define HCLGE_LED_LOCATE_STATE_M GENMASK(1, 0) struct hclge_set_led_state_cmd { - u8 port_speed_led_config; - u8 link_led_config; - u8 activity_led_config; + u8 rsv1[3]; u8 locate_led_config; - u8 rsv[20]; + u8 rsv2[20]; }; int hclge_cmd_init(struct hclge_dev *hdev); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 20988aa..6916685 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5991,9 +5991,7 @@ static void hclge_get_regs(struct hnae3_handle *handle, u32 *version, "Get 64 bit register failed, ret = %d.\n", ret); } -static int hclge_set_led_status_sfp(struct hclge_dev *hdev, u8 speed_led_status, - u8 act_led_status, u8 link_led_status, - u8 locate_led_status) +static int hclge_set_led_status(struct hclge_dev *hdev, u8 locate_led_status) { struct hclge_set_led_state_cmd *req; struct hclge_desc desc; @@ -6002,12 +6000,6 @@ static int hclge_set_led_status_sfp(struct hclge_dev *hdev, u8 speed_led_status, hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_LED_STATUS_CFG, false); req = (struct hclge_set_led_state_cmd *)desc.data; - hnae_set_field(req->port_speed_led_config, HCLGE_LED_PORT_SPEED_STATE_M, - HCLGE_LED_PORT_SPEED_STATE_S, speed_led_status); - hnae_set_field(req->link_led_config, HCLGE_LED_ACTIVITY_STATE_M, - HCLGE_LED_ACTIVITY_STATE_S, act_led_status); - hnae_set_field(req->activity_led_config, HCLGE_LED_LINK_STATE_M, - HCLGE_LED_LINK_STATE_S, link_led_status); hnae_set_field(req->locate_led_config, HCLGE_LED_LOCATE_STATE_M, HCLGE_LED_LOCATE_STATE_S, locate_led_status); @@ -6028,36 +6020,17 @@ enum hclge_led_status { static int hclge_set_led_id(struct hnae3_handle *handle, enum ethtool_phys_id_state status) { -#define BLINK_FREQUENCY 2 struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - struct phy_device *phydev = hdev->hw.mac.phydev; - int ret = 0; - - if (phydev || hdev->hw.mac.media_type != HNAE3_MEDIA_TYPE_FIBER) - return -EOPNOTSUPP; switch (status) { case ETHTOOL_ID_ACTIVE: - ret = hclge_set_led_status_sfp(hdev, - HCLGE_LED_NO_CHANGE, - HCLGE_LED_NO_CHANGE, - HCLGE_LED_NO_CHANGE, - HCLGE_LED_ON); - break; + return hclge_set_led_status(hdev, HCLGE_LED_ON); case ETHTOOL_ID_INACTIVE: - ret = hclge_set_led_status_sfp(hdev, - HCLGE_LED_NO_CHANGE, - HCLGE_LED_NO_CHANGE, - HCLGE_LED_NO_CHANGE, - HCLGE_LED_OFF); - break; + return hclge_set_led_status(hdev, HCLGE_LED_OFF); default: - ret = -EINVAL; - break; + return -EINVAL; } - - return ret; } static void hclge_get_link_mode(struct hnae3_handle *handle,