Add callback for optional rx_preprocessor. This is needed to add DSA switch support and demultiplex traffic received from different switch ports. Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- include/net.h | 3 +++ net/net.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/net.h b/include/net.h index aad28e4f4c..ca9b6cd61e 100644 --- a/include/net.h +++ b/include/net.h @@ -44,9 +44,12 @@ struct eth_device { void (*halt) (struct eth_device*); int (*get_ethaddr) (struct eth_device*, u8 adr[6]); int (*set_ethaddr) (struct eth_device*, const unsigned char *adr); + int (*rx_preprocessor) (struct eth_device*, unsigned char **packet, + int *length); struct eth_device *next; void *priv; + void *rx_preprocessor_priv; /* phy device may attach itself for hardware timestamping */ struct phy_device *phydev; diff --git a/net/net.c b/net/net.c index fdb9ab826c..dd2ceb396d 100644 --- a/net/net.c +++ b/net/net.c @@ -708,6 +708,12 @@ int net_receive(struct eth_device *edev, unsigned char *pkt, int len) goto out; } + if (edev->rx_preprocessor) { + ret = edev->rx_preprocessor(edev, &pkt, &len); + if (ret == -ENOMSG) + return 0; + } + switch (et_protlen) { case PROT_ARP: ret = net_handle_arp(edev, pkt, len); -- 2.30.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox