From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, PDS_BTC_ID,PDS_BTC_MSGID,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 0C76CC432C0 for ; Tue, 3 Dec 2019 15:11:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C757F2068E for ; Tue, 3 Dec 2019 15:11:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GaTF90Ni" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbfLCPLm (ORCPT ); Tue, 3 Dec 2019 10:11:42 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:38245 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbfLCPLl (ORCPT ); Tue, 3 Dec 2019 10:11:41 -0500 Received: by mail-lj1-f194.google.com with SMTP id k8so4238243ljh.5 for ; Tue, 03 Dec 2019 07:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=K8tafk5S1peTqaHLhmqRxbvDN3I0h3xsqtkwOGZ+zKY=; b=GaTF90NiF1D8heJ0stwa1iZGpKbu08CfvHVQ2VkL7GocRvtNH1ahrEQpTpxDeA4dpi eX0yDIpXGV4GUX1f/4pg8TNqB/V5bmocvman+JJTeNPZ2Dm8IWBccOvuP08izAx9hb/k YdUm6psRp824Sq1WSMQEVXR8ro8IAgQsbSWrIPqLuLzkfcG8dCr0ltHE0wqHMDysd33t fB86I7UoIXRzpBIAAMaY2iHZ3TYEfcg7nlKL0wgEeiQ4V4QkCX+I6KQwbV9/hT+bV8Pm uD6FKpYyB6DhkOPAv1zSh2xUl5H5LlQn2FpljjXSW0Xsg5gf6/BGwGJeUJPSbuYLSHRL QBkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=K8tafk5S1peTqaHLhmqRxbvDN3I0h3xsqtkwOGZ+zKY=; b=njS6CBJFpoHVzx3WdEWYeFqo7AWbpeHretRkS3VSOp+7PE+o9ziTbQ8IjCk3q/SGPB 97m/3KI2+ZzzAeCYBD2IJpv9XhISEH6yRMbRHTWKR0H+oXLH4EdEWEHiSXOEobm705Fz kA93JwsG+ogGcWCoDgYhDVazMrZnwU9YS45Ki5wlN03+LXAC55Bn/45OUE6BDa5AT64W 8/8skizn07nnuZntPSCt97E6jwuDi3bqQv0EaTyMzBa9UdObNRb7/CpbwBbgna2VeSjJ J9w6gKf4TFlV4sxCTEbEuOWj6eebZBaQkYV+aSuymCvE2QidziPRBcpPeFCLIyQJGsfx Cr0g== X-Gm-Message-State: APjAAAWpDoibPhwjd0/I6yXO81hDCb40H7WNhuaOEvWrZgB13lMtb+EW Faj+fWd/CNT8eE3TOQV2Xy2htQ== X-Google-Smtp-Source: APXvYqzEAh+Y/SQ8dt9S7s3S+/gai+RxyGx911W+vSCAwUS6BS64XRlTLzKR9euGboindzME1aDYkw== X-Received: by 2002:a2e:9684:: with SMTP id q4mr2975607lji.242.1575385898821; Tue, 03 Dec 2019 07:11:38 -0800 (PST) Received: from khorivan (57-201-94-178.pool.ukrtel.net. [178.94.201.57]) by smtp.gmail.com with ESMTPSA id s7sm1507072ljo.43.2019.12.03.07.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 07:11:38 -0800 (PST) Date: Tue, 3 Dec 2019 17:11:34 +0200 From: Ivan Khoronzhuk To: Po Liu Cc: "davem@davemloft.net" , "hauke.mehrtens@intel.com" , "gregkh@linuxfoundation.org" , "allison@lohutok.net" , "tglx@linutronix.de" , "hkallweit1@gmail.com" , "saeedm@mellanox.com" , "andrew@lunn.ch" , "f.fainelli@gmail.com" , "alexandru.ardelean@analog.com" , "jiri@mellanox.com" , "ayal@mellanox.com" , "pablo@netfilter.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "vinicius.gomes@intel.com" , "simon.horman@netronome.com" , Claudiu Manoil , Vladimir Oltean , Alexandru Marginean , Xiaoliang Yang , Roy Zang , Mingkai Hu , Jerry Huang , Leo Li Subject: Re: [v1,net-next, 1/2] ethtool: add setting frame preemption of traffic classes Message-ID: <20191203151133.GB2680@khorivan> Mail-Followup-To: Po Liu , "davem@davemloft.net" , "hauke.mehrtens@intel.com" , "gregkh@linuxfoundation.org" , "allison@lohutok.net" , "tglx@linutronix.de" , "hkallweit1@gmail.com" , "saeedm@mellanox.com" , "andrew@lunn.ch" , "f.fainelli@gmail.com" , "alexandru.ardelean@analog.com" , "jiri@mellanox.com" , "ayal@mellanox.com" , "pablo@netfilter.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "vinicius.gomes@intel.com" , "simon.horman@netronome.com" , Claudiu Manoil , Vladimir Oltean , Alexandru Marginean , Xiaoliang Yang , Roy Zang , Mingkai Hu , Jerry Huang , Leo Li References: <20191127094517.6255-1-Po.Liu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191127094517.6255-1-Po.Liu@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 27, 2019 at 09:59:18AM +0000, Po Liu wrote: Hi, Po Liu >IEEE Std 802.1Qbu standard defined the frame preemption of port >traffic classes. This patch introduce a method to set traffic >classes preemption. Add a parameter 'preemption' in struct >ethtool_link_settings. The value will be translated to a binary, >each bit represent a traffic class. Bit "1" means preemptable >traffic class. Bit "0" means express traffic class. MSB represent >high number traffic class. > >If hardware support the frame preemption, driver could set the >ethernet device with hw_features and features with NETIF_F_PREEMPTION >when initializing the port driver. > >User can check the feature 'tx-preemption' by command 'ethtool -k >devname'. If hareware set preemption feature. The property would >be a fixed value 'on' if hardware support the frame preemption. >Feature would show a fixed value 'off' if hardware don't support >the frame preemption. > >Command 'ethtool devname' and 'ethtool -s devname preemption N' >would show/set which traffic classes are frame preemptable. > >Port driver would implement the frame preemption in the function >get_link_ksettings() and set_link_ksettings() in the struct ethtool_ops. > >Signed-off-by: Po Liu >--- > include/linux/netdev_features.h | 5 ++++- > include/uapi/linux/ethtool.h | 5 ++++- > net/core/ethtool.c | 1 + > 3 files changed, 9 insertions(+), 2 deletions(-) > >diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h >index 4b19c544c59a..299750a8b414 100644 >--- a/include/linux/netdev_features.h >+++ b/include/linux/netdev_features.h >@@ -80,6 +80,7 @@ enum { > > NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */ > NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ >+ NETIF_F_HW_PREEMPTION_BIT, /* Hardware TC frame preemption */ > > /* > * Add your fresh new feature above and remember to update >@@ -150,6 +151,7 @@ enum { > #define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4) > #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) > #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) >+#define NETIF_F_PREEMPTION __NETIF_F(HW_PREEMPTION) > > /* Finds the next feature with the highest number of the range of start till 0. > */ >@@ -175,7 +177,8 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) > /* Features valid for ethtool to change */ > /* = all defined minus driver/device-class-related */ > #define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ >- NETIF_F_LLTX | NETIF_F_NETNS_LOCAL) >+ NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | \ >+ NETIF_F_PREEMPTION) > > /* remember that ((t)1 << t_BITS) is undefined in C99 */ > #define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \ >diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h >index d4591792f0b4..12ffb34afbfa 100644 >--- a/include/uapi/linux/ethtool.h >+++ b/include/uapi/linux/ethtool.h >@@ -1776,6 +1776,8 @@ enum ethtool_reset_flags { > }; > #define ETH_RESET_SHARED_SHIFT 16 > >+/* Disable preemtion. */ >+#define PREEMPTION_DISABLE 0x0 > > /** > * struct ethtool_link_settings - link control and status >@@ -1886,7 +1888,8 @@ struct ethtool_link_settings { > __s8 link_mode_masks_nwords; > __u8 transceiver; > __u8 reserved1[3]; >- __u32 reserved[7]; >+ __u32 preemption; Why 32 when only 8 is needed? >+ __u32 reserved[6]; > __u32 link_mode_masks[0]; > /* layout of link_mode_masks fields: > * __u32 map_supported[link_mode_masks_nwords]; >diff --git a/net/core/ethtool.c b/net/core/ethtool.c >index cd9bc67381b2..6ffcd8a602b8 100644 >--- a/net/core/ethtool.c >+++ b/net/core/ethtool.c >@@ -111,6 +111,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] > [NETIF_F_HW_TLS_RECORD_BIT] = "tls-hw-record", > [NETIF_F_HW_TLS_TX_BIT] = "tls-hw-tx-offload", > [NETIF_F_HW_TLS_RX_BIT] = "tls-hw-rx-offload", >+ [NETIF_F_HW_PREEMPTION_BIT] = "tx-preemption", What about tx-frame-preempt? or frame-preemption? > }; > > static const char >-- >2.17.1 > -- Regards, Ivan Khoronzhuk