Commit 3e41f93b authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: prepare master receive hot path

In preparation to make DSA master devices point to their corresponding
CPU port instead of the whole tree, add copies of dst and rcv in the
dsa_port structure so that we keep fast access in the receive hot path.

Also keep the copies at the beginning of the dsa_port structure in order
to ensure they are available in cacheline 1.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 15240248
......@@ -178,6 +178,11 @@ struct dsa_port {
/* CPU port tagging operations used by master or slave devices */
const struct dsa_device_ops *tag_ops;
/* Copies for faster access in master receive hot path */
struct dsa_switch_tree *dst;
struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
struct dsa_switch *ds;
unsigned int index;
const char *name;
......
......@@ -524,7 +524,11 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
dst->cpu_dp->tag_ops = tag_ops;
dst->tag_ops = tag_ops;
/* Make a few copies for faster access in master receive hot path */
dst->cpu_dp->rcv = dst->cpu_dp->tag_ops->rcv;
dst->rcv = dst->tag_ops->rcv;
dst->cpu_dp->dst = dst;
return 0;
}
......
......@@ -154,7 +154,11 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
dst->cpu_dp->tag_ops = tag_ops;
dst->tag_ops = tag_ops;
/* Few copies for faster access in master receive hot path */
dst->cpu_dp->rcv = dst->cpu_dp->tag_ops->rcv;
dst->rcv = dst->tag_ops->rcv;
dst->cpu_dp->dst = dst;
}
memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment