From b555c6140d4b00cee5cfd7ad11d736f8f0407e4c Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Fri, 29 Aug 2014 12:45:14 +0000 Subject: [PATCH] Properly place #ifdef INET and #ifdef INET6 around variable declarations and code to make the code compile. Give the function seems to be slightly mixed with csum and tso, make it non-fatal if we try to setup thing on a kernel without IP support. In practise the printf on the console will probably still make your machine unhappy. MFC after: 3 days X-MFC with: r270755 --- sys/dev/ixl/ixl_txrx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c index c1cf8efdad50..12e09f776423 100755 --- a/sys/dev/ixl/ixl_txrx.c +++ b/sys/dev/ixl/ixl_txrx.c @@ -595,8 +595,8 @@ ixl_tx_setup_offload(struct ixl_queue *que, } switch (etype) { - case ETHERTYPE_IP: #ifdef INET + case ETHERTYPE_IP: ip = (struct ip *)(mp->m_data + elen); ip_hlen = ip->ip_hl << 2; ipproto = ip->ip_p; @@ -606,16 +606,16 @@ ixl_tx_setup_offload(struct ixl_queue *que, *cmd |= I40E_TX_DESC_CMD_IIPT_IPV4_CSUM; else *cmd |= I40E_TX_DESC_CMD_IIPT_IPV4; -#endif break; - case ETHERTYPE_IPV6: +#endif #ifdef INET6 + case ETHERTYPE_IPV6: ip6 = (struct ip6_hdr *)(mp->m_data + elen); ip_hlen = sizeof(struct ip6_hdr); ipproto = ip6->ip6_nxt; th = (struct tcphdr *)((caddr_t)ip6 + ip_hlen); *cmd |= I40E_TX_DESC_CMD_IIPT_IPV6; - /* Falls thru */ + break; #endif default: break; @@ -680,7 +680,9 @@ ixl_tso_setup(struct ixl_queue *que, struct mbuf *mp) #ifdef INET6 struct ip6_hdr *ip6; #endif +#if defined(INET6) || defined(INET) struct tcphdr *th; +#endif u64 type_cmd_tso_mss; /* @@ -722,9 +724,9 @@ ixl_tso_setup(struct ixl_queue *que, struct mbuf *mp) break; #endif default: - panic("%s: CSUM_TSO but no supported IP version (0x%04x)", + printf("%s: CSUM_TSO but no supported IP version (0x%04x)", __func__, ntohs(etype)); - break; + return FALSE; } /* Ensure we have at least the IP+TCP header in the first mbuf. */