From patchwork Tue Jul 29 11:40:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govindarajulu Varadarajan <_govind@gmx.com> X-Patchwork-Id: 374440 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A5CD1140185 for ; Tue, 29 Jul 2014 21:41:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753510AbaG2Llp (ORCPT ); Tue, 29 Jul 2014 07:41:45 -0400 Received: from mout.gmx.com ([74.208.4.201]:56930 "EHLO mout.gmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753487AbaG2Lln (ORCPT ); Tue, 29 Jul 2014 07:41:43 -0400 Received: from ws.cisco.com ([72.163.216.217]) by mail.gmx.com (mrgmxus001) with ESMTPSA (Nemesis) id 0Lpt5t-1WWSRA3fbL-00fj9G; Tue, 29 Jul 2014 13:41:40 +0200 From: Govindarajulu Varadarajan <_govind@gmx.com> To: davem@davemloft.net, ben@decadent.org.uk, netdev@vger.kernel.org Cc: ssujith@cisco.com, benve@cisco.com, Govindarajulu Varadarajan <_govind@gmx.com> Subject: [PATCH net-next v2 3/3] enic: add ethtool support set/show rx_copybreak Date: Tue, 29 Jul 2014 17:10:39 +0530 Message-Id: <1406634039-15030-4-git-send-email-_govind@gmx.com> X-Mailer: git-send-email 2.0.3 In-Reply-To: <1406634039-15030-1-git-send-email-_govind@gmx.com> References: <1406634039-15030-1-git-send-email-_govind@gmx.com> X-Provags-ID: V03:K0:vBeCZvSu4SG8624hZoXvRYDN0/C9Ndd/w0/W6p7JpUMF9bhnmo6 UHHG/7q/wEnwZFZkX+WKkY0XkW6VmHgMXiBSwFeZoygajZ4kq/rk1LUtqYOopeeOSg0xnD6 foOpprQ9TmQmHMRaGpKyhDKbkk98bH3Vx00RU3F3/IYyG+nXRpDuW3iN7UNxYlkvD1vSWJY E1j4/E26RiCgSzs6H/m4A== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add ethtools support for get/set_buffparam. This is used to set the driver rx_copybreak value. Do not allow rx_copybreak value to be set more than max frame size. Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com> --- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c index 523c9ce..4c9eb52 100644 --- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c +++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c @@ -18,6 +18,7 @@ #include #include +#include #include "enic_res.h" #include "enic.h" @@ -379,6 +380,27 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, return ret; } +static void enic_get_buffparam(struct net_device *netdev, + struct ethtool_buffparam *data) +{ + struct enic *enic = netdev_priv(netdev); + + data->rx_copybreak_cur = enic->rx_copybreak; + data->rx_copybreak_max = netdev->mtu + VLAN_ETH_HLEN; +} + +static int enic_set_buffparam(struct net_device *netdev, + struct ethtool_buffparam *data) +{ + struct enic *enic = netdev_priv(netdev); + + if (data->rx_copybreak_cur > netdev->mtu + VLAN_ETH_HLEN) + return -EINVAL; + enic->rx_copybreak = data->rx_copybreak_cur; + + return 0; +} + static const struct ethtool_ops enic_ethtool_ops = { .get_settings = enic_get_settings, .get_drvinfo = enic_get_drvinfo, @@ -391,6 +413,8 @@ static const struct ethtool_ops enic_ethtool_ops = { .get_coalesce = enic_get_coalesce, .set_coalesce = enic_set_coalesce, .get_rxnfc = enic_get_rxnfc, + .get_buffparam = enic_get_buffparam, + .set_buffparam = enic_set_buffparam, }; void enic_set_ethtool_ops(struct net_device *netdev)