Somehow fix LINT-NOIP.

This commit is contained in:
Gleb Smirnoff 2013-11-01 18:42:03 +00:00
parent d8abca4a20
commit f909bbb4db
3 changed files with 30 additions and 15 deletions

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
* from this FreeBSD domain to other domains.
*/
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_global.h"
#include "opt_sctp.h"
@ -184,7 +185,6 @@ static int xnb_rxpkt2gnttab(const struct xnb_pkt *pkt,
static int xnb_rxpkt2rsp(const struct xnb_pkt *pkt,
const gnttab_copy_table gnttab, int n_entries,
netif_rx_back_ring_t *ring);
static void xnb_add_mbuf_cksum(struct mbuf *mbufc);
static void xnb_stop(struct xnb_softc*);
static int xnb_ioctl(struct ifnet*, u_long, caddr_t);
static void xnb_start_locked(struct ifnet*);
@ -195,6 +195,9 @@ static void xnb_ifinit(void*);
static int xnb_unit_test_main(SYSCTL_HANDLER_ARGS);
static int xnb_dump_rings(SYSCTL_HANDLER_ARGS);
#endif
#if defined(INET) || defined(INET6)
static void xnb_add_mbuf_cksum(struct mbuf *mbufc);
#endif
/*------------------------------ Data Structures -----------------------------*/
@ -1779,7 +1782,9 @@ xnb_update_mbufc(struct mbuf *mbufc, const gnttab_copy_table gnttab,
}
mbufc->m_pkthdr.len = total_size;
#if defined(INET) || defined(INET6)
xnb_add_mbuf_cksum(mbufc);
#endif
}
/**
@ -2122,6 +2127,7 @@ xnb_rxpkt2rsp(const struct xnb_pkt *pkt, const gnttab_copy_table gnttab,
return n_responses;
}
#if defined(INET) || defined(INET6)
/**
* Add IP, TCP, and/or UDP checksums to every mbuf in a chain. The first mbuf
* in the chain must start with a struct ether_header.
@ -2176,6 +2182,7 @@ xnb_add_mbuf_cksum(struct mbuf *mbufc)
break;
}
}
#endif /* INET || INET6 */
static void
xnb_stop(struct xnb_softc *xnb)

View File

@ -104,10 +104,6 @@ struct test_fixture {
typedef struct test_fixture test_fixture_t;
static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len,
uint16_t ip_id, uint16_t ip_p,
uint16_t ip_off, uint16_t ip_sum);
static void xnb_fill_tcp(struct mbuf *m);
static int xnb_get1pkt(struct xnb_pkt *pkt, size_t size, uint16_t flags);
static int xnb_unit_test_runner(test_fixture_t const tests[], int ntests,
char *buffer, size_t buflen);
@ -163,17 +159,24 @@ static testcase_t xnb_rxpkt2rsp_extra;
static testcase_t xnb_rxpkt2rsp_2short;
static testcase_t xnb_rxpkt2rsp_2slots;
static testcase_t xnb_rxpkt2rsp_copyerror;
static testcase_t xnb_sscanf_llu;
static testcase_t xnb_sscanf_lld;
static testcase_t xnb_sscanf_hhu;
static testcase_t xnb_sscanf_hhd;
static testcase_t xnb_sscanf_hhn;
#if defined(INET) || defined(INET6)
/* TODO: add test cases for xnb_add_mbuf_cksum for IPV6 tcp and udp */
static testcase_t xnb_add_mbuf_cksum_arp;
static testcase_t xnb_add_mbuf_cksum_tcp;
static testcase_t xnb_add_mbuf_cksum_udp;
static testcase_t xnb_add_mbuf_cksum_icmp;
static testcase_t xnb_add_mbuf_cksum_tcp_swcksum;
static testcase_t xnb_sscanf_llu;
static testcase_t xnb_sscanf_lld;
static testcase_t xnb_sscanf_hhu;
static testcase_t xnb_sscanf_hhd;
static testcase_t xnb_sscanf_hhn;
static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len,
uint16_t ip_id, uint16_t ip_p,
uint16_t ip_off, uint16_t ip_sum);
static void xnb_fill_tcp(struct mbuf *m);
#endif /* INET || INET6 */
/** Private data used by unit tests */
static struct {
@ -307,11 +310,13 @@ xnb_unit_test_main(SYSCTL_HANDLER_ARGS) {
{setup_pvt_data, xnb_rxpkt2rsp_2short, teardown_pvt_data},
{setup_pvt_data, xnb_rxpkt2rsp_2slots, teardown_pvt_data},
{setup_pvt_data, xnb_rxpkt2rsp_copyerror, teardown_pvt_data},
#if defined(INET) || defined(INET6)
{null_setup, xnb_add_mbuf_cksum_arp, null_teardown},
{null_setup, xnb_add_mbuf_cksum_icmp, null_teardown},
{null_setup, xnb_add_mbuf_cksum_tcp, null_teardown},
{null_setup, xnb_add_mbuf_cksum_tcp_swcksum, null_teardown},
{null_setup, xnb_add_mbuf_cksum_udp, null_teardown},
#endif
{null_setup, xnb_sscanf_hhd, null_teardown},
{null_setup, xnb_sscanf_hhu, null_teardown},
{null_setup, xnb_sscanf_lld, null_teardown},
@ -2066,6 +2071,7 @@ xnb_rxpkt2rsp_copyerror(char *buffer, size_t buflen)
safe_m_freem(&mbuf);
}
#if defined(INET) || defined(INET6)
/**
* xnb_add_mbuf_cksum on an ARP request packet
*/
@ -2430,6 +2436,7 @@ xnb_add_mbuf_cksum_tcp_swcksum(char *buffer, size_t buflen)
m_freem(mbufc);
}
#endif /* INET || INET6 */
/**
* sscanf on unsigned chars

View File

@ -28,6 +28,7 @@
__FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -964,7 +965,7 @@ static void
xn_rxeof(struct netfront_info *np)
{
struct ifnet *ifp;
#if __FreeBSD_version >= 700000
#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6))
struct lro_ctrl *lro = &np->xn_lro;
struct lro_entry *queued;
#endif
@ -1061,7 +1062,7 @@ xn_rxeof(struct netfront_info *np)
* Do we really need to drop the rx lock?
*/
XN_RX_UNLOCK(np);
#if __FreeBSD_version >= 700000
#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6))
/* Use LRO if possible */
if ((ifp->if_capenable & IFCAP_LRO) == 0 ||
lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) {
@ -1079,7 +1080,7 @@ xn_rxeof(struct netfront_info *np)
np->rx.rsp_cons = i;
#if __FreeBSD_version >= 700000
#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6))
/*
* Flush any outstanding LRO work
*/
@ -2002,14 +2003,14 @@ xn_configure_features(struct netfront_info *np)
int err;
err = 0;
#if __FreeBSD_version >= 700000
#if __FreeBSD_version >= 70000 && (defined(INET) || defined(INET6))
if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0)
tcp_lro_free(&np->xn_lro);
#endif
np->xn_ifp->if_capenable =
np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4);
np->xn_ifp->if_hwassist &= ~CSUM_TSO;
#if __FreeBSD_version >= 700000
#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6))
if (xn_enable_lro && (np->xn_ifp->if_capabilities & IFCAP_LRO) != 0) {
err = tcp_lro_init(&np->xn_lro);
if (err) {