From patchwork Wed Sep 19 17:29:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147036 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp986924ljw; Wed, 19 Sep 2018 10:31:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaeQ6cBBbUSLhvhKsoaji6E7kSSc0+UT8ZpIHzv9OnvCgULYMDr7PqvP6W1T23s/wV4jraM X-Received: by 2002:a17:902:e190:: with SMTP id cd16-v6mr35338943plb.305.1537378281895; Wed, 19 Sep 2018 10:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537378281; cv=none; d=google.com; s=arc-20160816; b=akat8B0o8upHIZ7Zop1hCrp95/Cw9C4v4KbIbkn+onZA86yLpPurOXGr8rF3Jlt8Mt RD175EZV7gOHHVJEHsNNeK+ZEaWmqO5GpLsMVNw0DboCzDM5jUxoLoDDKC3QgM8JfT8Y r6520zH+HDJDyRWVYWotDFmSHZKBjRH1K+wDz6KhPjExBcy54FsxOzW4+pxwSOgycxAR tRf4TITtQVKQxDPSXA8Ug2uX4ZzYFokGBd2/TY7SUT6uKoDwrCxKxYh/6H0GpQTGV/IH u5frsgGIzZHTftkC0HGHGUVIVyak4N9KFEdBTvDsXkmrbkEO7WhpxOMByjAsBSAHSWa6 lAdg== 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; bh=esfVP99pwN5ZaGjwhq0OoEPsOI2PW0rc9Ku8yup2V1o=; b=cQBynowbWtbP6J6qZdOYbT5wJLAajyo5E2raqQOg61wICy+jRL4MYZdWHOEj+iEwRq W931lioqxnILazcJ5rRz1VqCGlyU68uRbV1w3zJ//aCiaXHQPKfZP0JHQbvXQGoBsZuG uydR9gZtIAr0uHJIDS2+E9vClB5P06RwFosGpRuTlbd8katOP8VBJPrDGe8xuBD/x8Yx kPFXAeJ6dAtDmrbszgF3A43bP8PTit/aGf7i1qlRuwEYvReI11L75XnTc/rtkYzlTr8A yMSTg9jWOkMBUjb6LA1ZOSud9Jwky7/t8U+8d20lnk0HkNJFudCZMPMnU08M+tN1fPm5 PV2A== 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 71-v6si23361487pla.92.2018.09.19.10.31.21; Wed, 19 Sep 2018 10:31:21 -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 S1733195AbeISXKO (ORCPT + 32 others); Wed, 19 Sep 2018 19:10:14 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12208 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732969AbeISXKN (ORCPT ); Wed, 19 Sep 2018 19:10:13 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 31660BB239529; Thu, 20 Sep 2018 01:31:13 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.399.0; Thu, 20 Sep 2018 01:31:06 +0800 From: Salil Mehta To: CC: , , , , , , , Xi Wang Subject: [PATCH net-next 05/12] net: hns3: Add support for hns3_nic_netdev_ops.ndo_do_ioctl Date: Wed, 19 Sep 2018 18:29:51 +0100 Message-ID: <20180919172958.12992-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180919172958.12992-1-salil.mehta@huawei.com> References: <20180919172958.12992-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xi Wang This patch adds the .ndo_do_ioctl net_device_ops operation to support the PHY MII ioctl for PF driver. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Xi Wang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 ++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 15 +++++++++++++++ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 13 +++++++++++++ 3 files changed, 30 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 67befff..c48c187 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -337,6 +337,8 @@ struct hnae3_ae_ops { void (*get_mac_addr)(struct hnae3_handle *handle, u8 *p); int (*set_mac_addr)(struct hnae3_handle *handle, void *p, bool is_first); + int (*do_ioctl)(struct hnae3_handle *handle, + struct ifreq *ifr, int cmd); int (*add_uc_addr)(struct hnae3_handle *handle, const unsigned char *addr); int (*rm_uc_addr)(struct hnae3_handle *handle, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 99209a0..e404130 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1239,6 +1239,20 @@ static int hns3_nic_net_set_mac_address(struct net_device *netdev, void *p) return 0; } +static int hns3_nic_do_ioctl(struct net_device *netdev, + struct ifreq *ifr, int cmd) +{ + struct hnae3_handle *h = hns3_get_handle(netdev); + + if (!netif_running(netdev)) + return -EINVAL; + + if (!h->ae_algo->ops->do_ioctl) + return -EOPNOTSUPP; + + return h->ae_algo->ops->do_ioctl(h, ifr, cmd); +} + static int hns3_nic_set_features(struct net_device *netdev, netdev_features_t features) { @@ -1565,6 +1579,7 @@ static const struct net_device_ops hns3_nic_netdev_ops = { .ndo_start_xmit = hns3_nic_net_xmit, .ndo_tx_timeout = hns3_nic_net_timeout, .ndo_set_mac_address = hns3_nic_net_set_mac_address, + .ndo_do_ioctl = hns3_nic_do_ioctl, .ndo_change_mtu = hns3_nic_change_mtu, .ndo_set_features = hns3_nic_set_features, .ndo_get_stats64 = hns3_nic_get_stats64, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index aececf5..ad15ba7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4308,6 +4308,18 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p, return 0; } +static int hclge_do_ioctl(struct hnae3_handle *handle, struct ifreq *ifr, + int cmd) +{ + struct hclge_vport *vport = hclge_get_vport(handle); + struct hclge_dev *hdev = vport->back; + + if (!hdev->hw.mac.phydev) + return -EOPNOTSUPP; + + return phy_mii_ioctl(hdev->hw.mac.phydev, ifr, cmd); +} + static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, bool filter_en) { @@ -5977,6 +5989,7 @@ static const struct hnae3_ae_ops hclge_ops = { .get_tc_size = hclge_get_tc_size, .get_mac_addr = hclge_get_mac_addr, .set_mac_addr = hclge_set_mac_addr, + .do_ioctl = hclge_do_ioctl, .add_uc_addr = hclge_add_uc_addr, .rm_uc_addr = hclge_rm_uc_addr, .add_mc_addr = hclge_add_mc_addr,