Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1653269 > unrolled thread
| Started by | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| First post | 2017-05-30 16:30 +0200 |
| Last post | 2017-05-30 17:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH net-next 6/7] net: dsa: remove useless copy of tagger xmit Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
Re: [PATCH net-next 6/7] net: dsa: remove useless copy of tagger xmit Andrew Lunn <andrew@lunn.ch> - 2017-05-30 17:30 +0200
Re: [PATCH net-next 6/7] net: dsa: remove useless copy of tagger xmit Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 17:50 +0200
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2017-05-30 16:30 +0200 |
| Subject | [PATCH net-next 6/7] net: dsa: remove useless copy of tagger xmit |
| Message-ID | <tMQjL-8vK-1@gated-at.bofh.it> |
The dsa_slave_priv structure holds a copy of the dsa_device_ops xmit
function. It is always assigned to the switch tree xmit function.
Remove this useless copy.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/dsa/dsa_priv.h | 3 ---
net/dsa/slave.c | 4 +---
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 0fdd2a8a4ad8..282a55639285 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -71,9 +71,6 @@ struct dsa_device_ops {
};
struct dsa_slave_priv {
- struct sk_buff * (*xmit)(struct sk_buff *skb,
- struct net_device *dev);
-
/* DSA port data, such as switch, port index, etc. */
struct dsa_port *dp;
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 887e26695519..ebad2af4d3a8 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -363,7 +363,7 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
dev->stats.tx_bytes += skb->len;
/* Transmit function may have to reallocate the original SKB */
- nskb = p->xmit(skb, dev);
+ nskb = p->dp->ds->dst->tag_ops->xmit(skb, dev);
if (!nskb)
return NETDEV_TX_OK;
@@ -1136,7 +1136,6 @@ int dsa_slave_resume(struct net_device *slave_dev)
int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
int port, const char *name)
{
- struct dsa_switch_tree *dst = ds->dst;
struct net_device *master;
struct net_device *slave_dev;
struct dsa_slave_priv *p;
@@ -1172,7 +1171,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
p = netdev_priv(slave_dev);
p->dp = &ds->ports[port];
INIT_LIST_HEAD(&p->mall_tc_list);
- p->xmit = dst->tag_ops->xmit;
p->old_pause = -1;
p->old_link = -1;
--
2.13.0
[toc] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2017-05-30 17:30 +0200 |
| Message-ID | <tMRfQ-DG-17@gated-at.bofh.it> |
| In reply to | #1653269 |
On Tue, May 30, 2017 at 10:21:30AM -0400, Vivien Didelot wrote:
> The dsa_slave_priv structure holds a copy of the dsa_device_ops xmit
> function. It is always assigned to the switch tree xmit function.
>
> Remove this useless copy.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> net/dsa/dsa_priv.h | 3 ---
> net/dsa/slave.c | 4 +---
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index 0fdd2a8a4ad8..282a55639285 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -71,9 +71,6 @@ struct dsa_device_ops {
> };
>
> struct dsa_slave_priv {
> - struct sk_buff * (*xmit)(struct sk_buff *skb,
> - struct net_device *dev);
> -
> /* DSA port data, such as switch, port index, etc. */
> struct dsa_port *dp;
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 887e26695519..ebad2af4d3a8 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -363,7 +363,7 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
> dev->stats.tx_bytes += skb->len;
>
> /* Transmit function may have to reallocate the original SKB */
> - nskb = p->xmit(skb, dev);
> + nskb = p->dp->ds->dst->tag_ops->xmit(skb, dev);
This is also the hot path for DSA transmit. Do we really want to do 4
extra pointer dereferences a million times per second, compared to one
copy during setup?
Andrew
[toc] | [prev] | [next] | [standalone]
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2017-05-30 17:50 +0200 |
| Message-ID | <tMRzc-KJ-3@gated-at.bofh.it> |
| In reply to | #1653321 |
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
>> /* Transmit function may have to reallocate the original SKB */
>> - nskb = p->xmit(skb, dev);
>> + nskb = p->dp->ds->dst->tag_ops->xmit(skb, dev);
>
> This is also the hot path for DSA transmit. Do we really want to do 4
> extra pointer dereferences a million times per second, compared to one
> copy during setup?
Yep I get the idea. It felt weird to copy structure members like this
and not at least reusing the dsa_device_ops structure.
Thanks,
Vivien
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web