Skip to content

Commit 7c448f5

Browse files
committed
vtnet: fix compilation for NOIP configs
Reported by: bz Fixes: 1c23d8f ("vtnet: improve checksum offloading") MFC after: 3 days Sponsored by: Netflix, Inc.
1 parent dff11c4 commit 7c448f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sys/dev/virtio/network/if_vtnet.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ static int vtnet_rxq_replace_lro_nomrg_buf(struct vtnet_rxq *,
133133
static int vtnet_rxq_replace_buf(struct vtnet_rxq *, struct mbuf *, int);
134134
static int vtnet_rxq_enqueue_buf(struct vtnet_rxq *, struct mbuf *);
135135
static int vtnet_rxq_new_buf(struct vtnet_rxq *);
136+
#if defined(INET) || defined(INET6)
136137
static int vtnet_rxq_csum_needs_csum(struct vtnet_rxq *, struct mbuf *,
137138
bool, int, struct virtio_net_hdr *);
138139
static void vtnet_rxq_csum_data_valid(struct vtnet_rxq *, struct mbuf *,
139140
int);
140141
static int vtnet_rxq_csum(struct vtnet_rxq *, struct mbuf *,
141142
struct virtio_net_hdr *);
143+
#endif
142144
static void vtnet_rxq_discard_merged_bufs(struct vtnet_rxq *, int);
143145
static void vtnet_rxq_discard_buf(struct vtnet_rxq *, struct mbuf *);
144146
static int vtnet_rxq_merged_eof(struct vtnet_rxq *, struct mbuf *, int);
@@ -1761,6 +1763,7 @@ vtnet_rxq_new_buf(struct vtnet_rxq *rxq)
17611763
return (error);
17621764
}
17631765

1766+
#if defined(INET) || defined(INET6)
17641767
static int
17651768
vtnet_rxq_csum_needs_csum(struct vtnet_rxq *rxq, struct mbuf *m, bool isipv6,
17661769
int protocol, struct virtio_net_hdr *hdr)
@@ -1918,6 +1921,7 @@ vtnet_rxq_csum(struct vtnet_rxq *rxq, struct mbuf *m,
19181921

19191922
return (0);
19201923
}
1924+
#endif
19211925

19221926
static void
19231927
vtnet_rxq_discard_merged_bufs(struct vtnet_rxq *rxq, int nbufs)
@@ -2040,10 +2044,15 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m,
20402044

20412045
if (hdr->flags &
20422046
(VIRTIO_NET_HDR_F_NEEDS_CSUM | VIRTIO_NET_HDR_F_DATA_VALID)) {
2047+
#if defined(INET) || defined(INET6)
20432048
if (vtnet_rxq_csum(rxq, m, hdr) == 0)
20442049
rxq->vtnrx_stats.vrxs_csum++;
20452050
else
20462051
rxq->vtnrx_stats.vrxs_csum_failed++;
2052+
#else
2053+
sc->vtnet_stats.rx_csum_bad_ethtype++;
2054+
rxq->vtnrx_stats.vrxs_csum_failed++;
2055+
#endif
20472056
}
20482057

20492058
if (hdr->gso_size != 0) {

0 commit comments

Comments
 (0)