From patchwork Tue Mar 10 02:15:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 222790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61F7EC10F27 for ; Tue, 10 Mar 2020 02:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C6602146E for ; Tue, 10 Mar 2020 02:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583806532; bh=6bRE9PkgYVxymzD8kC9xhQkhNEMxK8hdIufntyLFnTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PUTEu5ftdbHtgMZoW5L09dgM0SjC2y0St9y8JFjFhALSNexEFuQ0jS1gnoh9fQZx1 gt409Gkp+FS/027CLopPrtc8YucR5kN78kv+HMFTLSpghEYTn7blmVVLhSjGbDmf32 QgoKh978roLkZlpguoie4EGsmpA7E8iTNSj6Od5k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbgCJCPb (ORCPT ); Mon, 9 Mar 2020 22:15:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726779AbgCJCP1 (ORCPT ); Mon, 9 Mar 2020 22:15:27 -0400 Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EAB7624654; Tue, 10 Mar 2020 02:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583806527; bh=6bRE9PkgYVxymzD8kC9xhQkhNEMxK8hdIufntyLFnTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvU3OyaThMhb1tgSm+TSKmGi4o7QcpigUqitrnIRNO6Lv854xGJE80ua4wIZAh9tu LzBR1w3zd7EXQKRwQ3GDTvFgOXSRoP07VwT0nhJ6bkdaWvuTNTJallW1XxF5AbAwy/ S/RncS0+SuzK7BXel08ONZu910sG6wY/+6D8maHU= From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, akiyano@amazon.com, netanel@amazon.com, gtzalik@amazon.com, irusskikh@marvell.com, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, rmody@marvell.com, GR-Linux-NIC-Dev@marvell.com, aelior@marvell.com, skalluru@marvell.com, GR-everest-linux-l2@marvell.com, opendmb@gmail.com, siva.kallam@broadcom.com, prashant@broadcom.com, mchan@broadcom.com, dchickles@marvell.com, sburla@marvell.com, fmanlunas@marvell.com, tariqt@mellanox.com, vishal@chelsio.com, leedom@chelsio.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, Jakub Kicinski Subject: [PATCH net-next 09/15] net: liquidio: reject unsupported coalescing params Date: Mon, 9 Mar 2020 19:15:06 -0700 Message-Id: <20200310021512.1861626-10-kuba@kernel.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200310021512.1861626-1-kuba@kernel.org> References: <20200310021512.1861626-1-kuba@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Set ethtool_ops->supported_coalesce_params to let the core reject unsupported coalescing parameters. This driver did not previously reject unsupported parameters. Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 11 +++++++++++ include/linux/ethtool.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c index 2b27e3aad9db..16eebfc52109 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c @@ -3097,7 +3097,17 @@ static int lio_set_fecparam(struct net_device *netdev, return 0; } +#define LIO_ETHTOOL_COALESCE (ETHTOOL_COALESCE_RX_USECS | \ + ETHTOOL_COALESCE_MAX_FRAMES | \ + ETHTOOL_COALESCE_USE_ADAPTIVE | \ + ETHTOOL_COALESCE_RX_MAX_FRAMES_LOW | \ + ETHTOOL_COALESCE_TX_MAX_FRAMES_LOW | \ + ETHTOOL_COALESCE_RX_MAX_FRAMES_HIGH | \ + ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH | \ + ETHTOOL_COALESCE_PKT_RATE_RX_USECS) + static const struct ethtool_ops lio_ethtool_ops = { + .supported_coalesce_params = LIO_ETHTOOL_COALESCE, .get_link_ksettings = lio_get_link_ksettings, .set_link_ksettings = lio_set_link_ksettings, .get_fecparam = lio_get_fecparam, @@ -3128,6 +3138,7 @@ static const struct ethtool_ops lio_ethtool_ops = { }; static const struct ethtool_ops lio_vf_ethtool_ops = { + .supported_coalesce_params = LIO_ETHTOOL_COALESCE, .get_link_ksettings = lio_get_link_ksettings, .get_link = ethtool_op_get_link, .get_drvinfo = lio_get_vf_drvinfo, diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index e464c946bca4..9efeebde3514 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -211,6 +211,11 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ) #define ETHTOOL_COALESCE_USE_ADAPTIVE \ (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | ETHTOOL_COALESCE_USE_ADAPTIVE_TX) +#define ETHTOOL_COALESCE_PKT_RATE_RX_USECS \ + (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | \ + ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_RX_USECS_HIGH | \ + ETHTOOL_COALESCE_PKT_RATE_LOW | ETHTOOL_COALESCE_PKT_RATE_HIGH | \ + ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL) /** * struct ethtool_ops - optional netdev operations