- clib_memcpy (((u8 *) vlib_buffer_get_current (b0)) +
- bytes_copied + vlan_len,
- (u8 *) tph + tph->tp_mac + offset + bytes_copied,
- (bytes_to_copy - bytes_copied));
+ /* Check if the incoming skb is marked as CSUM_PARTIAL,
+ * If VNET Headers are enabled TP_STATUS_CSUMNOTREADY is
+ * equivalent to the vnet csum flag.
+ **/
+ if (PREDICT_TRUE ((do_vnet != 0) && (do_csum != 0)))
+ {
+ wsum_addr = (u16 *) (((u8 *) vlib_buffer_get_current (b0)) +
+ vlan_len + vh->csum_start +
+ vh->csum_offset);
+ if (bytes_copied <= vh->csum_start)
+ {
+ clib_memcpy (((u8 *) vlib_buffer_get_current (b0)) +
+ bytes_copied + vlan_len,
+ (u8 *) tph + tph->tp_mac + offset +
+ bytes_copied,
+ (vh->csum_start - bytes_copied));
+ wsum =
+ ip_csum_and_memcpy (wsum,
+ ((u8 *)
+ vlib_buffer_get_current (b0)) +
+ vh->csum_start + vlan_len,
+ (u8 *) tph + tph->tp_mac +
+ offset + vh->csum_start,
+ (bytes_to_copy - vh->csum_start));
+ }
+ else
+ {
+ wsum =
+ ip_csum_and_memcpy (wsum,
+ ((u8 *)
+ vlib_buffer_get_current (b0)) +
+ bytes_copied + vlan_len,
+ (u8 *) tph + tph->tp_mac +
+ offset + bytes_copied,
+ (bytes_to_copy - bytes_copied));
+ }
+ }
+ else
+ {
+ clib_memcpy (((u8 *) vlib_buffer_get_current (b0)) +
+ bytes_copied + vlan_len,
+ (u8 *) tph + tph->tp_mac + offset +
+ bytes_copied, (bytes_to_copy - bytes_copied));
+ }