@@ -72,8 +72,8 @@ struct dsa_device_ops {
struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev);
struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
- int (*flow_dissect)(const struct sk_buff *skb, __be16 *proto,
- int *offset);
+ void (*flow_dissect)(const struct sk_buff *skb, __be16 *proto,
+ int *offset);
/* Used to determine which traffic should match the DSA filter in
* eth_type_trans, and which, if any, should bypass it and be processed
* as regular on the master net device.
@@ -774,4 +774,3 @@ static struct dsa_tag_driver *dsa_tag_driver_array[] = { \
}; \
module_dsa_tag_drivers(dsa_tag_driver_array)
#endif
-
@@ -971,12 +971,12 @@ bool __skb_flow_dissect(const struct net *net,
#if IS_ENABLED(CONFIG_NET_DSA)
if (unlikely(skb->dev && netdev_uses_dsa(skb->dev) &&
proto == htons(ETH_P_XDSA))) {
- const struct dsa_device_ops *ops;
+ typeof_member(struct dsa_device_ops, flow_dissect) fd;
int offset = 0;
- ops = skb->dev->dsa_ptr->tag_ops;
- if (ops->flow_dissect &&
- !ops->flow_dissect(skb, &proto, &offset)) {
+ fd = skb->dev->dsa_ptr->tag_ops->flow_dissect;
+ if (fd) {
+ fd(skb, &proto, &offset);
hlen -= offset;
nhoff += offset;
}
@@ -142,12 +142,11 @@ 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)
+static void dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+ int *offset)
{
*offset = 4;
*proto = ((__be16 *)skb->data)[1];
- return 0;
}
static const struct dsa_device_ops dsa_netdev_ops = {
@@ -161,12 +161,11 @@ 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)
+static void edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+ int *offset)
{
*offset = 8;
*proto = ((__be16 *)skb->data)[3];
- return 0;
}
static const struct dsa_device_ops edsa_netdev_ops = {
@@ -89,13 +89,11 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
return skb;
}
-static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
- int *offset)
+static void mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+ int *offset)
{
*offset = 4;
*proto = ((__be16 *)skb->data)[1];
-
- return 0;
}
static const struct dsa_device_ops mtk_netdev_ops = {
@@ -90,13 +90,11 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
return skb;
}
-static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
- int *offset)
+static void qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+ int *offset)
{
*offset = QCA_HDR_LEN;
*proto = ((__be16 *)skb->data)[0];
-
- return 0;
}
static const struct dsa_device_ops qca_netdev_ops = {
There are no tag protocols which return non-zero values from flow_dissect() callback. Remove it to simplify code and save some object size. If a particular tagger can't calculate offset and proto for some reason, it can simply leave the original values untouched. Signed-off-by: Alexander Lobakin <alobakin@dlink.ru> --- include/net/dsa.h | 5 ++--- net/core/flow_dissector.c | 8 ++++---- net/dsa/tag_dsa.c | 5 ++--- net/dsa/tag_edsa.c | 5 ++--- net/dsa/tag_mtk.c | 6 ++---- net/dsa/tag_qca.c | 6 ++---- 6 files changed, 14 insertions(+), 21 deletions(-)