netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa.
@ 2019-02-16  8:35 Rundong Ge
  2019-02-16  8:38 ` Rundong Ge
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rundong Ge @ 2019-02-16  8:35 UTC (permalink / raw)
  To: andrew; +Cc: vivien.didelot, f.fainelli, davem, netdev, linux-kernel, rdong.ge

RPS not work for DSA devices since the 'skb_get_hash'
will always get the invalid hash for dsa tagged packets.

"[PATCH] tag_mtk: add flow_dissect callback to the ops struct"
introduced the flow_dissect callback to get the right hash for
MTK tagged packet. Tag_dsa and tag_edsa  also need to implement
the callback.

Signed-off-by: Rundong Ge <rdong.ge@gmail.com>
---
 net/dsa/tag_dsa.c  | 9 +++++++++
 net/dsa/tag_edsa.c | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 8b2f92e..67ff3fa 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -146,8 +146,17 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
 	return skb;
 }
 
+static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+				int *offset)
+{
+	*offset = 4;
+	*proto = ((__be16 *)skb->data)[1];
+	return 0;
+}
+
 const struct dsa_device_ops dsa_netdev_ops = {
 	.xmit	= dsa_xmit,
 	.rcv	= dsa_rcv,
+	.flow_dissect   = dsa_tag_flow_dissect,
 	.overhead = DSA_HLEN,
 };
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index f5b87ee..234585e 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -165,8 +165,17 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,
 	return skb;
 }
 
+static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+				 int *offset)
+{
+	*offset = 8;
+	*proto = ((__be16 *)skb->data)[3];
+	return 0;
+}
+
 const struct dsa_device_ops edsa_netdev_ops = {
 	.xmit	= edsa_xmit,
 	.rcv	= edsa_rcv,
+	.flow_dissect   = edsa_tag_flow_dissect,
 	.overhead = EDSA_HLEN,
 };
-- 
1.8.3.1


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

* Re: [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa.
  2019-02-16  8:35 [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa Rundong Ge
@ 2019-02-16  8:38 ` Rundong Ge
  2019-02-16 15:35   ` Andrew Lunn
  2019-02-16 15:42 ` Andrew Lunn
  2019-02-19  0:36 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Rundong Ge @ 2019-02-16  8:38 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: vivien.didelot, Florian Fainelli, davem, netdev, linux-kernel

Hi Andrew

I have tested the L3 forwarding throughput performance of my box (with
an intel 4-core processor and each core’s frequency is 2.20GHz).
In my test scenario, I generated 200 UDP flows (frame size is 64
bytes) with different src/dst pairs from eth1 to eth0. Eth1 is a slave
DSA device from mv88e6190x, eth0 is an intel NIC. Then get the max fps
with no frame losing.

The max fps with RPS working is 400235fps, frames are hashed to four
cores’ backlog.
And the max fps without RPS is 199686fps.

Rundong

Rundong Ge <rdong.ge@gmail.com> 于2019年2月16日周六 下午4:35写道:
>
> RPS not work for DSA devices since the 'skb_get_hash'
> will always get the invalid hash for dsa tagged packets.
>
> "[PATCH] tag_mtk: add flow_dissect callback to the ops struct"
> introduced the flow_dissect callback to get the right hash for
> MTK tagged packet. Tag_dsa and tag_edsa  also need to implement
> the callback.
>
> Signed-off-by: Rundong Ge <rdong.ge@gmail.com>
> ---
>  net/dsa/tag_dsa.c  | 9 +++++++++
>  net/dsa/tag_edsa.c | 9 +++++++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
> index 8b2f92e..67ff3fa 100644
> --- a/net/dsa/tag_dsa.c
> +++ b/net/dsa/tag_dsa.c
> @@ -146,8 +146,17 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
>         return skb;
>  }
>
> +static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
> +                               int *offset)
> +{
> +       *offset = 4;
> +       *proto = ((__be16 *)skb->data)[1];
> +       return 0;
> +}
> +
>  const struct dsa_device_ops dsa_netdev_ops = {
>         .xmit   = dsa_xmit,
>         .rcv    = dsa_rcv,
> +       .flow_dissect   = dsa_tag_flow_dissect,
>         .overhead = DSA_HLEN,
>  };
> diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
> index f5b87ee..234585e 100644
> --- a/net/dsa/tag_edsa.c
> +++ b/net/dsa/tag_edsa.c
> @@ -165,8 +165,17 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,
>         return skb;
>  }
>
> +static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
> +                                int *offset)
> +{
> +       *offset = 8;
> +       *proto = ((__be16 *)skb->data)[3];
> +       return 0;
> +}
> +
>  const struct dsa_device_ops edsa_netdev_ops = {
>         .xmit   = edsa_xmit,
>         .rcv    = edsa_rcv,
> +       .flow_dissect   = edsa_tag_flow_dissect,
>         .overhead = EDSA_HLEN,
>  };
> --
> 1.8.3.1
>

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

