Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1524840ybl; Tue, 3 Dec 2019 08:28:09 -0800 (PST) X-Google-Smtp-Source: APXvYqxonpR8l+VP+k2DwC0t+dnwIz21T8DJuytxmKKjC8KDlqj664CTvjqH5Q+OTaTlHVsC7pwW X-Received: by 2002:a05:6830:1cf:: with SMTP id r15mr3981418ota.231.1575390489453; Tue, 03 Dec 2019 08:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575390489; cv=none; d=google.com; s=arc-20160816; b=VnJxMXSn5ctCUk53Mled7TEKDHloufg1N3P3BlvhAcjHNSAf15kUECDmAXrpoCQLCX If5a0Tf/HlOeG+Tw/MG8SR8hQTUC+dJmOPwUcsOce34HpZJmgN0w0QSsgKa3TbpyhE8x UfTkaKow7A0WZlZQma6EuIDrcAlqlRkfQq2XdecIdWqZXjlX67E0JP23q2A8JPFUIZg2 mfEhN6Ofx19kw42KhefYR9zJE2v5B3xYRKe4z4RlY/LHuhQhIwfjuTPIfpykHf6qXXB0 iZAnhqbYMPmxdugetLC6r3hbc1sWdfayHEKg5/kuSq+Uc4fzwWxoxu24/0EKU0mFvril drYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=h9C2n+MHCjplzHYnNi07BHb4f1XYr4XT9zBJ/ZBs22c=; b=KOzsnYyD4457I4OG2lggVS0HsTgbo0TpfMrtVjZVMkZJC5gGRUsfWSoLprLxlGaszf kKSOJpgoKI2AQbxUJiIAgZ/rmMS38vH23R3EL1oFxwGdgKKdiFzApHoBF2eK9d6AWtJq FFYRxEzKxv3n/gJc1fURQonJ94NBkzZYGhomP8c0SyGcnKMtrFX66z/b2FPL5j2kKiHm LWwFyBM/kIovGxOMYjea2WdA1Dbh5yUMU6omKy4vkCw4x+WEfK3Y9Y+23zyApFOq5n3g sNk/UucNgbCwTKPQCVY5smoDTZEemeEzB+cTIdB9d+NMoEpQubGADKmgxU6cwsLcGLNK x4Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eIH8jyxl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si1652202oig.170.2019.12.03.08.27.56; Tue, 03 Dec 2019 08:28:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eIH8jyxl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727267AbfLCQ1I (ORCPT + 99 others); Tue, 3 Dec 2019 11:27:08 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35238 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727247AbfLCQ1H (ORCPT ); Tue, 3 Dec 2019 11:27:07 -0500 Received: by mail-lj1-f193.google.com with SMTP id j6so4560032lja.2 for ; Tue, 03 Dec 2019 08:27:04 -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=h9C2n+MHCjplzHYnNi07BHb4f1XYr4XT9zBJ/ZBs22c=; b=eIH8jyxl5W3h1DNl28UBcSMT9HKOFP7K3WZtBxuP8SA78R3JAGPhqIETRpC0p/0PnZ 6ImPtiSM2Iq25bO33IRP3XLGPaVqDgB1s0E3mSRYiYbP8aVzat/G+marOMRwudFknMnQ ytEA9H80R2CTGSCu//DBHTUsbUAF08b4h/sI6jZDdF96k7qplucYdFKMTZWQ7qdZa453 acmqwidQRarMm51DY4jWQi+whkoycdu+5FTudxuzELEVeKkkpjtrF8dY5or8cbSaKTKo XAGIDW5akXNKwp2q4Z4K41ydX/jGmBqn1tu1ddWK0VJJuXxHPpmHs3EvVByPDMkjIt/M qCVQ== 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=h9C2n+MHCjplzHYnNi07BHb4f1XYr4XT9zBJ/ZBs22c=; b=tbnY37C1fIqUg1T/PUyTBiwsgGfxIjCsvlYnKkuWQUbazeO9DAQMcXIa5XIBBfZwwI yBp6l1NGOMKGomOu/ui8aAgVGG2N3ge8ETqa6B8+HjKg/v/P9coSYIgP0X2vN5+v+poY Nn1N0XYYKh3yQJdL26WkbXGU+907OwCOswQ+k9LamgdFbG06KCqq/hxsCP6qk4rWfncl N+g9N+1UqZVZSeAHd3d388h2QZJW8O620tEt7nPnl/0dqaQen5z/ALHWF6WuyE2nNbiy Xnx+t5uS/gLNpsbRkEEgaKbEja3KzEydvGiZfYZHqgv0Pt00nqSr6g4nUMca0He7EBfv 7czA== X-Gm-Message-State: APjAAAUgkbcrpg3s55Ux3UWvQcx41rzvkszdM8vdTps1ojI6Mb9DfajV FkWUBAGFwqExdzEp3aApPKORVw== X-Received: by 2002:a05:651c:208:: with SMTP id y8mr3188448ljn.36.1575390424112; Tue, 03 Dec 2019 08:27:04 -0800 (PST) Received: from khorivan (57-201-94-178.pool.ukrtel.net. [178.94.201.57]) by smtp.gmail.com with ESMTPSA id f13sm1578745ljp.104.2019.12.03.08.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 08:27:03 -0800 (PST) Date: Tue, 3 Dec 2019 18:27:01 +0200 From: Ivan Khoronzhuk To: Po Liu Cc: "rmk+kernel@armlinux.org.uk" , "linville@tuxdriver.com" , "netdev-owner@vger.kernel.org" , "davem@davemloft.net" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "vinicius.gomes@intel.com" , "simon.horman@netronome.com" , Claudiu Manoil , Vladimir Oltean , Xiaoliang Yang , Roy Zang , Mingkai Hu , Jerry Huang , Leo Li Subject: Re: [v1,ethtool] ethtool: add setting frame preemption of traffic classes Message-ID: <20191203162659.GC2680@khorivan> Mail-Followup-To: Po Liu , "rmk+kernel@armlinux.org.uk" , "linville@tuxdriver.com" , "netdev-owner@vger.kernel.org" , "davem@davemloft.net" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "vinicius.gomes@intel.com" , "simon.horman@netronome.com" , Claudiu Manoil , Vladimir Oltean , Xiaoliang Yang , Roy Zang , Mingkai Hu , Jerry Huang , Leo Li References: <20191127094448.6206-1-Po.Liu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191127094448.6206-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:58:52AM +0000, Po Liu wrote: Hi Po Liu, >IEEE Std 802.1Qbu standard defined the frame preemption of port >trffic classes. User can set a value to hardware. 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. > >ethtool -k devname > >This command would show if the tx-preemption feature is available. >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. > >ethtool devname > >This command would show include an item 'preemption'. A following >value '0' means all traffic classes are 'express'. A value none zero >means traffic classes preemption capabilities. 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. > >ethtool -s devname preemption N What about other potential parameters like MAC fragment size, mac hold? Shouldn't be it considered along with other FP parameters to provide correct interface later? Say, preemption, lets name it fp-mask or frame-preemption-mask. Then other potential setting can be similar and added later: frame-preemption-mask frame-preemption-fragsize frame-preemption-machold .... mac-hold it's rather flag, at least I've used it as priv-flag. so can or so frame-preemption-flags > >This command would set which traffic classes are frame preemptable. >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. > >Signed-off-by: Po Liu >--- > ethtool-copy.h | 6 +++++- > ethtool.8.in | 8 ++++++++ > ethtool.c | 18 ++++++++++++++++++ > 3 files changed, 31 insertions(+), 1 deletion(-) > >diff --git a/ethtool-copy.h b/ethtool-copy.h >index 9afd2e6..e04bdf3 100644 >--- a/ethtool-copy.h >+++ b/ethtool-copy.h >@@ -1662,6 +1662,9 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex) > #define AUTONEG_DISABLE 0x00 > #define AUTONEG_ENABLE 0x01 > >+/* Disable preemtion. */ >+#define PREEMPTION_DISABLE 0x0 >+ > /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then > * the driver is required to renegotiate link > */ >@@ -1878,7 +1881,8 @@ struct ethtool_link_settings { > __s8 link_mode_masks_nwords; > __u8 transceiver; > __u8 reserved1[3]; >- __u32 reserved[7]; >+ __u32 preemption; >+ __u32 reserved[6]; > __u32 link_mode_masks[0]; > /* layout of link_mode_masks fields: > * __u32 map_supported[link_mode_masks_nwords]; >diff --git a/ethtool.8.in b/ethtool.8.in >index 062695a..7d612b2 100644 >--- a/ethtool.8.in >+++ b/ethtool.8.in >@@ -236,6 +236,7 @@ ethtool \- query or control network driver and hardware settings > .B2 autoneg on off > .BN advertise > .BN phyad >+.BN preemption > .B2 xcvr internal external > .RB [ wol \ \*(WO] > .RB [ sopass \ \*(MA] >@@ -703,6 +704,13 @@ lB l lB. > .BI phyad \ N > PHY address. > .TP >+.BI preemption \ N >+Set preemptable traffic classes by bits. >+.B A >+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. >+.TP > .A2 xcvr internal external > Selects transceiver type. Currently only internal and external can be > specified, in the future further types might be added. >diff --git a/ethtool.c b/ethtool.c >index acf183d..d5240f8 100644 >--- a/ethtool.c >+++ b/ethtool.c >@@ -928,6 +928,12 @@ dump_link_usettings(const struct ethtool_link_usettings *link_usettings) > } > } > >+ if (link_usettings->base.preemption == PREEMPTION_DISABLE) >+ fprintf(stdout, " Preemption: 0x0 (off)\n"); >+ else >+ fprintf(stdout, " Preemption: 0x%x\n", >+ link_usettings->base.preemption); >+ > return 0; > } > >@@ -2869,6 +2875,7 @@ static int do_sset(struct cmd_context *ctx) > int port_wanted = -1; > int mdix_wanted = -1; > int autoneg_wanted = -1; >+ int preemption_wanted = -1; > int phyad_wanted = -1; > int xcvr_wanted = -1; > u32 *full_advertising_wanted = NULL; >@@ -2957,6 +2964,12 @@ static int do_sset(struct cmd_context *ctx) > } else { > exit_bad_args(); > } >+ } else if (!strcmp(argp[i], "preemption")) { >+ gset_changed = 1; >+ i += 1; >+ if (i >= argc) >+ exit_bad_args(); >+ preemption_wanted = get_u32(argp[i], 16); > } else if (!strcmp(argp[i], "advertise")) { > gset_changed = 1; > i += 1; >@@ -3094,6 +3107,9 @@ static int do_sset(struct cmd_context *ctx) > } > if (autoneg_wanted != -1) > link_usettings->base.autoneg = autoneg_wanted; >+ if (preemption_wanted != -1) >+ link_usettings->base.preemption >+ = preemption_wanted; > if (phyad_wanted != -1) > link_usettings->base.phy_address = phyad_wanted; > if (xcvr_wanted != -1) >@@ -3186,6 +3202,8 @@ static int do_sset(struct cmd_context *ctx) > fprintf(stderr, " not setting transceiver\n"); > if (mdix_wanted != -1) > fprintf(stderr, " not setting mdix\n"); >+ if (preemption_wanted != -1) >+ fprintf(stderr, " not setting preemption\n"); > } > } > >-- >2.17.1 > -- Regards, Ivan Khoronzhuk