}
static u32 enetc_update_ptp_sync_msg(struct enetc_ndev_priv *priv,
- struct sk_buff *skb)
+ struct sk_buff *skb, bool csum_offload)
{
struct enetc_skb_cb *enetc_cb = ENETC_SKB_CB(skb);
u16 tstamp_off = enetc_cb->origin_tstamp_off;
* - 48 bits seconds field
* - 32 bits nanseconds field
*
- * In addition, the UDP checksum needs to be updated
- * by software after updating originTimestamp field,
- * otherwise the hardware will calculate the wrong
- * checksum when updating the correction field and
- * update it to the packet.
+ * In addition, if csum_offload is false, the UDP checksum needs
+ * to be updated by software after updating originTimestamp field,
+ * otherwise the hardware will calculate the wrong checksum when
+ * updating the correction field and update it to the packet.
*/
data = skb_mac_header(skb);
new_sec_h = htons((sec >> 32) & 0xffff);
new_sec_l = htonl(sec & 0xffffffff);
new_nsec = htonl(nsec);
- if (enetc_cb->udp) {
+ if (enetc_cb->udp && !csum_offload) {
struct udphdr *uh = udp_hdr(skb);
__be32 old_sec_l, old_nsec;
__be16 old_sec_h;
struct enetc_tx_swbd *tx_swbd;
int len = skb_headlen(skb);
union enetc_tx_bd temp_bd;
+ bool csum_offload = false;
union enetc_tx_bd *txbd;
int i, count = 0;
skb_frag_t *frag;
temp_bd.l4_aux = FIELD_PREP(ENETC_TX_BD_L4T,
ENETC_TXBD_L4T_UDP);
flags |= ENETC_TXBD_FLAGS_CSUM_LSO | ENETC_TXBD_FLAGS_L4CS;
+ csum_offload = true;
} else if (skb_checksum_help(skb)) {
return 0;
}
if (enetc_cb->flag & ENETC_F_TX_ONESTEP_SYNC_TSTAMP) {
do_onestep_tstamp = true;
- tstamp = enetc_update_ptp_sync_msg(priv, skb);
+ tstamp = enetc_update_ptp_sync_msg(priv, skb, csum_offload);
} else if (enetc_cb->flag & ENETC_F_TX_TSTAMP) {
do_twostep_tstamp = true;
}