ixgbe/igb: correctly obtain protocol information on transmit
Subsystems (2)
PATCH 1/1 ixgbe/igb: correctly obtain protocol information on transmit
I noticed a strange panic on a box with an ixgbe-based interface when using bridging. Protocol information ought to come from the frame itself rather than anywhere else.
The igb driver has a similar coding error that would cause incorrect flags to be set, so it would not panic. It should still get fixed though.
Checking the frame's payload on both drivers seems like a better option.
Signed-off-by Andy Gospodarek <[email protected]>
---
igb/igb_main.c | 3 ++- ixgbe/ixgbe_main.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/igb/igb_main.c +2 -1
@@ -2514,9 +2514,10 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, tu_cmd |= (E1000_TXD_CMD_DEXT |E1000_ADVTXD_DTYP_CTXT );if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +struct iphdr *iph =ip_hdr (skb);if (skb->protocol ==htons (ETH_P_IP )) tu_cmd |=E1000_ADVTXD_TUCMD_IPV4 ; -if (skb->sk && (skb->sk->sk_protocol ==IPPROTO_TCP )) +if (iph->protocol ==IPPROTO_TCP ) tu_cmd |=E1000_ADVTXD_TUCMD_L4T_TCP ; }
drivers/net/ixgbe/ixgbe_main.c +2 -1
@@ -2202,10 +2202,11 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter, IXGBE_ADVTXD_DTYP_CTXT);if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +struct iphdr *iph =ip_hdr (skb);if (skb->protocol ==htons (ETH_P_IP )) type_tucmd_mlhl |=IXGBE_ADVTXD_TUCMD_IPV4 ; -if (skb->sk->sk_protocol ==IPPROTO_TCP ) +if (iph->protocol ==IPPROTO_TCP ) type_tucmd_mlhl |=IXGBE_ADVTXD_TUCMD_L4T_TCP ; }