]> git.baikalelectronics.ru Git - kernel.git/commit
ionic: restrict received packets to mtu size
authorShannon Nelson <snelson@pensando.io>
Tue, 7 Jan 2020 03:43:48 +0000 (19:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Jan 2020 21:05:06 +0000 (13:05 -0800)
commit04daf506c8953566456a28faa7d7b04ab1c7b0ca
tree156bb1f8c6bd9e84de7e1c3f285b685015a8158f
parent1581bc11264a2c95f3966e0da0d63880e3ed7f9c
ionic: restrict received packets to mtu size

Make sure the NIC drops packets that are larger than the
specified MTU.

The front end of the NIC will accept packets larger than MTU and
will copy all the data it can to fill up the driver's posted
buffers - if the buffers are not long enough the packet will
then get dropped.  With the Rx SG buffers allocagted as full
pages, we are currently setting up more space than MTU size
available and end up receiving some packets that are larger
than MTU, up to the size of buffers posted.  To be sure the
NIC doesn't waste our time with oversized packets we need to
lie a little in the SG descriptor about how long is the last
SG element.

At dealloc time, we know the allocation was a page, so the
deallocation doesn't care about what length we put in the
descriptor.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_txrx.c