{"id":816814,"url":"http://patchwork.ozlabs.org/api/patches/816814/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1505992913-107256-9-git-send-email-linyunsheng@huawei.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505992913-107256-9-git-send-email-linyunsheng@huawei.com>","list_archive_url":null,"date":"2017-09-21T11:21:51","name":"[net-next,08/10] net: hns3: Add dcb netlink interface for the support of DCB feature","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"d63d1ce3654fe66844620712d2024ac9423e456c","submitter":{"id":71804,"url":"http://patchwork.ozlabs.org/api/people/71804/?format=json","name":"Yunsheng Lin","email":"linyunsheng@huawei.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1505992913-107256-9-git-send-email-linyunsheng@huawei.com/mbox/","series":[{"id":4360,"url":"http://patchwork.ozlabs.org/api/series/4360/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4360","date":"2017-09-21T11:21:52","name":"Add support for DCB feature in hns3 driver","version":1,"mbox":"http://patchwork.ozlabs.org/series/4360/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816814/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816814/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyZ3n5Qm8z9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 21:23:17 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751873AbdIULW0 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 21 Sep 2017 07:22:26 -0400","from szxga04-in.huawei.com ([45.249.212.190]:6957 \"EHLO\n\tszxga04-in.huawei.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751797AbdIULWW (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 21 Sep 2017 07:22:22 -0400","from 172.30.72.60 (EHLO DGGEMS408-HUB.china.huawei.com)\n\t([172.30.72.60])\n\tby dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DHR44640; Thu, 21 Sep 2017 19:22:20 +0800 (CST)","from localhost.localdomain (10.67.212.75) by\n\tDGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP\n\tServer id 14.3.301.0; Thu, 21 Sep 2017 19:22:10 +0800"],"From":"Yunsheng Lin <linyunsheng@huawei.com>","To":"<davem@davemloft.net>","CC":"<huangdaode@hisilicon.com>, <xuwei5@hisilicon.com>,\n\t<liguozhu@hisilicon.com>, <Yisen.Zhuang@huawei.com>,\n\t<gabriele.paoloni@huawei.com>, <john.garry@huawei.com>,\n\t<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,\n\t<salil.mehta@huawei.com>, <lipeng321@huawei.com>,\n\t<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>","Subject":"[PATCH net-next 08/10] net: hns3: Add dcb netlink interface for the\n\tsupport of DCB feature","Date":"Thu, 21 Sep 2017 19:21:51 +0800","Message-ID":"<1505992913-107256-9-git-send-email-linyunsheng@huawei.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1505992913-107256-1-git-send-email-linyunsheng@huawei.com>","References":"<1505992913-107256-1-git-send-email-linyunsheng@huawei.com>","MIME-Version":"1.0","Content-Type":"text/plain","X-Originating-IP":"[10.67.212.75]","X-CFilter-Loop":"Reflected","X-Mirapoint-Virus-RAPID-Raw":"score=unknown(0),\n\trefid=str=0001.0A090204.59C3A0EC.01F6, ss=1, re=0.000, recu=0.000,\n\treip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0,\n\tso=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32","X-Mirapoint-Loop-Id":"bc9363adfe9b1614411c27cbc6ebdad7","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"This patch add dcb netlink interface by calling the interface from\nhclge_dcb module.\n\nThis patch also update Makefile in order to build hns3_dcbnl module.\n\nSigned-off-by: Yunsheng Lin <linyunsheng@huawei.com>\n---\n .../net/ethernet/hisilicon/hns3/hns3pf/Makefile    |   2 +\n .../ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c    | 106 +++++++++++++++++++++\n .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c |   2 +\n .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h |   7 ++\n 4 files changed, 117 insertions(+)\n create mode 100644 drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c","diff":"diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile b/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile\nindex 7023dc87..d2b20d0 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile\n@@ -11,3 +11,5 @@ hclge-$(CONFIG_HNS3_DCB) += hclge_dcb.o\n \n obj-$(CONFIG_HNS3_ENET) += hns3.o\n hns3-objs = hns3_enet.o hns3_ethtool.o\n+\n+hns3-$(CONFIG_HNS3_DCB) += hns3_dcbnl.o\ndiff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c\nnew file mode 100644\nindex 0000000..9832172\n--- /dev/null\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c\n@@ -0,0 +1,106 @@\n+/*\n+ * Copyright (c) 2016-2017 Hisilicon Limited.\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ */\n+\n+#include \"hnae3.h\"\n+#include \"hns3_enet.h\"\n+\n+static\n+int hns3_dcbnl_ieee_getets(struct net_device *ndev, struct ieee_ets *ets)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (h->kinfo.dcb_ops->ieee_getets)\n+\t\treturn h->kinfo.dcb_ops->ieee_getets(h, ets);\n+\n+\treturn -EOPNOTSUPP;\n+}\n+\n+static\n+int hns3_dcbnl_ieee_setets(struct net_device *ndev, struct ieee_ets *ets)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (h->kinfo.dcb_ops->ieee_setets)\n+\t\treturn h->kinfo.dcb_ops->ieee_setets(h, ets);\n+\n+\treturn -EOPNOTSUPP;\n+}\n+\n+static\n+int hns3_dcbnl_ieee_getpfc(struct net_device *ndev, struct ieee_pfc *pfc)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (h->kinfo.dcb_ops->ieee_getpfc)\n+\t\treturn h->kinfo.dcb_ops->ieee_getpfc(h, pfc);\n+\n+\treturn -EOPNOTSUPP;\n+}\n+\n+static\n+int hns3_dcbnl_ieee_setpfc(struct net_device *ndev, struct ieee_pfc *pfc)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (h->kinfo.dcb_ops->ieee_setpfc)\n+\t\treturn h->kinfo.dcb_ops->ieee_setpfc(h, pfc);\n+\n+\treturn -EOPNOTSUPP;\n+}\n+\n+/* DCBX configuration */\n+static u8 hns3_dcbnl_getdcbx(struct net_device *ndev)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (h->kinfo.dcb_ops->getdcbx)\n+\t\treturn h->kinfo.dcb_ops->getdcbx(h);\n+\n+\treturn 0;\n+}\n+\n+/* return 0 if successful, otherwise fail */\n+static u8 hns3_dcbnl_setdcbx(struct net_device *ndev, u8 mode)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (h->kinfo.dcb_ops->setdcbx)\n+\t\treturn h->kinfo.dcb_ops->setdcbx(h, mode);\n+\n+\treturn 1;\n+}\n+\n+static const struct dcbnl_rtnl_ops hns3_dcbnl_ops = {\n+\t.ieee_getets\t= hns3_dcbnl_ieee_getets,\n+\t.ieee_setets\t= hns3_dcbnl_ieee_setets,\n+\t.ieee_getpfc\t= hns3_dcbnl_ieee_getpfc,\n+\t.ieee_setpfc\t= hns3_dcbnl_ieee_setpfc,\n+\t.getdcbx\t= hns3_dcbnl_getdcbx,\n+\t.setdcbx\t= hns3_dcbnl_setdcbx,\n+};\n+\n+/* hclge_dcbnl_setup - DCBNL setup\n+ * @handle: the corresponding vport handle\n+ * Set up DCBNL\n+ */\n+void hns3_dcbnl_setup(struct hnae3_handle *handle)\n+{\n+\tstruct net_device *dev = handle->kinfo.netdev;\n+\n+\tif (!handle->kinfo.dcb_ops)\n+\t\treturn;\n+\n+\tdev->dcbnl_ops = &hns3_dcbnl_ops;\n+}\ndiff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\nindex 35369e1..11dab26 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n@@ -2790,6 +2790,8 @@ static int hns3_client_init(struct hnae3_handle *handle)\n \t\tgoto out_reg_netdev_fail;\n \t}\n \n+\thns3_dcbnl_setup(handle);\n+\n \t/* MTU range: (ETH_MIN_MTU(kernel default) - 9706) */\n \tnetdev->max_mtu = HNS3_MAX_MTU - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);\n \ndiff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h\nindex 7e87461..481eada 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h\n@@ -590,4 +590,11 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)\n void hns3_ethtool_set_ops(struct net_device *netdev);\n \n int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);\n+\n+#ifdef CONFIG_HNS3_DCB\n+void hns3_dcbnl_setup(struct hnae3_handle *handle);\n+#else\n+static inline void hns3_dcbnl_setup(struct hnae3_handle *handle) {}\n+#endif\n+\n #endif\n","prefixes":["net-next","08/10"]}