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
This commit is contained in:
bz 2014-08-29 12:45:14 +00:00
parent ba133ffb6d
commit 9a64279057

View File

@ -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. */