{"id":833360,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833360/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1509631100-31822-1-git-send-email-ganeshgr@chelsio.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/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":"<1509631100-31822-1-git-send-email-ganeshgr@chelsio.com>","list_archive_url":null,"date":"2017-11-02T13:58:20","name":"[net-next] cxgb4vf: define get_fecparam ethtool callback","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"c5eaa2e7f405248e015e7fcf29447846797d593c","submitter":{"id":69424,"url":"http://patchwork.ozlabs.org/api/1.2/people/69424/?format=json","name":"Ganesh Goudar","email":"ganeshgr@chelsio.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1509631100-31822-1-git-send-email-ganeshgr@chelsio.com/mbox/","series":[{"id":11508,"url":"http://patchwork.ozlabs.org/api/1.2/series/11508/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=11508","date":"2017-11-02T13:58:20","name":"[net-next] cxgb4vf: define get_fecparam ethtool callback","version":1,"mbox":"http://patchwork.ozlabs.org/series/11508/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833360/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833360/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 3ySRWc4WMdz9t2M\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  3 Nov 2017 00:58:36 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933356AbdKBN6e (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 2 Nov 2017 09:58:34 -0400","from stargate.chelsio.com ([12.32.117.8]:20632 \"EHLO\n\tstargate.chelsio.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S933123AbdKBN6c (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 2 Nov 2017 09:58:32 -0400","from localhost (victim.blr.asicdesigners.com [10.193.185.129])\n\tby stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id vA2DwM0l009886; \n\tThu, 2 Nov 2017 06:58:22 -0700"],"From":"Ganesh Goudar <ganeshgr@chelsio.com>","To":"netdev@vger.kernel.org, davem@davemloft.net","Cc":"nirranjan@chelsio.com, indranil@chelsio.com, venkatesh@chelsio.com,\n\tGanesh Goudar <ganeshgr@chelsio.com>","Subject":"[PATCH net-next] cxgb4vf: define get_fecparam ethtool callback","Date":"Thu,  2 Nov 2017 19:28:20 +0530","Message-Id":"<1509631100-31822-1-git-send-email-ganeshgr@chelsio.com>","X-Mailer":"git-send-email 2.1.0","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Add support to new ethtool operation get_fecparam to\nfetch FEC parameters.\n\nOriginal Work by: Casey Leedom <leedom@chelsio.com>\nSigned-off-by: Ganesh Goudar <ganeshgr@chelsio.com>\n---\n .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c    | 58 ++++++++++++++++++++++\n 1 file changed, 58 insertions(+)","diff":"diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c\nindex 8996ebb..b48361c 100644\n--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c\n+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c\n@@ -1401,6 +1401,63 @@ static int cxgb4vf_get_link_ksettings(struct net_device *dev,\n \treturn 0;\n }\n \n+/* Translate the Firmware FEC value into the ethtool value. */\n+static inline unsigned int fwcap_to_eth_fec(unsigned int fw_fec)\n+{\n+\tunsigned int eth_fec = 0;\n+\n+\tif (fw_fec & FW_PORT_CAP32_FEC_RS)\n+\t\teth_fec |= ETHTOOL_FEC_RS;\n+\tif (fw_fec & FW_PORT_CAP32_FEC_BASER_RS)\n+\t\teth_fec |= ETHTOOL_FEC_BASER;\n+\n+\t/* if nothing is set, then FEC is off */\n+\tif (!eth_fec)\n+\t\teth_fec = ETHTOOL_FEC_OFF;\n+\n+\treturn eth_fec;\n+}\n+\n+/* Translate Common Code FEC value into ethtool value. */\n+static inline unsigned int cc_to_eth_fec(unsigned int cc_fec)\n+{\n+\tunsigned int eth_fec = 0;\n+\n+\tif (cc_fec & FEC_AUTO)\n+\t\teth_fec |= ETHTOOL_FEC_AUTO;\n+\tif (cc_fec & FEC_RS)\n+\t\teth_fec |= ETHTOOL_FEC_RS;\n+\tif (cc_fec & FEC_BASER_RS)\n+\t\teth_fec |= ETHTOOL_FEC_BASER;\n+\n+\t/* if nothing is set, then FEC is off */\n+\tif (!eth_fec)\n+\t\teth_fec = ETHTOOL_FEC_OFF;\n+\n+\treturn eth_fec;\n+}\n+\n+static int cxgb4vf_get_fecparam(struct net_device *dev,\n+\t\t\t\tstruct ethtool_fecparam *fec)\n+{\n+\tconst struct port_info *pi = netdev_priv(dev);\n+\tconst struct link_config *lc = &pi->link_cfg;\n+\n+\t/* Translate the Firmware FEC Support into the ethtool value.  We\n+\t * always support IEEE 802.3 \"automatic\" selection of Link FEC type if\n+\t * any FEC is supported.\n+\t */\n+\tfec->fec = fwcap_to_eth_fec(lc->pcaps);\n+\tif (fec->fec != ETHTOOL_FEC_OFF)\n+\t\tfec->fec |= ETHTOOL_FEC_AUTO;\n+\n+\t/* Translate the current internal FEC parameters into the\n+\t * ethtool values.\n+\t */\n+\tfec->active_fec = cc_to_eth_fec(lc->fec);\n+\treturn 0;\n+}\n+\n /*\n  * Return our driver information.\n  */\n@@ -1774,6 +1831,7 @@ static void cxgb4vf_get_wol(struct net_device *dev,\n \n static const struct ethtool_ops cxgb4vf_ethtool_ops = {\n \t.get_link_ksettings\t= cxgb4vf_get_link_ksettings,\n+\t.get_fecparam\t\t= cxgb4vf_get_fecparam,\n \t.get_drvinfo\t\t= cxgb4vf_get_drvinfo,\n \t.get_msglevel\t\t= cxgb4vf_get_msglevel,\n \t.set_msglevel\t\t= cxgb4vf_set_msglevel,\n","prefixes":["net-next"]}