lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 31 Jul 2016 10:15:52 +0000
From:	"Levy, Amir (Jer)" <amir.jer.levy@...el.com>
To:	Stephen Hemminger <stephen@...workplumber.org>
CC:	"andreas.noever@...il.com" <andreas.noever@...il.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
	"corbet@....net" <corbet@....net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	thunderbolt-linux <thunderbolt-linux@...el.com>,
	"Westerberg, Mika" <mika.westerberg@...el.com>,
	"Winkler, Tomas" <tomas.winkler@...el.com>
Subject: RE: [PATCH v5 6/8] thunderbolt: Networking transmit and receive

On Sat, Jul 30 2016, 12:07 AM, Stephen Hemminger wrote:
> On Thu, 28 Jul 2016 11:15:19 +0300
> Amir Levy <amir.jer.levy@...el.com> wrote:
> 
> > +		/* pad short packets */
> > +		if (unlikely(skb->len < ETH_ZLEN)) {
> > +			int pad_len = ETH_ZLEN - skb->len;
> > +
> > +			/* The skb is freed on error */
> > +			if (unlikely(skb_pad(skb, pad_len))) {
> > +				cleaned_count += frame_count;
> > +				continue;
> > +			}
> > +			__skb_put(skb, pad_len);
> > +		}
> 
> Packets should be padded on transmit, not on receive??

This driver emulates an Ethernet adapter on top of Thunderbolt technology.
The Thunderbolt medium hasn't any restriction on minimum frame size and doesn't have the Ethernet collision detection limitation.
So moving this code from transmit is actually an optimization - sending the minimum on the wire.
The network stack thinks it is Ethernet, it might not accept Runt frames, so the driver pads the frame in receive.

Looks like it deserves a comment in the code. Will add it.

Powered by blists - more mailing lists