diff mbox

[net-next] sunvnet: fix rx packet length check to allow for TSO

Message ID 54B559A1.9010303@oracle.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David L Stevens Jan. 13, 2015, 5:45 p.m. UTC
This patch fixes the rx packet length check in the sunvnet driver to allow
for a TSO max packet length greater than the LDC channel negotiated MTU.
These are negotiated separately and there is no requirement that
port->tsolen be less than port->rmtu, but if it isn't, it'll drop packets
with rx length errors.

Signed-off-by: David L Stevens <david.stevens@oracle.com>
---
 drivers/net/ethernet/sun/sunvnet.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Sowmini Varadhan Jan. 13, 2015, 6:01 p.m. UTC | #1
On (01/13/15 12:45), David L Stevens wrote:
> 
> This patch fixes the rx packet length check in the sunvnet driver to allow
> for a TSO max packet length greater than the LDC channel negotiated MTU.
> These are negotiated separately and there is no requirement that
> port->tsolen be less than port->rmtu, but if it isn't, it'll drop packets
> with rx length errors.
> 
> Signed-off-by: David L Stevens <david.stevens@oracle.com>

Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>

--Sowmini


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Jan. 13, 2015, 10:24 p.m. UTC | #2
From: David L Stevens <david.stevens@oracle.com>
Date: Tue, 13 Jan 2015 12:45:05 -0500

> This patch fixes the rx packet length check in the sunvnet driver to allow
> for a TSO max packet length greater than the LDC channel negotiated MTU.
> These are negotiated separately and there is no requirement that
> port->tsolen be less than port->rmtu, but if it isn't, it'll drop packets
> with rx length errors.
> 
> Signed-off-by: David L Stevens <david.stevens@oracle.com>

Applied, thanks David.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index d2835bf..b5a1d3d 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -351,10 +351,15 @@  static int vnet_rx_one(struct vnet_port *port, struct vio_net_desc *desc)
 	unsigned int len = desc->size;
 	unsigned int copy_len;
 	struct sk_buff *skb;
+	int maxlen;
 	int err;
 
 	err = -EMSGSIZE;
-	if (unlikely(len < ETH_ZLEN || len > port->rmtu)) {
+	if (port->tso && port->tsolen > port->rmtu)
+		maxlen = port->tsolen;
+	else
+		maxlen = port->rmtu;
+	if (unlikely(len < ETH_ZLEN || len > maxlen)) {
 		dev->stats.rx_length_errors++;
 		goto out_dropped;
 	}