All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: add one ethtool option to set relax ordering mode
@ 2016-12-08  6:51 Mao Wenan
  2016-12-08  6:51 ` [PATCH] ethtool: " Mao Wenan
  2016-12-08 14:11 ` [PATCH] net: " Andrew Lunn
  0 siblings, 2 replies; 16+ messages in thread
From: Mao Wenan @ 2016-12-08  6:51 UTC (permalink / raw)
  To: netdev, jeffrey.t.kirsher

This patch provides one way to set/unset IXGBE NIC TX and RX
relax ordering mode, which can be set by ethtool.
Relax ordering is one mode of 82599 NIC, to enable this mode
can enhance the performance for some cpu architecure.
example:
ethtool -s enp1s0f0 relaxorder off
ethtool -s enp1s0f0 relaxorder on

Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 34 ++++++++++++++++++++++++
 include/linux/ethtool.h                          |  2 ++
 include/uapi/linux/ethtool.h                     |  6 +++++
 net/core/ethtool.c                               |  5 ++++
 4 files changed, 47 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index f49f803..9650539 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -493,6 +493,39 @@ static void ixgbe_set_msglevel(struct net_device *netdev, u32 data)
 	adapter->msg_enable = data;
 }
 
+static void ixgbe_set_relaxorder(struct net_device *netdev, u32 data)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(netdev);
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 i = 0;
+	pr_info("set relax ordering mode : %s\n",data?"on":"off");
+	
+	for (i = 0; i < hw->mac.max_tx_queues; i++) {
+		u32 regval;
+
+		regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i));
+		if (data)
+			regval |= IXGBE_DCA_TXCTRL_DESC_WRO_EN;
+		else
+			regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN;
+		IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval);
+	}
+
+	for (i = 0; i < hw->mac.max_rx_queues; i++) {
+		u32 regval;
+		
+		regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i));
+		if (data)
+			regval |= (IXGBE_DCA_RXCTRL_DATA_WRO_EN |
+					IXGBE_DCA_RXCTRL_HEAD_WRO_EN);
+		else
+			regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN |
+					IXGBE_DCA_RXCTRL_HEAD_WRO_EN);
+		IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval);
+	}
+
+}
+
 static int ixgbe_get_regs_len(struct net_device *netdev)
 {
 #define IXGBE_REGS_LEN  1139
@@ -3274,6 +3307,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
 	.get_ts_info		= ixgbe_get_ts_info,
 	.get_module_info	= ixgbe_get_module_info,
 	.get_module_eeprom	= ixgbe_get_module_eeprom,
+	.set_relaxorder         = ixgbe_set_relaxorder,
 };
 
 void ixgbe_set_ethtool_ops(struct net_device *netdev)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9ded8c6..0fae148 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -286,6 +286,7 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
  *	fields should be ignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS
  *	instead of the latter), any change to them will be overwritten
  *	by kernel. Returns a negative error code or zero.
+ * @set_relaxorder: set relax ordering mode, on|off.
  *
  * All operations are optional (i.e. the function pointer may be set
  * to %NULL) and callers must take this into account.  Callers must
@@ -372,5 +373,6 @@ struct ethtool_ops {
 				      struct ethtool_link_ksettings *);
 	int	(*set_link_ksettings)(struct net_device *,
 				      const struct ethtool_link_ksettings *);
+	void    (*set_relaxorder)(struct net_device *, u32);
 };
 #endif /* _LINUX_ETHTOOL_H */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 8e54723..86349b9 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1314,6 +1314,8 @@ struct ethtool_per_queue_op {
 #define ETHTOOL_GLINKSETTINGS	0x0000004c /* Get ethtool_link_settings */
 #define ETHTOOL_SLINKSETTINGS	0x0000004d /* Set ethtool_link_settings */
 
+#define ETHTOOL_SRELAXORDER	0x00000050 /* Set relax ordering mode, on or off*/
+
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
@@ -1494,6 +1496,10 @@ static inline int ethtool_validate_speed(__u32 speed)
 #define DUPLEX_FULL		0x01
 #define DUPLEX_UNKNOWN		0xff
 
