@@ -2095,7 +2095,7 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type,
COVERAGE_INC(conntrack_l3csum_err);
} else {
bool hwol_good_l3_csum = dp_packet_ip_checksum_valid(pkt)
- || dp_packet_ol_is_ipv4(pkt);
+ || dp_packet_ol_tx_ipv4(pkt);
/* Validate the checksum only when hwol is not supported. */
ok = extract_l3_ipv4(&ctx->key, l3, dp_packet_l3_size(pkt), NULL,
!hwol_good_l3_csum);
@@ -3402,7 +3402,7 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx,
}
if (seq_skew) {
ip_len = ntohs(l3_hdr->ip_tot_len) + seq_skew;
- if (!dp_packet_ol_is_ipv4(pkt)) {
+ if (!dp_packet_ol_tx_ipv4(pkt)) {
l3_hdr->ip_csum = recalc_csum16(l3_hdr->ip_csum,
l3_hdr->ip_tot_len,
htons(ip_len));
@@ -981,14 +981,14 @@ dp_packet_ol_tcp_seg(const struct dp_packet *a)
/* Returns 'true' if packet 'a' is marked for IPv4 checksum offloading. */
static inline bool
-dp_packet_ol_is_ipv4(const struct dp_packet *a)
+dp_packet_ol_tx_ipv4(const struct dp_packet *a)
{
return !!(*dp_packet_ol_flags_ptr(a) & DP_PACKET_OL_TX_IPV4);
}
/* Returns 'true' if packet 'a' is marked for TCP checksum offloading. */
static inline bool
-dp_packet_ol_l4_is_tcp(const struct dp_packet *a)
+dp_packet_ol_tx_tcp_csum(const struct dp_packet *a)
{
return (*dp_packet_ol_flags_ptr(a) & DP_PACKET_OL_TX_L4_MASK) ==
DP_PACKET_OL_TX_TCP_CSUM;
@@ -996,7 +996,7 @@ dp_packet_ol_l4_is_tcp(const struct dp_packet *a)
/* Returns 'true' if packet 'a' is marked for UDP checksum offloading. */
static inline bool
-dp_packet_ol_l4_is_udp(struct dp_packet *a)
+dp_packet_ol_tx_udp_csum(struct dp_packet *a)
{
return (*dp_packet_ol_flags_ptr(a) & DP_PACKET_OL_TX_L4_MASK) ==
DP_PACKET_OL_TX_UDP_CSUM;
@@ -1004,7 +1004,7 @@ dp_packet_ol_l4_is_udp(struct dp_packet *a)
/* Returns 'true' if packet 'a' is marked for SCTP checksum offloading. */
static inline bool
-dp_packet_ol_l4_is_sctp(struct dp_packet *a)
+dp_packet_ol_tx_sctp_csum(struct dp_packet *a)
{
return (*dp_packet_ol_flags_ptr(a) & DP_PACKET_OL_TX_L4_MASK) ==
DP_PACKET_OL_TX_SCTP_CSUM;
@@ -1027,7 +1027,7 @@ dp_packet_ol_set_tx_ipv6(struct dp_packet *a)
/* Mark packet 'a' for TCP checksum offloading. It implies that either
* the packet 'a' is marked for IPv4 or IPv6 checksum offloading. */
static inline void
-dp_packet_ol_set_csum_tcp(struct dp_packet *a)
+dp_packet_ol_set_tx_tcp_csum(struct dp_packet *a)
{
*dp_packet_ol_flags_ptr(a) |= DP_PACKET_OL_TX_TCP_CSUM;
}
@@ -1035,7 +1035,7 @@ dp_packet_ol_set_csum_tcp(struct dp_packet *a)
/* Mark packet 'a' for UDP checksum offloading. It implies that either
* the packet 'a' is marked for IPv4 or IPv6 checksum offloading. */
static inline void
-dp_packet_ol_set_csum_udp(struct dp_packet *a)
+dp_packet_ol_set_tx_udp_csum(struct dp_packet *a)
{
*dp_packet_ol_flags_ptr(a) |= DP_PACKET_OL_TX_UDP_CSUM;
}
@@ -1043,7 +1043,7 @@ dp_packet_ol_set_csum_udp(struct dp_packet *a)
/* Mark packet 'a' for SCTP checksum offloading. It implies that either
* the packet 'a' is marked for IPv4 or IPv6 checksum offloading. */
static inline void
-dp_packet_ol_set_csum_sctp(struct dp_packet *a)
+dp_packet_ol_set_tx_sctp_csum(struct dp_packet *a)
{
*dp_packet_ol_flags_ptr(a) |= DP_PACKET_OL_TX_SCTP_CSUM;
}
@@ -433,7 +433,7 @@ ipf_reassemble_v4_frags(struct ipf_list *ipf_list)
len += rest_len;
l3 = dp_packet_l3(pkt);
ovs_be16 new_ip_frag_off = l3->ip_frag_off & ~htons(IP_MORE_FRAGMENTS);
- if (!dp_packet_ol_is_ipv4(pkt)) {
+ if (!dp_packet_ol_tx_ipv4(pkt)) {
l3->ip_csum = recalc_csum16(l3->ip_csum, l3->ip_frag_off,
new_ip_frag_off);
l3->ip_csum = recalc_csum16(l3->ip_csum, l3->ip_tot_len, htons(len));
@@ -609,7 +609,7 @@ ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt)
}
if (OVS_UNLIKELY(!dp_packet_ip_checksum_valid(pkt)
- && !dp_packet_ol_is_ipv4(pkt)
+ && !dp_packet_ol_tx_ipv4(pkt)
&& csum(l3, ip_hdr_len) != 0)) {
COVERAGE_INC(ipf_l3csum_err);
goto invalid_pkt;
@@ -1185,7 +1185,7 @@ ipf_post_execute_reass_pkts(struct ipf *ipf,
} else {
struct ip_header *l3_frag = dp_packet_l3(frag_i->pkt);
struct ip_header *l3_reass = dp_packet_l3(pkt);
- if (!dp_packet_ol_is_ipv4(frag_i->pkt)) {
+ if (!dp_packet_ol_tx_ipv4(frag_i->pkt)) {
ovs_be32 reass_ip =
get_16aligned_be32(&l3_reass->ip_src);
ovs_be32 frag_ip =
@@ -6654,11 +6654,11 @@ netdev_linux_parse_vnet_hdr(struct dp_packet *p)
if (vnet->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) {
if (l4proto == IPPROTO_TCP) {
- dp_packet_ol_set_csum_tcp(p);
+ dp_packet_ol_set_tx_tcp_csum(p);
} else if (l4proto == IPPROTO_UDP) {
- dp_packet_ol_set_csum_udp(p);
+ dp_packet_ol_set_tx_udp_csum(p);
} else if (l4proto == IPPROTO_SCTP) {
- dp_packet_ol_set_csum_sctp(p);
+ dp_packet_ol_set_tx_sctp_csum(p);
}
}
@@ -6688,7 +6688,7 @@ netdev_linux_prepend_vnet_hdr(struct dp_packet *p, int mtu)
vnet->hdr_len = (OVS_FORCE __virtio16)hdr_len;
vnet->gso_size = (OVS_FORCE __virtio16)(mtu - hdr_len);
- if (dp_packet_ol_is_ipv4(p)) {
+ if (dp_packet_ol_tx_ipv4(p)) {
vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
} else {
vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
@@ -6703,13 +6703,13 @@ netdev_linux_prepend_vnet_hdr(struct dp_packet *p, int mtu)
vnet->csum_start = (OVS_FORCE __virtio16)((char *) dp_packet_l4(p)
- (char *) dp_packet_eth(p));
- if (dp_packet_ol_l4_is_tcp(p)) {
+ if (dp_packet_ol_tx_tcp_csum(p)) {
vnet->csum_offset = (OVS_FORCE __virtio16) __builtin_offsetof(
struct tcp_header, tcp_csum);
- } else if (dp_packet_ol_l4_is_udp(p)) {
+ } else if (dp_packet_ol_tx_udp_csum(p)) {
vnet->csum_offset = (OVS_FORCE __virtio16) __builtin_offsetof(
struct udp_header, udp_csum);
- } else if (dp_packet_ol_l4_is_sctp(p)) {
+ } else if (dp_packet_ol_tx_sctp_csum(p)) {
vnet->csum_offset = (OVS_FORCE __virtio16) __builtin_offsetof(
struct sctp_header, sctp_csum);
} else {
@@ -792,8 +792,6 @@ static bool
netdev_send_prepare_packet(const uint64_t netdev_flags,
struct dp_packet *packet, char **errormsg)
{
- uint64_t l4_mask;
-
if (dp_packet_ol_tcp_seg(packet)
&& !(netdev_flags & NETDEV_OFFLOAD_TX_TCP_TSO)) {
/* Fall back to GSO in software. */
@@ -801,29 +799,29 @@ netdev_send_prepare_packet(const uint64_t netdev_flags,
return false;
}
- l4_mask = dp_packet_ol_l4_mask(packet);
- if (l4_mask) {
- if (dp_packet_ol_l4_is_tcp(packet)) {
+ if (dp_packet_ol_l4_mask(packet)) {
+ if (dp_packet_ol_tx_tcp_csum(packet)) {
if (!(netdev_flags & NETDEV_OFFLOAD_TX_TCP_CSUM)) {
/* Fall back to TCP csum in software. */
VLOG_ERR_BUF(errormsg, "No TCP checksum support");
return false;
}
- } else if (dp_packet_ol_l4_is_udp(packet)) {
+ } else if (dp_packet_ol_tx_udp_csum(packet)) {
if (!(netdev_flags & NETDEV_OFFLOAD_TX_UDP_CSUM)) {
/* Fall back to UDP csum in software. */
VLOG_ERR_BUF(errormsg, "No UDP checksum support");
return false;
}
- } else if (dp_packet_ol_l4_is_sctp(packet)) {
+ } else if (dp_packet_ol_tx_sctp_csum(packet)) {
if (!(netdev_flags & NETDEV_OFFLOAD_TX_SCTP_CSUM)) {
/* Fall back to SCTP csum in software. */
VLOG_ERR_BUF(errormsg, "No SCTP checksum support");
return false;
}
} else {
- VLOG_ERR_BUF(errormsg, "No L4 checksum support: mask: %"PRIu64,
- l4_mask);
+ uint64_t ol_flags = *dp_packet_ol_flags_ptr(packet);
+ VLOG_ERR_BUF(errormsg, "No L4 checksum support: "
+ "offload mask: %"PRIu64, ol_flags);
return false;
}
}