Skip to content

Commit 41c1ef9

Browse files
harini-katakamdavem330
authored andcommitted
net: macb: Remove unnecessary alignment check for TSO
The IP TSO implementation does NOT require the length to be a multiple of 8. That is only a requirement for UFO as per IP documentation. Hence, exit macb_features_check function in the beginning if the protocol is not UDP. Only when it is UDP, proceed further to the alignment checks. Update comments to reflect the same. Also remove dead code checking for protocol TCP when calculating header length. Fixes: 1629dd4 ("cadence: Add LSO support.") Signed-off-by: Harini Katakam <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 38f88c4 commit 41c1ef9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,16 +1791,14 @@ static netdev_features_t macb_features_check(struct sk_buff *skb,
17911791

17921792
/* Validate LSO compatibility */
17931793

1794-
/* there is only one buffer */
1795-
if (!skb_is_nonlinear(skb))
1794+
/* there is only one buffer or protocol is not UDP */
1795+
if (!skb_is_nonlinear(skb) || (ip_hdr(skb)->protocol != IPPROTO_UDP))
17961796
return features;
17971797

17981798
/* length of header */
17991799
hdrlen = skb_transport_offset(skb);
1800-
if (ip_hdr(skb)->protocol == IPPROTO_TCP)
1801-
hdrlen += tcp_hdrlen(skb);
18021800

1803-
/* For LSO:
1801+
/* For UFO only:
18041802
* When software supplies two or more payload buffers all payload buffers
18051803
* apart from the last must be a multiple of 8 bytes in size.
18061804
*/

0 commit comments

Comments
 (0)