+/* Relax Ordering mode, on or off. */
+#define RELAXORDER_OFF          0x00
+#define RELAXORDER_ON           0x01
+
 static inline int ethtool_validate_duplex(__u8 duplex)
 {
 	switch (duplex) {
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 047a175..b7629d1 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -2685,6 +2685,11 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 	case ETHTOOL_SLINKSETTINGS:
 		rc = ethtool_set_link_ksettings(dev, useraddr);
 		break;
+	case ETHTOOL_SRELAXORDER:
+		rc = ethtool_set_value_void(dev, useraddr,
+					dev->ethtool_ops->set_relaxorder);
+		 break;
+
 	default:
 		rc = -EOPNOTSUPP;
 	}
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-08  6:51 [PATCH] net: add one ethtool option to set relax ordering mode Mao Wenan
@ 2016-12-08  6:51 ` Mao Wenan
  2016-12-22  1:27   ` Stephen Hemminger
  2016-12-08 14:11 ` [PATCH] net: " Andrew Lunn
  1 sibling, 1 reply; 16+ messages in thread
From: Mao Wenan @ 2016-12-08  6:51 UTC (permalink / raw)
  To: netdev, jeffrey.t.kirsher

This patch provides one way to set/unset IXGBE NIC TX and RX
relax ordering mode, which can be set by ethtool.
Relax ordering is one mode of 82599 NIC, to enable this mode
can enhance the performance for some cpu architecure.
example:
ethtool -s enp1s0f0 relaxorder off
ethtool -s enp1s0f0 relaxorder on

Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 ethtool-copy.h |  6 ++++++
 ethtool.c      | 24 +++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3d299e3..37d93be 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -1329,6 +1329,8 @@ struct ethtool_per_queue_op {
 #define ETHTOOL_PHY_GTUNABLE	0x0000004e /* Get PHY tunable configuration */
 #define ETHTOOL_PHY_STUNABLE	0x0000004f /* Set PHY tunable configuration */
 
+#define ETHTOOL_SRELAXORDER	0x00000050 /* Set relax ordering mode, on or off*/
+
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
 #define SPARC_ETH_SSET		ETHTOOL_SSET
@@ -1558,6 +1560,10 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
 #define WAKE_MAGIC		(1 << 5)
 #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
 
+/* Relax Ordering mode, on or off. */
+#define RELAXORDER_OFF		0x00
+#define RELAXORDER_ON		0x01
+
 /* L2-L4 network traffic flow types */
 #define	TCP_V4_FLOW	0x01	/* hash or spec (tcp_ip4_spec) */
 #define	UDP_V4_FLOW	0x02	/* hash or spec (udp_ip4_spec) */
diff --git a/ethtool.c b/ethtool.c
index 7af039e..acafd71 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2738,6 +2738,8 @@ static int do_sset(struct cmd_context *ctx)
 	int msglvl_changed = 0;
 	u32 msglvl_wanted = 0;
 	u32 msglvl_mask = 0;
+	int relaxorder_wanted = -1;
+	int relaxorder_changed = 0;
 	struct cmdline_info cmdline_msglvl[ARRAY_SIZE(flags_msglvl)];
 	int argc = ctx->argc;
 	char **argp = ctx->argp;
@@ -2873,6 +2875,16 @@ static int do_sset(struct cmd_context *ctx)
 					ARRAY_SIZE(cmdline_msglvl));
 				break;
 			}
+		} else if (!strcmp(argp[i], "relaxorder")) {
+			relaxorder_changed = 1;
+			i += 1;
+			if (i >= argc)
+				exit_bad_args();
+			if (!strcmp(argp[i], "on"))
+				relaxorder_wanted = RELAXORDER_ON;
+			else if (!strcmp(argp[i], "off"))
+				relaxorder_wanted = RELAXORDER_OFF;
+			else	exit_bad_args();
 		} else {
 			exit_bad_args();
 		}
@@ -3093,6 +3105,15 @@ static int do_sset(struct cmd_context *ctx)
 		}
 	}
 
+	if (relaxorder_changed) {
+		struct ethtool_value edata;
+
+		edata.cmd = ETHTOOL_SRELAXORDER;
+		edata.data = relaxorder_wanted;
+		err = send_ioctl(ctx, &edata);
+		if (err < 0)
+			perror("Cannot set relax ordering mode");
+	}
 	return 0;
 }
 
@@ -4690,7 +4711,8 @@ static const struct option {
 	  "		[ xcvr internal|external ]\n"
 	  "		[ wol p|u|m|b|a|g|s|d... ]\n"
 	  "		[ sopass %x:%x:%x:%x:%x:%x ]\n"
-	  "		[ msglvl %d | msglvl type on|off ... ]\n" },
+	  "		[ msglvl %d | msglvl type on|off ... ]\n"
+	  "		[ relaxorder on|off ]\n" },
 	{ "-a|--show-pause", 1, do_gpause, "Show pause options" },
 	{ "-A|--pause", 1, do_spause, "Set pause options",
 	  "		[ autoneg on|off ]\n"
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] net: add one ethtool option to set relax ordering mode
  2016-12-08  6:51 [PATCH] net: add one ethtool option to set relax ordering mode Mao Wenan
  2016-12-08  6:51 ` [PATCH] ethtool: " Mao Wenan
@ 2016-12-08 14:11 ` Andrew Lunn
  2016-12-12  8:30   ` maowenan
  2016-12-22  0:10   ` maowenan
  1 sibling, 2 replies; 16+ messages in thread
From: Andrew Lunn @ 2016-12-08 14:11 UTC (permalink / raw)
  To: Mao Wenan; +Cc: netdev, jeffrey.t.kirsher

On Thu, Dec 08, 2016 at 02:51:37PM +0800, Mao Wenan wrote:
> This patch provides one way to set/unset IXGBE NIC TX and RX
> relax ordering mode, which can be set by ethtool.
> Relax ordering is one mode of 82599 NIC, to enable this mode
> can enhance the performance for some cpu architecure.
> example:
> ethtool -s enp1s0f0 relaxorder off
> ethtool -s enp1s0f0 relaxorder on

Since this is a simple on/off, could it not be done with a feature?
ethtool --feature?

	Andrew

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] net: add one ethtool option to set relax ordering mode
  2016-12-08 14:11 ` [PATCH] net: " Andrew Lunn
@ 2016-12-12  8:30   ` maowenan
  2016-12-22  0:10   ` maowenan
  1 sibling, 0 replies; 16+ messages in thread
From: maowenan @ 2016-12-12  8:30 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, jeffrey.t.kirsher, weiyongjun (A)



> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
> On Behalf Of Andrew Lunn
> Sent: Thursday, December 08, 2016 10:12 PM
> To: maowenan
> Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> Subject: Re: [PATCH] net: add one ethtool option to set relax ordering mode
> 
> On Thu, Dec 08, 2016 at 02:51:37PM +0800, Mao Wenan wrote:
> > This patch provides one way to set/unset IXGBE NIC TX and RX relax
> > ordering mode, which can be set by ethtool.
> > Relax ordering is one mode of 82599 NIC, to enable this mode can
> > enhance the performance for some cpu architecure.
> > example:
> > ethtool -s enp1s0f0 relaxorder off
> > ethtool -s enp1s0f0 relaxorder on
> 
> Since this is a simple on/off, could it not be done with a feature?
> ethtool --feature?
> 
> 	Andrew

Hello Andrew, 
	Thank you for your comments.
	I get your idea about using ethtool -K|--feature is good for this feature, right? 
My original concert is about this is a relax ordering mode exist in 82599, it is the hardware 
related feature. And ethtool -s option is related hardware of phy and other (e.g: speed, duplex...),
it is very easy to implement in do_sset().
But ethtool -K is mainly used for protocol offload,
        ethtool -K|--features|--offload DEVNAME Set protocol offload and other features
                FEATURE on|off ... 
@Jeff Kirsher, what's your comments?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] net: add one ethtool option to set relax ordering mode
  2016-12-08 14:11 ` [PATCH] net: " Andrew Lunn
  2016-12-12  8:30   ` maowenan
@ 2016-12-22  0:10   ` maowenan
  1 sibling, 0 replies; 16+ messages in thread
From: maowenan @ 2016-12-22  0:10 UTC (permalink / raw)
  To: maowenan, Andrew Lunn; +Cc: netdev, jeffrey.t.kirsher, weiyongjun (A), davem

Hi,

> -----Original Message-----
> From: maowenan
> Sent: Monday, December 12, 2016 4:29 PM
> To: 'Andrew Lunn'
> Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com; weiyongjun (A)
> Subject: RE: [PATCH] net: add one ethtool option to set relax ordering mode
> 
> 
> 
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org
> > [mailto:netdev-owner@vger.kernel.org]
> > On Behalf Of Andrew Lunn
> > Sent: Thursday, December 08, 2016 10:12 PM
> > To: maowenan
> > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> > Subject: Re: [PATCH] net: add one ethtool option to set relax ordering
> > mode
> >
> > On Thu, Dec 08, 2016 at 02:51:37PM +0800, Mao Wenan wrote:
> > > This patch provides one way to set/unset IXGBE NIC TX and RX relax
> > > ordering mode, which can be set by ethtool.
> > > Relax ordering is one mode of 82599 NIC, to enable this mode can
> > > enhance the performance for some cpu architecure.
> > > example:
> > > ethtool -s enp1s0f0 relaxorder off
> > > ethtool -s enp1s0f0 relaxorder on
> >
> > Since this is a simple on/off, could it not be done with a feature?
> > ethtool --feature?
> >
> > 	Andrew
> 
> Hello Andrew,
> 	Thank you for your comments.
> 	I get your idea about using ethtool -K|--feature is good for this feature,
> right?
> My original concert is about this is a relax ordering mode exist in 82599, it is
> the hardware related feature. And ethtool -s option is related hardware of phy
> and other (e.g: speed, duplex...), it is very easy to implement in do_sset().
> But ethtool -K is mainly used for protocol offload,
>         ethtool -K|--features|--offload DEVNAME Set protocol offload and
> other features
>                 FEATURE on|off ...
> @Jeff Kirsher, what's your comments?

@Jeff Kirsher and @David Miller, do you have any other comments about this patch which wants to add ethtool option to on|off relax ordering with 82599?  Thank you.
Here Andrew have comment about using -K or --features on|off relax ordering.







 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-08  6:51 ` [PATCH] ethtool: " Mao Wenan
@ 2016-12-22  1:27   ` Stephen Hemminger
  2016-12-22  1:39     ` maowenan
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Hemminger @ 2016-12-22  1:27 UTC (permalink / raw)
  To: Mao Wenan; +Cc: netdev, jeffrey.t.kirsher

On Thu, 8 Dec 2016 14:51:38 +0800
Mao Wenan <maowenan@huawei.com> wrote:

> This patch provides one way to set/unset IXGBE NIC TX and RX
> relax ordering mode, which can be set by ethtool.
> Relax ordering is one mode of 82599 NIC, to enable this mode
> can enhance the performance for some cpu architecure.

Then it should be done by CPU architecture specific quirks (preferably in PCI layer)
so that all users get the option without having to do manual intervention.

> example:
> ethtool -s enp1s0f0 relaxorder off
> ethtool -s enp1s0f0 relaxorder on

Doing it via ethtool is a developer API (for testing) not something that makes
sense in production.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-22  1:27   ` Stephen Hemminger
@ 2016-12-22  1:39     ` maowenan
  2016-12-22 15:53       ` Alexander Duyck
  0 siblings, 1 reply; 16+ messages in thread
From: maowenan @ 2016-12-22  1:39 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, jeffrey.t.kirsher, weiyongjun (A), Dingtianhong



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Thursday, December 22, 2016 9:28 AM
> To: maowenan
> Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
> 
> On Thu, 8 Dec 2016 14:51:38 +0800
> Mao Wenan <maowenan@huawei.com> wrote:
> 
> > This patch provides one way to set/unset IXGBE NIC TX and RX relax
> > ordering mode, which can be set by ethtool.
> > Relax ordering is one mode of 82599 NIC, to enable this mode can
> > enhance the performance for some cpu architecure.
> 
> Then it should be done by CPU architecture specific quirks (preferably in PCI
> layer) so that all users get the option without having to do manual intervention.
> 
> > example:
> > ethtool -s enp1s0f0 relaxorder off
> > ethtool -s enp1s0f0 relaxorder on
> 
> Doing it via ethtool is a developer API (for testing) not something that makes
> sense in production.


This feature is not mandatory for all users, acturally relax ordering default configuration of 82599 is 'disable',
So this patch gives one way to enable relax ordering to be selected in some performance condition.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-22  1:39     ` maowenan
@ 2016-12-22 15:53       ` Alexander Duyck
  2016-12-23  0:40         ` maowenan
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Duyck @ 2016-12-22 15:53 UTC (permalink / raw)
  To: maowenan
  Cc: Stephen Hemminger, netdev, jeffrey.t.kirsher, weiyongjun (A),
	Dingtianhong

On Wed, Dec 21, 2016 at 5:39 PM, maowenan <maowenan@huawei.com> wrote:
>
>
>> -----Original Message-----
>> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
>> Sent: Thursday, December 22, 2016 9:28 AM
>> To: maowenan
>> Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
>> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
>>
>> On Thu, 8 Dec 2016 14:51:38 +0800
>> Mao Wenan <maowenan@huawei.com> wrote:
>>
>> > This patch provides one way to set/unset IXGBE NIC TX and RX relax
>> > ordering mode, which can be set by ethtool.
>> > Relax ordering is one mode of 82599 NIC, to enable this mode can
>> > enhance the performance for some cpu architecure.
>>
>> Then it should be done by CPU architecture specific quirks (preferably in PCI
>> layer) so that all users get the option without having to do manual intervention.
>>
>> > example:
>> > ethtool -s enp1s0f0 relaxorder off
>> > ethtool -s enp1s0f0 relaxorder on
>>
>> Doing it via ethtool is a developer API (for testing) not something that makes
>> sense in production.
>
>
> This feature is not mandatory for all users, acturally relax ordering default configuration of 82599 is 'disable',
> So this patch gives one way to enable relax ordering to be selected in some performance condition.

That isn't quite true.  The default for Sparc systems is to have it enabled.

Really this is something that is platform specific.  I agree with
Stephen that it would work better if this was handled as a series of
platform specific quirks handled at something like the PCI layer
rather than be a switch the user can toggle on and off.

With that being said there are changes being made that should help to
improve the situation.  Specifically I am looking at adding support
for the DMA_ATTR_WEAK_ORDERING which may also allow us to identify
cases where you might be able to specify the DMA behavior via the DMA
mapping instead of having to make the final decision in the device
itself.

- Alex

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-22 15:53       ` Alexander Duyck
@ 2016-12-23  0:40         ` maowenan
  2016-12-23  1:06           ` Jeff Kirsher
  0 siblings, 1 reply; 16+ messages in thread
From: maowenan @ 2016-12-23  0:40 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Stephen Hemminger, netdev, jeffrey.t.kirsher, weiyongjun (A),
	Dingtianhong



> -----Original Message-----
> From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> Sent: Thursday, December 22, 2016 11:54 PM
> To: maowenan
> Cc: Stephen Hemminger; netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com;
> weiyongjun (A); Dingtianhong
> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
> 
> On Wed, Dec 21, 2016 at 5:39 PM, maowenan <maowenan@huawei.com>
> wrote:
> >
> >
> >> -----Original Message-----
> >> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> >> Sent: Thursday, December 22, 2016 9:28 AM
> >> To: maowenan
> >> Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> >> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> >> ordering mode
> >>
> >> On Thu, 8 Dec 2016 14:51:38 +0800
> >> Mao Wenan <maowenan@huawei.com> wrote:
> >>
> >> > This patch provides one way to set/unset IXGBE NIC TX and RX relax
> >> > ordering mode, which can be set by ethtool.
> >> > Relax ordering is one mode of 82599 NIC, to enable this mode can
> >> > enhance the performance for some cpu architecure.
> >>
> >> Then it should be done by CPU architecture specific quirks
> >> (preferably in PCI
> >> layer) so that all users get the option without having to do manual
> intervention.
> >>
> >> > example:
> >> > ethtool -s enp1s0f0 relaxorder off
> >> > ethtool -s enp1s0f0 relaxorder on
> >>
> >> Doing it via ethtool is a developer API (for testing) not something
> >> that makes sense in production.
> >
> >
> > This feature is not mandatory for all users, acturally relax ordering
> > default configuration of 82599 is 'disable', So this patch gives one way to
> enable relax ordering to be selected in some performance condition.
> 
> That isn't quite true.  The default for Sparc systems is to have it enabled.
> 
> Really this is something that is platform specific.  I agree with Stephen that it
> would work better if this was handled as a series of platform specific quirks
> handled at something like the PCI layer rather than be a switch the user can
> toggle on and off.
> 
> With that being said there are changes being made that should help to improve
> the situation.  Specifically I am looking at adding support for the
> DMA_ATTR_WEAK_ORDERING which may also allow us to identify cases where
> you might be able to specify the DMA behavior via the DMA mapping instead of
> having to make the final decision in the device itself.
> 
> - Alex

Yes, Sparc is a special case. From the NIC driver point of view, It is no need for 
some ARCHs to do particular operation and compiling branch, ethtool is a flexible 
method for user to make decision whether on|off this feature.
I think Jeff as maintainer of 82599 has some comments about this.
-Wenan


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-23  0:40         ` maowenan
@ 2016-12-23  1:06           ` Jeff Kirsher
  2016-12-23  6:14             ` maowenan
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff Kirsher @ 2016-12-23  1:06 UTC (permalink / raw)
  To: maowenan, Alexander Duyck
  Cc: Stephen Hemminger, netdev, weiyongjun (A), Dingtianhong

[-- Attachment #1: Type: text/plain, Size: 3540 bytes --]

On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
> > -----Original Message-----
> > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> > Sent: Thursday, December 22, 2016 11:54 PM
> > To: maowenan
> > Cc: Stephen Hemminger; netdev@vger.kernel.org; jeffrey.t.kirsher@intel.
> > com;
> > weiyongjun (A); Dingtianhong
> > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > ordering mode
> > 
> > On Wed, Dec 21, 2016 at 5:39 PM, maowenan <maowenan@huawei.com>
> > wrote:
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > > Sent: Thursday, December 22, 2016 9:28 AM
> > > > To: maowenan
> > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> > > > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > > > ordering mode
> > > > 
> > > > On Thu, 8 Dec 2016 14:51:38 +0800
> > > > Mao Wenan <maowenan@huawei.com> wrote:
> > > > 
> > > > > This patch provides one way to set/unset IXGBE NIC TX and RX
> > > > > relax
> > > > > ordering mode, which can be set by ethtool.
> > > > > Relax ordering is one mode of 82599 NIC, to enable this mode can
> > > > > enhance the performance for some cpu architecure.
> > > > 
> > > > Then it should be done by CPU architecture specific quirks
> > > > (preferably in PCI
> > > > layer) so that all users get the option without having to do manual
> > 
> > intervention.
> > > > 
> > > > > example:
> > > > > ethtool -s enp1s0f0 relaxorder off
> > > > > ethtool -s enp1s0f0 relaxorder on
> > > > 
> > > > Doing it via ethtool is a developer API (for testing) not something
> > > > that makes sense in production.
> > > 
> > > 
> > > This feature is not mandatory for all users, acturally relax ordering
> > > default configuration of 82599 is 'disable', So this patch gives one
> > > way to
> > 
> > enable relax ordering to be selected in some performance condition.
> > 
> > That isn't quite true.  The default for Sparc systems is to have it
> > enabled.
> > 
> > Really this is something that is platform specific.  I agree with
> > Stephen that it
> > would work better if this was handled as a series of platform specific
> > quirks
> > handled at something like the PCI layer rather than be a switch the
> > user can
> > toggle on and off.
> > 
> > With that being said there are changes being made that should help to
> > improve
> > the situation.  Specifically I am looking at adding support for the
> > DMA_ATTR_WEAK_ORDERING which may also allow us to identify cases where
> > you might be able to specify the DMA behavior via the DMA mapping
> > instead of
> > having to make the final decision in the device itself.
> > 
> > - Alex
> 
> Yes, Sparc is a special case. From the NIC driver point of view, It is no
> need for 
> some ARCHs to do particular operation and compiling branch, ethtool is a
> flexible 
> method for user to make decision whether on|off this feature.
> I think Jeff as maintainer of 82599 has some comments about this.

My original comment/objection was that you attempted to do this change as a
module parameter to the ixgbe driver, where I directed you to use ethtool 
so that other drivers could benefit from the ability to enable/disable
relaxed ordering.  As far as how it gets implemented in ethtool or PCI
layer, makes little difference to me, I only had issues with the driver
specific module parameter implementation, which is not acceptable.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-23  1:06           ` Jeff Kirsher
@ 2016-12-23  6:14             ` maowenan
  2016-12-23 15:42               ` Alexander Duyck
  0 siblings, 1 reply; 16+ messages in thread
From: maowenan @ 2016-12-23  6:14 UTC (permalink / raw)
  To: Jeff Kirsher, Alexander Duyck
  Cc: Stephen Hemminger, netdev, weiyongjun (A), Dingtianhong



> -----Original Message-----
> From: Jeff Kirsher [mailto:jeffrey.t.kirsher@intel.com]
> Sent: Friday, December 23, 2016 9:07 AM
> To: maowenan; Alexander Duyck
> Cc: Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
> Dingtianhong
> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
> 
> On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
> > > -----Original Message-----
> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> > > Sent: Thursday, December 22, 2016 11:54 PM
> > > To: maowenan
> > > Cc: Stephen Hemminger; netdev@vger.kernel.org; jeffrey.t.kirsher@intel.
> > > com;
> > > weiyongjun (A); Dingtianhong
> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > > ordering mode
> > >
> > > On Wed, Dec 21, 2016 at 5:39 PM, maowenan <maowenan@huawei.com>
> > > wrote:
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > > > Sent: Thursday, December 22, 2016 9:28 AM
> > > > > To: maowenan
> > > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> > > > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
> > > > > relax ordering mode
> > > > >
> > > > > On Thu, 8 Dec 2016 14:51:38 +0800 Mao Wenan
> > > > > <maowenan@huawei.com> wrote:
> > > > >
> > > > > > This patch provides one way to set/unset IXGBE NIC TX and RX
> > > > > > relax ordering mode, which can be set by ethtool.
> > > > > > Relax ordering is one mode of 82599 NIC, to enable this mode
> > > > > > can enhance the performance for some cpu architecure.
> > > > >
> > > > > Then it should be done by CPU architecture specific quirks
> > > > > (preferably in PCI
> > > > > layer) so that all users get the option without having to do
> > > > > manual
> > >
> > > intervention.
> > > > >
> > > > > > example:
> > > > > > ethtool -s enp1s0f0 relaxorder off ethtool -s enp1s0f0
> > > > > > relaxorder on
> > > > >
> > > > > Doing it via ethtool is a developer API (for testing) not
> > > > > something that makes sense in production.
> > > >
> > > >
> > > > This feature is not mandatory for all users, acturally relax
> > > > ordering default configuration of 82599 is 'disable', So this
> > > > patch gives one way to
> > >
> > > enable relax ordering to be selected in some performance condition.
> > >
> > > That isn't quite true.  The default for Sparc systems is to have it
> > > enabled.
> > >
> > > Really this is something that is platform specific.  I agree with
> > > Stephen that it would work better if this was handled as a series of
> > > platform specific quirks handled at something like the PCI layer
> > > rather than be a switch the user can toggle on and off.
> > >
> > > With that being said there are changes being made that should help
> > > to improve the situation.  Specifically I am looking at adding
> > > support for the DMA_ATTR_WEAK_ORDERING which may also allow us to
> > > identify cases where you might be able to specify the DMA behavior
> > > via the DMA mapping instead of having to make the final decision in
> > > the device itself.
> > >
> > > - Alex
> >
> > Yes, Sparc is a special case. From the NIC driver point of view, It is
> > no need for some ARCHs to do particular operation and compiling
> > branch, ethtool is a flexible method for user to make decision whether
> > on|off this feature.
> > I think Jeff as maintainer of 82599 has some comments about this.
> 
> My original comment/objection was that you attempted to do this change as a
> module parameter to the ixgbe driver, where I directed you to use ethtool so
> that other drivers could benefit from the ability to enable/disable relaxed
> ordering.  As far as how it gets implemented in ethtool or PCI layer, makes
> little difference to me, I only had issues with the driver specific module
> parameter implementation, which is not acceptable.


Thank you Jeff and Alex.
And then I have gone through mail thread about "i40e: enable PCIe relax ordering for SPARC",
It only works for SPARC, any other ARCH who wants to enable DMA_ATTR_WEAK_ORDERING 
feature, should define the new macro, recompile the driver module.

Because of the above reasons, we implement in ethtool to give the final user a convenient
way to on|off special feature, no need define new macro, easy to extend the new features,
and also good benefit for other driver as Jeff referred.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-23  6:14             ` maowenan
@ 2016-12-23 15:42               ` Alexander Duyck
  2016-12-24  8:30                 ` maowenan
                                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Alexander Duyck @ 2016-12-23 15:42 UTC (permalink / raw)
  To: maowenan
  Cc: Jeff Kirsher, Stephen Hemminger, netdev, weiyongjun (A), Dingtianhong

On Thu, Dec 22, 2016 at 10:14 PM, maowenan <maowenan@huawei.com> wrote:
>
>
>> -----Original Message-----
>> From: Jeff Kirsher [mailto:jeffrey.t.kirsher@intel.com]
>> Sent: Friday, December 23, 2016 9:07 AM
>> To: maowenan; Alexander Duyck
>> Cc: Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
>> Dingtianhong
>> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
>>
>> On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
>> > > -----Original Message-----
>> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
>> > > Sent: Thursday, December 22, 2016 11:54 PM
>> > > To: maowenan
>> > > Cc: Stephen Hemminger; netdev@vger.kernel.org; jeffrey.t.kirsher@intel.
>> > > com;
>> > > weiyongjun (A); Dingtianhong
>> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
>> > > ordering mode
>> > >
>> > > On Wed, Dec 21, 2016 at 5:39 PM, maowenan <maowenan@huawei.com>
>> > > wrote:
>> > > >
>> > > >
>> > > > > -----Original Message-----
>> > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
>> > > > > Sent: Thursday, December 22, 2016 9:28 AM
>> > > > > To: maowenan
>> > > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
>> > > > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
>> > > > > relax ordering mode
>> > > > >
>> > > > > On Thu, 8 Dec 2016 14:51:38 +0800 Mao Wenan
>> > > > > <maowenan@huawei.com> wrote:
>> > > > >
>> > > > > > This patch provides one way to set/unset IXGBE NIC TX and RX
>> > > > > > relax ordering mode, which can be set by ethtool.
>> > > > > > Relax ordering is one mode of 82599 NIC, to enable this mode
>> > > > > > can enhance the performance for some cpu architecure.
>> > > > >
>> > > > > Then it should be done by CPU architecture specific quirks
>> > > > > (preferably in PCI
>> > > > > layer) so that all users get the option without having to do
>> > > > > manual
>> > >
>> > > intervention.
>> > > > >
>> > > > > > example:
>> > > > > > ethtool -s enp1s0f0 relaxorder off ethtool -s enp1s0f0
>> > > > > > relaxorder on
>> > > > >
>> > > > > Doing it via ethtool is a developer API (for testing) not
>> > > > > something that makes sense in production.
>> > > >
>> > > >
>> > > > This feature is not mandatory for all users, acturally relax
>> > > > ordering default configuration of 82599 is 'disable', So this
>> > > > patch gives one way to
>> > >
>> > > enable relax ordering to be selected in some performance condition.
>> > >
>> > > That isn't quite true.  The default for Sparc systems is to have it
>> > > enabled.
>> > >
>> > > Really this is something that is platform specific.  I agree with
>> > > Stephen that it would work better if this was handled as a series of
>> > > platform specific quirks handled at something like the PCI layer
>> > > rather than be a switch the user can toggle on and off.
>> > >
>> > > With that being said there are changes being made that should help
>> > > to improve the situation.  Specifically I am looking at adding
>> > > support for the DMA_ATTR_WEAK_ORDERING which may also allow us to
>> > > identify cases where you might be able to specify the DMA behavior
>> > > via the DMA mapping instead of having to make the final decision in
>> > > the device itself.
>> > >
>> > > - Alex
>> >
>> > Yes, Sparc is a special case. From the NIC driver point of view, It is
>> > no need for some ARCHs to do particular operation and compiling
>> > branch, ethtool is a flexible method for user to make decision whether
>> > on|off this feature.
>> > I think Jeff as maintainer of 82599 has some comments about this.
>>
>> My original comment/objection was that you attempted to do this change as a
>> module parameter to the ixgbe driver, where I directed you to use ethtool so
>> that other drivers could benefit from the ability to enable/disable relaxed
>> ordering.  As far as how it gets implemented in ethtool or PCI layer, makes
>> little difference to me, I only had issues with the driver specific module
>> parameter implementation, which is not acceptable.
>
>
> Thank you Jeff and Alex.
> And then I have gone through mail thread about "i40e: enable PCIe relax ordering for SPARC",
> It only works for SPARC, any other ARCH who wants to enable DMA_ATTR_WEAK_ORDERING
> feature, should define the new macro, recompile the driver module.
>
> Because of the above reasons, we implement in ethtool to give the final user a convenient
> way to on|off special feature, no need define new macro, easy to extend the new features,
> and also good benefit for other driver as Jeff referred.
>

I think the point is we shouldn't base the decision on user input.
The fact is the PCIe device control register should have a bit that
indicates if the device is allowed to enable relaxed ordering or not.
If we can guarantee that the bit is set in all the cases where it
should be set, and cleared in all the cases where it should not then
we could use something like that to determine if the device is
supposed to enable relaxed ordering instead of trying to make the
decision ourselves.

- Alex

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-23 15:42               ` Alexander Duyck
@ 2016-12-24  8:30                 ` maowenan
  2016-12-26  8:33                 ` maowenan
  2017-01-04  9:02                 ` maowenan
  2 siblings, 0 replies; 16+ messages in thread
From: maowenan @ 2016-12-24  8:30 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Jeff Kirsher, Stephen Hemminger, netdev, weiyongjun (A),
	Dingtianhong, Wangzhou (B)



> -----Original Message-----
> From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> Sent: Friday, December 23, 2016 11:43 PM
> To: maowenan
> Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
> Dingtianhong
> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
> 
> On Thu, Dec 22, 2016 at 10:14 PM, maowenan <maowenan@huawei.com>
> wrote:
> >
> >
> >> -----Original Message-----
> >> From: Jeff Kirsher [mailto:jeffrey.t.kirsher@intel.com]
> >> Sent: Friday, December 23, 2016 9:07 AM
> >> To: maowenan; Alexander Duyck
> >> Cc: Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
> >> Dingtianhong
> >> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> >> ordering mode
> >>
> >> On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
> >> > > -----Original Message-----
> >> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> >> > > Sent: Thursday, December 22, 2016 11:54 PM
> >> > > To: maowenan
> >> > > Cc: Stephen Hemminger; netdev@vger.kernel.org;
> jeffrey.t.kirsher@intel.
> >> > > com;
> >> > > weiyongjun (A); Dingtianhong
> >> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> >> > > ordering mode
> >> > >
> >> > > On Wed, Dec 21, 2016 at 5:39 PM, maowenan
> <maowenan@huawei.com>
> >> > > wrote:
> >> > > >
> >> > > >
> >> > > > > -----Original Message-----
> >> > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> >> > > > > Sent: Thursday, December 22, 2016 9:28 AM
> >> > > > > To: maowenan
> >> > > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> >> > > > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
> >> > > > > relax ordering mode
> >> > > > >
> >> > > > > On Thu, 8 Dec 2016 14:51:38 +0800 Mao Wenan
> >> > > > > <maowenan@huawei.com> wrote:
> >> > > > >
> >> > > > > > This patch provides one way to set/unset IXGBE NIC TX and
> >> > > > > > RX relax ordering mode, which can be set by ethtool.
> >> > > > > > Relax ordering is one mode of 82599 NIC, to enable this
> >> > > > > > mode can enhance the performance for some cpu architecure.
> >> > > > >
> >> > > > > Then it should be done by CPU architecture specific quirks
> >> > > > > (preferably in PCI
> >> > > > > layer) so that all users get the option without having to do
> >> > > > > manual
> >> > >
> >> > > intervention.
> >> > > > >
> >> > > > > > example:
> >> > > > > > ethtool -s enp1s0f0 relaxorder off ethtool -s enp1s0f0
> >> > > > > > relaxorder on
> >> > > > >
> >> > > > > Doing it via ethtool is a developer API (for testing) not
> >> > > > > something that makes sense in production.
> >> > > >
> >> > > >
> >> > > > This feature is not mandatory for all users, acturally relax
> >> > > > ordering default configuration of 82599 is 'disable', So this
> >> > > > patch gives one way to
> >> > >
> >> > > enable relax ordering to be selected in some performance condition.
> >> > >
> >> > > That isn't quite true.  The default for Sparc systems is to have
> >> > > it enabled.
> >> > >
> >> > > Really this is something that is platform specific.  I agree with
> >> > > Stephen that it would work better if this was handled as a series
> >> > > of platform specific quirks handled at something like the PCI
> >> > > layer rather than be a switch the user can toggle on and off.
> >> > >
> >> > > With that being said there are changes being made that should
> >> > > help to improve the situation.  Specifically I am looking at
> >> > > adding support for the DMA_ATTR_WEAK_ORDERING which may also
> >> > > allow us to identify cases where you might be able to specify the
> >> > > DMA behavior via the DMA mapping instead of having to make the
> >> > > final decision in the device itself.
> >> > >
> >> > > - Alex
> >> >
> >> > Yes, Sparc is a special case. From the NIC driver point of view, It
> >> > is no need for some ARCHs to do particular operation and compiling
> >> > branch, ethtool is a flexible method for user to make decision
> >> > whether
> >> > on|off this feature.
> >> > I think Jeff as maintainer of 82599 has some comments about this.
> >>
> >> My original comment/objection was that you attempted to do this
> >> change as a module parameter to the ixgbe driver, where I directed
> >> you to use ethtool so that other drivers could benefit from the
> >> ability to enable/disable relaxed ordering.  As far as how it gets
> >> implemented in ethtool or PCI layer, makes little difference to me, I
> >> only had issues with the driver specific module parameter implementation,
> which is not acceptable.
> >
> >
> > Thank you Jeff and Alex.
> > And then I have gone through mail thread about "i40e: enable PCIe
> > relax ordering for SPARC", It only works for SPARC, any other ARCH who
> > wants to enable DMA_ATTR_WEAK_ORDERING feature, should define the
> new macro, recompile the driver module.
> >
> > Because of the above reasons, we implement in ethtool to give the
> > final user a convenient way to on|off special feature, no need define
> > new macro, easy to extend the new features, and also good benefit for other
> driver as Jeff referred.
> >
> 
> I think the point is we shouldn't base the decision on user input.
> The fact is the PCIe device control register should have a bit that indicates if
> the device is allowed to enable relaxed ordering or not.
> If we can guarantee that the bit is set in all the cases where it should be set,
> and cleared in all the cases where it should not then we could use something
> like that to determine if the device is supposed to enable relaxed ordering
> instead of trying to make the decision ourselves.
> 
> - Alex

ok. We are focusing on the register. 
And yes, to enable relax ordering for 82599 should be set by one or more bits of Rx/TX DCA Control 
Register, these bits should be set in many cpu architectures, such as arm64, sparc, and so on, and 
should be cleared in other ARCHs.
By the way, how do you enable SPARC macro, how and where to define this compiling macro when user 
one to enable relax ordering under SPARC system?  
#ifndef CONFIG_SPARC




^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-23 15:42               ` Alexander Duyck
  2016-12-24  8:30                 ` maowenan
@ 2016-12-26  8:33                 ` maowenan
  2017-01-04  9:02                 ` maowenan
  2 siblings, 0 replies; 16+ messages in thread
From: maowenan @ 2016-12-26  8:33 UTC (permalink / raw)
  To: maowenan, Alexander Duyck
  Cc: Jeff Kirsher, Stephen Hemminger, netdev, weiyongjun (A),
	Dingtianhong, Wangzhou (B)



> -----Original Message-----
> From: maowenan
> Sent: Saturday, December 24, 2016 4:30 PM
> To: 'Alexander Duyck'
> Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
> Dingtianhong; Wangzhou (B)
> Subject: RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
> 
> 
> 
> > -----Original Message-----
> > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> > Sent: Friday, December 23, 2016 11:43 PM
> > To: maowenan
> > Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org;
> > weiyongjun (A); Dingtianhong
> > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > ordering mode
> >
> > On Thu, Dec 22, 2016 at 10:14 PM, maowenan <maowenan@huawei.com>
> > wrote:
> > >
> > >
> > >> -----Original Message-----
> > >> From: Jeff Kirsher [mailto:jeffrey.t.kirsher@intel.com]
> > >> Sent: Friday, December 23, 2016 9:07 AM
> > >> To: maowenan; Alexander Duyck
> > >> Cc: Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
> > >> Dingtianhong
> > >> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > >> ordering mode
> > >>
> > >> On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
> > >> > > -----Original Message-----
> > >> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> > >> > > Sent: Thursday, December 22, 2016 11:54 PM
> > >> > > To: maowenan
> > >> > > Cc: Stephen Hemminger; netdev@vger.kernel.org;
> > jeffrey.t.kirsher@intel.
> > >> > > com;
> > >> > > weiyongjun (A); Dingtianhong
> > >> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
> > >> > > relax ordering mode
> > >> > >
> > >> > > On Wed, Dec 21, 2016 at 5:39 PM, maowenan
> > <maowenan@huawei.com>
> > >> > > wrote:
> > >> > > >
> > >> > > >
> > >> > > > > -----Original Message-----
> > >> > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > >> > > > > Sent: Thursday, December 22, 2016 9:28 AM
> > >> > > > > To: maowenan
> > >> > > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> > >> > > > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
> > >> > > > > relax ordering mode
> > >> > > > >
> > >> > > > > On Thu, 8 Dec 2016 14:51:38 +0800 Mao Wenan
> > >> > > > > <maowenan@huawei.com> wrote:
> > >> > > > >
> > >> > > > > > This patch provides one way to set/unset IXGBE NIC TX and
> > >> > > > > > RX relax ordering mode, which can be set by ethtool.
> > >> > > > > > Relax ordering is one mode of 82599 NIC, to enable this
> > >> > > > > > mode can enhance the performance for some cpu architecure.
> > >> > > > >
> > >> > > > > Then it should be done by CPU architecture specific quirks
> > >> > > > > (preferably in PCI
> > >> > > > > layer) so that all users get the option without having to
> > >> > > > > do manual
> > >> > >
> > >> > > intervention.
> > >> > > > >
> > >> > > > > > example:
> > >> > > > > > ethtool -s enp1s0f0 relaxorder off ethtool -s enp1s0f0
> > >> > > > > > relaxorder on
> > >> > > > >
> > >> > > > > Doing it via ethtool is a developer API (for testing) not
> > >> > > > > something that makes sense in production.
> > >> > > >
> > >> > > >
> > >> > > > This feature is not mandatory for all users, acturally relax
> > >> > > > ordering default configuration of 82599 is 'disable', So this
> > >> > > > patch gives one way to
> > >> > >
> > >> > > enable relax ordering to be selected in some performance condition.
> > >> > >
> > >> > > That isn't quite true.  The default for Sparc systems is to
> > >> > > have it enabled.
> > >> > >
> > >> > > Really this is something that is platform specific.  I agree
> > >> > > with Stephen that it would work better if this was handled as a
> > >> > > series of platform specific quirks handled at something like
> > >> > > the PCI layer rather than be a switch the user can toggle on and off.
> > >> > >
> > >> > > With that being said there are changes being made that should
> > >> > > help to improve the situation.  Specifically I am looking at
> > >> > > adding support for the DMA_ATTR_WEAK_ORDERING which may also
> > >> > > allow us to identify cases where you might be able to specify
> > >> > > the DMA behavior via the DMA mapping instead of having to make
> > >> > > the final decision in the device itself.
> > >> > >
> > >> > > - Alex
> > >> >
> > >> > Yes, Sparc is a special case. From the NIC driver point of view,
> > >> > It is no need for some ARCHs to do particular operation and
> > >> > compiling branch, ethtool is a flexible method for user to make
> > >> > decision whether
> > >> > on|off this feature.
> > >> > I think Jeff as maintainer of 82599 has some comments about this.
> > >>
> > >> My original comment/objection was that you attempted to do this
> > >> change as a module parameter to the ixgbe driver, where I directed
> > >> you to use ethtool so that other drivers could benefit from the
> > >> ability to enable/disable relaxed ordering.  As far as how it gets
> > >> implemented in ethtool or PCI layer, makes little difference to me,
> > >> I only had issues with the driver specific module parameter
> > >> implementation,
> > which is not acceptable.
> > >
> > >
> > > Thank you Jeff and Alex.
> > > And then I have gone through mail thread about "i40e: enable PCIe
> > > relax ordering for SPARC", It only works for SPARC, any other ARCH
> > > who wants to enable DMA_ATTR_WEAK_ORDERING feature, should define
> > > the
> > new macro, recompile the driver module.
> > >
> > > Because of the above reasons, we implement in ethtool to give the
> > > final user a convenient way to on|off special feature, no need
> > > define new macro, easy to extend the new features, and also good
> > > benefit for other
> > driver as Jeff referred.
> > >
> >
> > I think the point is we shouldn't base the decision on user input.
> > The fact is the PCIe device control register should have a bit that
> > indicates if the device is allowed to enable relaxed ordering or not.
> > If we can guarantee that the bit is set in all the cases where it
> > should be set, and cleared in all the cases where it should not then
> > we could use something like that to determine if the device is
> > supposed to enable relaxed ordering instead of trying to make the decision
> ourselves.
> >
> > - Alex
> 
> ok. We are focusing on the register.
> And yes, to enable relax ordering for 82599 should be set by one or more bits of
> Rx/TX DCA Control Register, these bits should be set in many cpu architectures,
> such as arm64, sparc, and so on, and should be cleared in other ARCHs.
> By the way, how do you enable SPARC macro, how and where to define this
> compiling macro when user one to enable relax ordering under SPARC system?
> #ifndef CONFIG_SPARC
> 
> 


Hi, Alex,
Have you already sent out the patches about DMA_ATTR_WEAK_ORDERING?
We want to get you how to enable DMA_ATTR_WEAK_ORDERING by PCIe layer,
and we can refer to that.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2016-12-23 15:42               ` Alexander Duyck
  2016-12-24  8:30                 ` maowenan
  2016-12-26  8:33                 ` maowenan
@ 2017-01-04  9:02                 ` maowenan
  2017-01-04 16:50                   ` Alexander Duyck
  2 siblings, 1 reply; 16+ messages in thread
From: maowenan @ 2017-01-04  9:02 UTC (permalink / raw)
  To: maowenan, Alexander Duyck, netdev, jeffrey.t.kirsher, Stephen Hemminger
  Cc: weiyongjun (A), Dingtianhong, Wangzhou (B)



> -----Original Message-----
> From: maowenan
> Sent: Monday, December 26, 2016 4:33 PM
> To: maowenan; 'Alexander Duyck'
> Cc: 'Jeff Kirsher'; 'Stephen Hemminger'; 'netdev@vger.kernel.org'; weiyongjun
> (A); Dingtianhong; Wangzhou (B)
> Subject: RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
> 
> 
> 
> > -----Original Message-----
> > From: maowenan
> > Sent: Saturday, December 24, 2016 4:30 PM
> > To: 'Alexander Duyck'
> > Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org;
> > weiyongjun (A); Dingtianhong; Wangzhou (B)
> > Subject: RE: [PATCH] ethtool: add one ethtool option to set relax
> > ordering mode
> >
> >
> >
> > > -----Original Message-----
> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> > > Sent: Friday, December 23, 2016 11:43 PM
> > > To: maowenan
> > > Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org;
> > > weiyongjun (A); Dingtianhong
> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > > ordering mode
> > >
> > > On Thu, Dec 22, 2016 at 10:14 PM, maowenan <maowenan@huawei.com>
> > > wrote:
> > > >
> > > >
> > > >> -----Original Message-----
> > > >> From: Jeff Kirsher [mailto:jeffrey.t.kirsher@intel.com]
> > > >> Sent: Friday, December 23, 2016 9:07 AM
> > > >> To: maowenan; Alexander Duyck
> > > >> Cc: Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
> > > >> Dingtianhong
> > > >> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
> > > >> ordering mode
> > > >>
> > > >> On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
> > > >> > > -----Original Message-----
> > > >> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
> > > >> > > Sent: Thursday, December 22, 2016 11:54 PM
> > > >> > > To: maowenan
> > > >> > > Cc: Stephen Hemminger; netdev@vger.kernel.org;
> > > jeffrey.t.kirsher@intel.
> > > >> > > com;
> > > >> > > weiyongjun (A); Dingtianhong
> > > >> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
> > > >> > > relax ordering mode
> > > >> > >
> > > >> > > On Wed, Dec 21, 2016 at 5:39 PM, maowenan
> > > <maowenan@huawei.com>
> > > >> > > wrote:
> > > >> > > >
> > > >> > > >
> > > >> > > > > -----Original Message-----
> > > >> > > > > From: Stephen Hemminger
> > > >> > > > > [mailto:stephen@networkplumber.org]
> > > >> > > > > Sent: Thursday, December 22, 2016 9:28 AM
> > > >> > > > > To: maowenan
> > > >> > > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
> > > >> > > > > Subject: Re: [PATCH] ethtool: add one ethtool option to
> > > >> > > > > set relax ordering mode
> > > >> > > > >
> > > >> > > > > On Thu, 8 Dec 2016 14:51:38 +0800 Mao Wenan
> > > >> > > > > <maowenan@huawei.com> wrote:
> > > >> > > > >
> > > >> > > > > > This patch provides one way to set/unset IXGBE NIC TX
> > > >> > > > > > and RX relax ordering mode, which can be set by ethtool.
> > > >> > > > > > Relax ordering is one mode of 82599 NIC, to enable this
> > > >> > > > > > mode can enhance the performance for some cpu architecure.
> > > >> > > > >
> > > >> > > > > Then it should be done by CPU architecture specific
> > > >> > > > > quirks (preferably in PCI
> > > >> > > > > layer) so that all users get the option without having to
> > > >> > > > > do manual
> > > >> > >
> > > >> > > intervention.
> > > >> > > > >
> > > >> > > > > > example:
> > > >> > > > > > ethtool -s enp1s0f0 relaxorder off ethtool -s enp1s0f0
> > > >> > > > > > relaxorder on
> > > >> > > > >
> > > >> > > > > Doing it via ethtool is a developer API (for testing) not
> > > >> > > > > something that makes sense in production.
> > > >> > > >
> > > >> > > >
> > > >> > > > This feature is not mandatory for all users, acturally
> > > >> > > > relax ordering default configuration of 82599 is 'disable',
> > > >> > > > So this patch gives one way to
> > > >> > >
> > > >> > > enable relax ordering to be selected in some performance condition.
> > > >> > >
> > > >> > > That isn't quite true.  The default for Sparc systems is to
> > > >> > > have it enabled.
> > > >> > >
> > > >> > > Really this is something that is platform specific.  I agree
> > > >> > > with Stephen that it would work better if this was handled as
> > > >> > > a series of platform specific quirks handled at something
> > > >> > > like the PCI layer rather than be a switch the user can toggle on and
> off.
> > > >> > >
> > > >> > > With that being said there are changes being made that should
> > > >> > > help to improve the situation.  Specifically I am looking at
> > > >> > > adding support for the DMA_ATTR_WEAK_ORDERING which may
> also
> > > >> > > allow us to identify cases where you might be able to specify
> > > >> > > the DMA behavior via the DMA mapping instead of having to
> > > >> > > make the final decision in the device itself.
> > > >> > >
> > > >> > > - Alex
> > > >> >
> > > >> > Yes, Sparc is a special case. From the NIC driver point of
> > > >> > view, It is no need for some ARCHs to do particular operation
> > > >> > and compiling branch, ethtool is a flexible method for user to
> > > >> > make decision whether
> > > >> > on|off this feature.
> > > >> > I think Jeff as maintainer of 82599 has some comments about this.
> > > >>
> > > >> My original comment/objection was that you attempted to do this
> > > >> change as a module parameter to the ixgbe driver, where I
> > > >> directed you to use ethtool so that other drivers could benefit
> > > >> from the ability to enable/disable relaxed ordering.  As far as
> > > >> how it gets implemented in ethtool or PCI layer, makes little
> > > >> difference to me, I only had issues with the driver specific
> > > >> module parameter implementation,
> > > which is not acceptable.
> > > >
> > > >
> > > > Thank you Jeff and Alex.
> > > > And then I have gone through mail thread about "i40e: enable PCIe
> > > > relax ordering for SPARC", It only works for SPARC, any other ARCH
> > > > who wants to enable DMA_ATTR_WEAK_ORDERING feature, should
> define
> > > > the
> > > new macro, recompile the driver module.
> > > >
> > > > Because of the above reasons, we implement in ethtool to give the
> > > > final user a convenient way to on|off special feature, no need
> > > > define new macro, easy to extend the new features, and also good
> > > > benefit for other
> > > driver as Jeff referred.
> > > >
> > >
> > > I think the point is we shouldn't base the decision on user input.
> > > The fact is the PCIe device control register should have a bit that
> > > indicates if the device is allowed to enable relaxed ordering or not.
> > > If we can guarantee that the bit is set in all the cases where it
> > > should be set, and cleared in all the cases where it should not then
> > > we could use something like that to determine if the device is
> > > supposed to enable relaxed ordering instead of trying to make the
> > > decision
> > ourselves.
> > >
> > > - Alex
> >
> > ok. We are focusing on the register.
> > And yes, to enable relax ordering for 82599 should be set by one or
> > more bits of Rx/TX DCA Control Register, these bits should be set in
> > many cpu architectures, such as arm64, sparc, and so on, and should be
> cleared in other ARCHs.
> > By the way, how do you enable SPARC macro, how and where to define
> > this compiling macro when user one to enable relax ordering under SPARC
> system?
> > #ifndef CONFIG_SPARC
> >
> >
> 
> 
> Hi, Alex,
> Have you already sent out the patches about DMA_ATTR_WEAK_ORDERING?
> We want to get you how to enable DMA_ATTR_WEAK_ORDERING by PCIe layer,
> and we can refer to that.

I have verified DMA_ATTR_WEAK_ORDERING is not usable for our system(arm64 and 82599),
We should enable relax ordering in 82599 DCA control register to improve performance. 
As Stephen Hemminger do not suggest use ethtool to set relax ordering feature, 
@Jeff, do you agree with using erratum config to enable RO mode in 82599.  
Codes like below:
In Kconfig:
+config HI_ERRATUM_xxxx

In ixgbe_82599.c
#if !defined (CONFIG_SPARC) || !defined(HI_ERRATUM_xxxx)
	/* Disable relaxed ordering */
	for (i = 0; ((i < hw->mac.max_tx_queues) &&
	     (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) {
		regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i));
		regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN;
		IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(i), regval);
	}

	for (i = 0; ((i < hw->mac.max_rx_queues) &&
	     (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) {
		regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i));
		regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN |
			    IXGBE_DCA_RXCTRL_HEAD_WRO_EN);
		IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval);
	}
#endif









^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ethtool: add one ethtool option to set relax ordering mode
  2017-01-04  9:02                 ` maowenan
@ 2017-01-04 16:50                   ` Alexander Duyck
  0 siblings, 0 replies; 16+ messages in thread
From: Alexander Duyck @ 2017-01-04 16:50 UTC (permalink / raw)
  To: maowenan
  Cc: netdev, jeffrey.t.kirsher, Stephen Hemminger, weiyongjun (A),
	Dingtianhong, Wangzhou (B)

On Wed, Jan 4, 2017 at 1:02 AM, maowenan <maowenan@huawei.com> wrote:
>
>
>> -----Original Message-----
>> From: maowenan
>> Sent: Monday, December 26, 2016 4:33 PM
>> To: maowenan; 'Alexander Duyck'
>> Cc: 'Jeff Kirsher'; 'Stephen Hemminger'; 'netdev@vger.kernel.org'; weiyongjun
>> (A); Dingtianhong; Wangzhou (B)
>> Subject: RE: [PATCH] ethtool: add one ethtool option to set relax ordering mode
>>
>>
>>
>> > -----Original Message-----
>> > From: maowenan
>> > Sent: Saturday, December 24, 2016 4:30 PM
>> > To: 'Alexander Duyck'
>> > Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org;
>> > weiyongjun (A); Dingtianhong; Wangzhou (B)
>> > Subject: RE: [PATCH] ethtool: add one ethtool option to set relax
>> > ordering mode
>> >
>> >
>> >
>> > > -----Original Message-----
>> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
>> > > Sent: Friday, December 23, 2016 11:43 PM
>> > > To: maowenan
>> > > Cc: Jeff Kirsher; Stephen Hemminger; netdev@vger.kernel.org;
>> > > weiyongjun (A); Dingtianhong
>> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
>> > > ordering mode
>> > >
>> > > On Thu, Dec 22, 2016 at 10:14 PM, maowenan <maowenan@huawei.com>
>> > > wrote:
>> > > >
>> > > >
>> > > >> -----Original Message-----
>> > > >> From: Jeff Kirsher [mailto:jeffrey.t.kirsher@intel.com]
>> > > >> Sent: Friday, December 23, 2016 9:07 AM
>> > > >> To: maowenan; Alexander Duyck
>> > > >> Cc: Stephen Hemminger; netdev@vger.kernel.org; weiyongjun (A);
>> > > >> Dingtianhong
>> > > >> Subject: Re: [PATCH] ethtool: add one ethtool option to set relax
>> > > >> ordering mode
>> > > >>
>> > > >> On Fri, 2016-12-23 at 00:40 +0000, maowenan wrote:
>> > > >> > > -----Original Message-----
>> > > >> > > From: Alexander Duyck [mailto:alexander.duyck@gmail.com]
>> > > >> > > Sent: Thursday, December 22, 2016 11:54 PM
>> > > >> > > To: maowenan
>> > > >> > > Cc: Stephen Hemminger; netdev@vger.kernel.org;
>> > > jeffrey.t.kirsher@intel.
>> > > >> > > com;
>> > > >> > > weiyongjun (A); Dingtianhong
>> > > >> > > Subject: Re: [PATCH] ethtool: add one ethtool option to set
>> > > >> > > relax ordering mode
>> > > >> > >
>> > > >> > > On Wed, Dec 21, 2016 at 5:39 PM, maowenan
>> > > <maowenan@huawei.com>
>> > > >> > > wrote:
>> > > >> > > >
>> > > >> > > >
>> > > >> > > > > -----Original Message-----
>> > > >> > > > > From: Stephen Hemminger
>> > > >> > > > > [mailto:stephen@networkplumber.org]
>> > > >> > > > > Sent: Thursday, December 22, 2016 9:28 AM
>> > > >> > > > > To: maowenan
>> > > >> > > > > Cc: netdev@vger.kernel.org; jeffrey.t.kirsher@intel.com
>> > > >> > > > > Subject: Re: [PATCH] ethtool: add one ethtool option to
>> > > >> > > > > set relax ordering mode
>> > > >> > > > >
>> > > >> > > > > On Thu, 8 Dec 2016 14:51:38 +0800 Mao Wenan
>> > > >> > > > > <maowenan@huawei.com> wrote:
>> > > >> > > > >
>> > > >> > > > > > This patch provides one way to set/unset IXGBE NIC TX
>> > > >> > > > > > and RX relax ordering mode, which can be set by ethtool.
>> > > >> > > > > > Relax ordering is one mode of 82599 NIC, to enable this
>> > > >> > > > > > mode can enhance the performance for some cpu architecure.
>> > > >> > > > >
>> > > >> > > > > Then it should be done by CPU architecture specific
>> > > >> > > > > quirks (preferably in PCI
>> > > >> > > > > layer) so that all users get the option without having to
>> > > >> > > > > do manual
>> > > >> > >
>> > > >> > > intervention.
>> > > >> > > > >
>> > > >> > > > > > example:
>> > > >> > > > > > ethtool -s enp1s0f0 relaxorder off ethtool -s enp1s0f0
>> > > >> > > > > > relaxorder on
>> > > >> > > > >
>> > > >> > > > > Doing it via ethtool is a developer API (for testing) not
>> > > >> > > > > something that makes sense in production.
>> > > >> > > >
>> > > >> > > >
>> > > >> > > > This feature is not mandatory for all users, acturally
>> > > >> > > > relax ordering default configuration of 82599 is 'disable',
>> > > >> > > > So this patch gives one way to
>> > > >> > >
>> > > >> > > enable relax ordering to be selected in some performance condition.
>> > > >> > >
>> > > >> > > That isn't quite true.  The default for Sparc systems is to
>> > > >> > > have it enabled.
>> > > >> > >
>> > > >> > > Really this is something that is platform specific.  I agree
>> > > >> > > with Stephen that it would work better if this was handled as
>> > > >> > > a series of platform specific quirks handled at something
>> > > >> > > like the PCI layer rather than be a switch the user can toggle on and
>> off.
>> > > >> > >
>> > > >> > > With that being said there are changes being made that should
>> > > >> > > help to improve the situation.  Specifically I am looking at
>> > > >> > > adding support for the DMA_ATTR_WEAK_ORDERING which may
>> also
>> > > >> > > allow us to identify cases where you might be able to specify
>> > > >> > > the DMA behavior via the DMA mapping instead of having to
>> > > >> > > make the final decision in the device itself.
>> > > >> > >
>> > > >> > > - Alex
>> > > >> >
>> > > >> > Yes, Sparc is a special case. From the NIC driver point of
>> > > >> > view, It is no need for some ARCHs to do particular operation
>> > > >> > and compiling branch, ethtool is a flexible method for user to
>> > > >> > make decision whether
>> > > >> > on|off this feature.
>> > > >> > I think Jeff as maintainer of 82599 has some comments about this.
>> > > >>
>> > > >> My original comment/objection was that you attempted to do this
>> > > >> change as a module parameter to the ixgbe driver, where I
>> > > >> directed you to use ethtool so that other drivers could benefit
>> > > >> from the ability to enable/disable relaxed ordering.  As far as
>> > > >> how it gets implemented in ethtool or PCI layer, makes little
>> > > >> difference to me, I only had issues with the driver specific
>> > > >> module parameter implementation,
>> > > which is not acceptable.
>> > > >
>> > > >
>> > > > Thank you Jeff and Alex.
>> > > > And then I have gone through mail thread about "i40e: enable PCIe
>> > > > relax ordering for SPARC", It only works for SPARC, any other ARCH
>> > > > who wants to enable DMA_ATTR_WEAK_ORDERING feature, should
>> define
>> > > > the
>> > > new macro, recompile the driver module.
>> > > >
>> > > > Because of the above reasons, we implement in ethtool to give the
>> > > > final user a convenient way to on|off special feature, no need
>> > > > define new macro, easy to extend the new features, and also good
>> > > > benefit for other
>> > > driver as Jeff referred.
>> > > >
>> > >
>> > > I think the point is we shouldn't base the decision on user input.
>> > > The fact is the PCIe device control register should have a bit that
>> > > indicates if the device is allowed to enable relaxed ordering or not.
>> > > If we can guarantee that the bit is set in all the cases where it
>> > > should be set, and cleared in all the cases where it should not then
>> > > we could use something like that to determine if the device is
>> > > supposed to enable relaxed ordering instead of trying to make the
>> > > decision
>> > ourselves.
>> > >
>> > > - Alex
>> >
>> > ok. We are focusing on the register.
>> > And yes, to enable relax ordering for 82599 should be set by one or
>> > more bits of Rx/TX DCA Control Register, these bits should be set in
>> > many cpu architectures, such as arm64, sparc, and so on, and should be
>> cleared in other ARCHs.
>> > By the way, how do you enable SPARC macro, how and where to define
>> > this compiling macro when user one to enable relax ordering under SPARC
>> system?
>> > #ifndef CONFIG_SPARC
>> >
>> >
>>
>>
>> Hi, Alex,
>> Have you already sent out the patches about DMA_ATTR_WEAK_ORDERING?
>> We want to get you how to enable DMA_ATTR_WEAK_ORDERING by PCIe layer,
>> and we can refer to that.
>
> I have verified DMA_ATTR_WEAK_ORDERING is not usable for our system(arm64 and 82599),
> We should enable relax ordering in 82599 DCA control register to improve performance.
> As Stephen Hemminger do not suggest use ethtool to set relax ordering feature,
> @Jeff, do you agree with using erratum config to enable RO mode in 82599.
> Codes like below:
> In Kconfig:
> +config HI_ERRATUM_xxxx
>
> In ixgbe_82599.c
> #if !defined (CONFIG_SPARC) || !defined(HI_ERRATUM_xxxx)
>         /* Disable relaxed ordering */
>         for (i = 0; ((i < hw->mac.max_tx_queues) &&
>              (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) {
>                 regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i));
>                 regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN;
>                 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(i), regval);
>         }
>
>         for (i = 0; ((i < hw->mac.max_rx_queues) &&
>              (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) {
>                 regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i));
>                 regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN |
>                             IXGBE_DCA_RXCTRL_HEAD_WRO_EN);
>                 IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval);
>         }
> #endif

Instead of having the driver add a flag per architecture maybe it
would be worthwhile to look at adding a config flag that can be set
specifically for the architectures that need it.  Maybe something like
a "ARCH_WANT_RO_DMA" that then drivers could modify their relaxed
ordering flag based on.  Then you could just add the flag to the SPARC
and your arm64 kconfig options and not have to involve the other
architectures.

- Alex

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-01-04 16:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08  6:51 [PATCH] net: add one ethtool option to set relax ordering mode Mao Wenan
2016-12-08  6:51 ` [PATCH] ethtool: " Mao Wenan
2016-12-22  1:27   ` Stephen Hemminger
2016-12-22  1:39     ` maowenan
2016-12-22 15:53       ` Alexander Duyck
2016-12-23  0:40         ` maowenan
2016-12-23  1:06           ` Jeff Kirsher
2016-12-23  6:14             ` maowenan
2016-12-23 15:42               ` Alexander Duyck
2016-12-24  8:30                 ` maowenan
2016-12-26  8:33                 ` maowenan
2017-01-04  9:02                 ` maowenan
2017-01-04 16:50                   ` Alexander Duyck
2016-12-08 14:11 ` [PATCH] net: " Andrew Lunn
2016-12-12  8:30   ` maowenan
2016-12-22  0:10   ` maowenan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.