]> git.baikalelectronics.ru Git - kernel.git/commit
asix: Simplify asix_rx_fixup_internal() netdev alloc
authorDean Jenkins <Dean_Jenkins@mentor.com>
Fri, 2 Oct 2015 13:29:06 +0000 (14:29 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Oct 2015 13:58:41 +0000 (06:58 -0700)
commit2bc1ac521b390eaabea212e035c579b43942c18e
tree9f739aa521400ea6c9ce482fe2b5ffa80660ca43
parent068168f1d73cc69ccea44a170ecec89521a27459
asix: Simplify asix_rx_fixup_internal() netdev alloc

The code is checking that the Ethernet frame will fit into a
netdev allocated socket buffer within the constraints of MTU size,
Ethernet header length plus VLAN header length.

The original code was checking rx->remaining each loop of the while
loop that processes multiple Ethernet frames per URB and/or Ethernet
frames that span across URBs. rx->remaining decreases per while loop
so there is no point in potentially checking multiple times that the
Ethernet frame (remaining part) will fit into the netdev socket buffer.

The modification checks that the size of the Ethernet frame will fit
the netdev socket buffer before allocating the netdev socket buffer.
This avoids grabbing memory and then deciding that the Ethernet frame
is too big and then freeing the memory.

Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Mark Craske <Mark_Craske@mentor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/asix_common.c