OSDN Git Service

net/macb: add scatter-gather hw feature
authorCyrille Pitchen <cyrille.pitchen@atmel.com>
Thu, 24 Jul 2014 11:50:59 +0000 (13:50 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Jul 2014 06:39:55 +0000 (23:39 -0700)
commita4c35ed3fb1a1840d58d8ae5ea8070ff63075bc2
tree4cc1703f907c38442192c3d12c57fc6e861bca00
parente175587f4d32de27182f5d28d70734b1e812905d
net/macb: add scatter-gather hw feature

The scatter-gather feature will allow to enable the Generic Segmentation Offload.
Generic Segmentation Offload can be enabled/disabled using ethtool -K DEVNAME gso on|off.

e.g:
ethtool -K eth0 gso off

When enabled, the driver may be provided with socket buffers splitted into many fragments.
These fragments need to be queued into the TX ring in reverse order, starting from to the
last one down to the first one, to avoid a race condition with the MAC.
Especially the 'TX_USED' bit in word 1 of the transmit buffer descriptor of the
first fragment should be cleared at the very final step of the queueing algorithm.
This will tell the hardware that fragments are ready to be sent.

Also since the MAC only update the status word of the first buffer descriptor of the
ethernet frame, the queueing algorithm can no longer expect a 'TX_USED' bit to be set by
the MAC into the buffer descriptor following the one for last fragment of the skb.
This is why the driver sets the 'TX_USED' bit before queueing any fragment, so the end of
queue position is well defined for the MAC.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb.c
drivers/net/ethernet/cadence/macb.h