* Re: [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa.
  2019-02-16  8:38 ` Rundong Ge
@ 2019-02-16 15:35   ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2019-02-16 15:35 UTC (permalink / raw)
  To: Rundong Ge; +Cc: vivien.didelot, Florian Fainelli, davem, netdev, linux-kernel

On Sat, Feb 16, 2019 at 04:38:25PM +0800, Rundong Ge wrote:
> Hi Andrew
> 
> I have tested the L3 forwarding throughput performance of my box (with
> an intel 4-core processor and each core’s frequency is 2.20GHz).
> In my test scenario, I generated 200 UDP flows (frame size is 64
> bytes) with different src/dst pairs from eth1 to eth0. Eth1 is a slave
> DSA device from mv88e6190x, eth0 is an intel NIC. Then get the max fps
> with no frame losing.
> 
> The max fps with RPS working is 400235fps, frames are hashed to four
> cores’ backlog.
> And the max fps without RPS is 199686fps.

Nice numbers, thanks.

     Andrew

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

* Re: [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa.
  2019-02-16  8:35 [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa Rundong Ge
  2019-02-16  8:38 ` Rundong Ge
@ 2019-02-16 15:42 ` Andrew Lunn
  2019-02-19  0:36 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2019-02-16 15:42 UTC (permalink / raw)
  To: Rundong Ge; +Cc: vivien.didelot, f.fainelli, davem, netdev, linux-kernel

On Sat, Feb 16, 2019 at 08:35:24AM +0000, Rundong Ge wrote:
> RPS not work for DSA devices since the 'skb_get_hash'
> will always get the invalid hash for dsa tagged packets.
> 
> "[PATCH] tag_mtk: add flow_dissect callback to the ops struct"
> introduced the flow_dissect callback to get the right hash for
> MTK tagged packet. Tag_dsa and tag_edsa  also need to implement
> the callback.
> 
> Signed-off-by: Rundong Ge <rdong.ge@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa.
  2019-02-16  8:35 [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa Rundong Ge
  2019-02-16  8:38 ` Rundong Ge
  2019-02-16 15:42 ` Andrew Lunn
@ 2019-02-19  0:36 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-02-19  0:36 UTC (permalink / raw)
  To: rdong.ge; +Cc: andrew, vivien.didelot, f.fainelli, netdev, linux-kernel

From: Rundong Ge <rdong.ge@gmail.com>
Date: Sat, 16 Feb 2019 08:35:24 +0000

> RPS not work for DSA devices since the 'skb_get_hash'
> will always get the invalid hash for dsa tagged packets.
> 
> "[PATCH] tag_mtk: add flow_dissect callback to the ops struct"
> introduced the flow_dissect callback to get the right hash for
> MTK tagged packet. Tag_dsa and tag_edsa  also need to implement
> the callback.
> 
> Signed-off-by: Rundong Ge <rdong.ge@gmail.com>

Applied to net-next.

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

end of thread, other threads:[~2019-02-19  0:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-16  8:35 [PATCH v2] net: dsa: Implement flow_dissect callback for tag_dsa Rundong Ge
2019-02-16  8:38 ` Rundong Ge
2019-02-16 15:35   ` Andrew Lunn
2019-02-16 15:42 ` Andrew Lunn
2019-02-19  0:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).