Skip to content

Commit

Permalink
dp-packet: Set checksum flags during software TSO.
Browse files Browse the repository at this point in the history
When OVS needs to fallback on the software TSO implementation to segment
a packet, it currently doesn't guarantee that IP and TCP checksum
offload flags are set. However, it is possible that these is required.
This is true in the case of dp_netdev_upcall(), which clears these
flags.

This patch explicitly sets the appropriate flags when the segmentation
flag is removed, to guarantee that packets always end up with correct
checksums.

Signed-off-by: Mike Pattrick <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
mkp-rh authored and ovsrobot committed Dec 19, 2023
1 parent 4cbbf56 commit f1e8336
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/dp-packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1131,11 +1131,23 @@ dp_packet_hwol_set_tcp_seg(struct dp_packet *b)
*dp_packet_ol_flags_ptr(b) |= DP_PACKET_OL_TX_TCP_SEG;
}

/* Resets TCP Segmentation flag in packet 'p'. */
/* Resets TCP Segmentation in packet 'p' and adjust flags to indicate
* L3 and L4 checksumming is now required. */
static inline void
dp_packet_hwol_reset_tcp_seg(struct dp_packet *p)
{
*dp_packet_ol_flags_ptr(p) &= ~DP_PACKET_OL_TX_TCP_SEG;
uint64_t ol_flags = *dp_packet_ol_flags_ptr(p)
| DP_PACKET_OL_TX_TCP_CKSUM;

ol_flags = ol_flags & ~(DP_PACKET_OL_TX_TCP_SEG
| DP_PACKET_OL_RX_L4_CKSUM_MASK
| DP_PACKET_OL_RX_IP_CKSUM_GOOD);

if (ol_flags & DP_PACKET_OL_TX_IPV4) {
ol_flags |= DP_PACKET_OL_TX_IP_CKSUM;
}

*dp_packet_ol_flags_ptr(p) = ol_flags;
}

/* Returns 'true' if the IP header has good integrity and the
Expand Down

0 comments on commit f1e8336

Please sign in to comment.