ionic: count SGs in packet to minimize linearize
authorShannon Nelson <shannon.nelson@amd.com>
Mon, 18 Sep 2023 22:21:34 +0000 (15:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Sep 2023 09:52:31 +0000 (10:52 +0100)
commit4d9d72200d4c69710e8371c872449c46bcab646f
tree5573031c0dff51a8aa904999e1a6cef13defae33
parent4fa7011d4f22d5b2e14cba19b524a4f90268b5c1
ionic: count SGs in packet to minimize linearize

There are some cases where an skb carries more frags than the
number of SGs that ionic can support per descriptor - this
forces the driver to linearize the skb.  However, if this
is a TSO packet that is going to become multiple descriptors
(one per MTU-sized packet) and spread the frags across them,
this time-consuming linearization is likely not necessary.

We scan the frag list and count up the number of SGs that
would be created for each descriptor that would be generated,
and only linearize if we hit the SG limit on a descriptor.
In most cases, we won't even get to the frag list scan, so
this doesn't affect typical traffic.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_txrx.c