mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
net: dsa: allow rcv() and xmit() to be optional
Allow rcv() and xmit() dsa driver ops to be optional in case a driver does not care to mangle a packet as in U-Boot only one network port is enabled at a time and thus no packet mangling is necessary. Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Fabio Estevam <festevam@denx.de> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
This commit is contained in:
@@ -142,6 +142,7 @@ static int dsa_port_send(struct udevice *pdev, void *packet, int length)
|
||||
struct dsa_port_pdata *port_pdata;
|
||||
int err;
|
||||
|
||||
if (ops->xmit) {
|
||||
if (length + head + tail > PKTSIZE_ALIGN)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -156,6 +157,7 @@ static int dsa_port_send(struct udevice *pdev, void *packet, int length)
|
||||
err = ops->xmit(dev, port_pdata->index, packet, length);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return eth_get_ops(master)->send(master, packet, length);
|
||||
}
|
||||
@@ -172,7 +174,7 @@ static int dsa_port_recv(struct udevice *pdev, int flags, uchar **packetp)
|
||||
int length, port_index, err;
|
||||
|
||||
length = eth_get_ops(master)->recv(master, flags, packetp);
|
||||
if (length <= 0)
|
||||
if (length <= 0 || !ops->rcv)
|
||||
return length;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user