Re: [PATCH v4 01/13] net: add RX preprocessor support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 12, 2022 at 09:58:27AM +0200, Sascha Hauer wrote:
> On Fri, Apr 08, 2022 at 10:29:38AM +0200, Oleksij Rempel wrote:
> > 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;
> 
> ret == -ENOMSG means the packet has been handled by the preprocessor
> (and forwarded to the DSA virtual network devices). What about the other
> errors that rx_preprocessor can return? Shouldn't we ignore the packet
> on other errors?

Good point, will update it.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux