[PATCH 03/21] ARCNET: capmode: fix transfer length

From: Michael Grzeschik
Date: Fri Apr 24 2015 - 13:27:15 EST


The commit <52edc17f94f7bd4d9> ("bugfixes and new hardware support for
arcnet driver") adds fixes for the packet length calculations in
arc-rawmode. As the capmode protocol is derived from the arc-rawmode
code, the capmode also needs the fixes.

rx():
- Fixed error in received packet lengths; 256 byte packets were
being received as 257 bytes packets.

prepare_tx():
- Fixed error in transmit length calcs; 257 byte packets were being
transmitted as 260 byte packets.

Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
---
drivers/net/arcnet/capmode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c
index 42fce91..b6868a2 100644
--- a/drivers/net/arcnet/capmode.c
+++ b/drivers/net/arcnet/capmode.c
@@ -49,7 +49,7 @@ static void rx(struct net_device *dev, int bufnum,

BUGMSG(D_DURING, "it's a raw(cap) packet (length=%d)\n", length);

- if (length >= MinTU)
+ if (length > MTU)
ofs = 512 - length;
else
ofs = 256 - length;
@@ -156,7 +156,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
length, XMTU);
length = XMTU;
}
- if (length > MinTU) {
+ if (length >= MinTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length;
} else if (length > MTU) {
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/