qlxgb/qlxgbe/qlxge: Fix build without INET and/or without INET6.

This is in preparation for adding these drivers to amd64 NOTES.
This commit is contained in:
John Baldwin 2022-04-22 15:18:05 -07:00
parent f7daf71038
commit 618aa8cd0a
12 changed files with 75 additions and 11 deletions

View File

@ -1770,6 +1770,7 @@ qla_update_link_state(qla_host_t *ha)
int
qla_config_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
qla_hw_t *hw = &ha->hw;
struct lro_ctrl *lro;
@ -1786,12 +1787,14 @@ qla_config_lro(qla_host_t *ha)
ha->flags.lro_init = 1;
QL_DPRINT2((ha->pci_dev, "%s: LRO initialized\n", __func__));
#endif
return (0);
}
void
qla_free_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
qla_hw_t *hw = &ha->hw;
struct lro_ctrl *lro;
@ -1804,6 +1807,7 @@ qla_free_lro(qla_host_t *ha)
tcp_lro_free(lro);
}
ha->flags.lro_init = 0;
#endif
}
void

View File

@ -139,9 +139,12 @@ qla_rx_intr(qla_host_t *ha, uint64_t data, uint32_t sds_idx,
mp->m_pkthdr.csum_flags = 0;
}
#if defined(INET) || defined(INET6)
if (lro->lro_cnt && (tcp_lro_rx(lro, mp, 0) == 0)) {
/* LRO packet has been successfully queued */
} else {
} else
#endif
{
(*ifp->if_input)(ifp, mp);
}
@ -322,7 +325,9 @@ qla_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count)
}
}
#if defined(INET) || defined(INET6)
tcp_lro_flush_all(lro);
#endif
if (hw->sds[sds_idx].sdsr_next != comp_idx) {
QL_UPDATE_SDS_CONSUMER_INDEX(ha, sds_idx, comp_idx);

View File

@ -789,7 +789,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
int ret = 0;
struct ifreq *ifr = (struct ifreq *)data;
#ifdef INET
struct ifaddr *ifa = (struct ifaddr *)data;
#endif
qla_host_t *ha;
ha = (qla_host_t *)ifp->if_softc;
@ -799,6 +801,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFADDR (0x%lx)\n",
__func__, cmd));
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
ifp->if_flags |= IFF_UP;
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
@ -815,9 +818,10 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
qla_config_ipv4_addr(ha,
(IA_SIN(ifa)->sin_addr.s_addr));
}
} else {
ether_ioctl(ifp, cmd, data);
break;
}
#endif
ether_ioctl(ifp, cmd, data);
break;
case SIOCSIFMTU:

View File

@ -36,6 +36,8 @@
#ifndef _QLA_OS_H_
#define _QLA_OS_H_
#include "opt_inet.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>

View File

@ -2751,6 +2751,7 @@ qla_config_rss_ind_table(qla_host_t *ha)
static int
qla_config_soft_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
qla_hw_t *hw = &ha->hw;
struct lro_ctrl *lro;
@ -2780,12 +2781,14 @@ qla_config_soft_lro(qla_host_t *ha)
}
QL_DPRINT2(ha, (ha->pci_dev, "%s: LRO initialized\n", __func__));
#endif
return (0);
}
static void
qla_drain_soft_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
qla_hw_t *hw = &ha->hw;
struct lro_ctrl *lro;
@ -2805,6 +2808,7 @@ qla_drain_soft_lro(qla_host_t *ha)
}
#endif /* #if (__FreeBSD_version >= 1100101) */
}
#endif
return;
}
@ -2812,6 +2816,7 @@ qla_drain_soft_lro(qla_host_t *ha)
static void
qla_free_soft_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
qla_hw_t *hw = &ha->hw;
struct lro_ctrl *lro;
@ -2820,6 +2825,7 @@ qla_free_soft_lro(qla_host_t *ha)
lro = &hw->sds[i].lro;
tcp_lro_free(lro);
}
#endif
return;
}

View File

@ -68,9 +68,11 @@ qla_rx_intr(qla_host_t *ha, qla_sgl_rcv_t *sgc, uint32_t sds_idx)
uint32_t i, rem_len = 0;
uint32_t r_idx = 0;
qla_rx_ring_t *rx_ring;
#if defined(INET) || defined(INET6)
struct lro_ctrl *lro;
lro = &ha->hw.sds[sds_idx].lro;
#endif
if (ha->hw.num_rds_rings > 1)
r_idx = sds_idx;
@ -173,6 +175,7 @@ qla_rx_intr(qla_host_t *ha, qla_sgl_rcv_t *sgc, uint32_t sds_idx)
#endif
#endif /* #if __FreeBSD_version >= 1100000 */
#if defined(INET) || defined(INET6)
if (ha->hw.enable_soft_lro) {
#if (__FreeBSD_version >= 1100101)
@ -184,7 +187,9 @@ qla_rx_intr(qla_host_t *ha, qla_sgl_rcv_t *sgc, uint32_t sds_idx)
#endif /* #if (__FreeBSD_version >= 1100101) */
} else {
} else
#endif
{
(*ifp->if_input)(ifp, mpf);
}
@ -725,6 +730,7 @@ ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count)
}
}
#if defined(INET) || defined(INET6)
if (ha->hw.enable_soft_lro) {
struct lro_ctrl *lro;
@ -745,6 +751,7 @@ ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count)
#endif /* #if (__FreeBSD_version >= 1100101) */
}
#endif
if (ha->stop_rcv)
goto ql_rcv_isr_exit;

View File

@ -1022,7 +1022,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
int ret = 0;
struct ifreq *ifr = (struct ifreq *)data;
#ifdef INET
struct ifaddr *ifa = (struct ifaddr *)data;
#endif
qla_host_t *ha;
ha = (qla_host_t *)ifp->if_softc;
@ -1034,6 +1036,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
QL_DPRINT4(ha, (ha->pci_dev, "%s: SIOCSIFADDR (0x%lx)\n",
__func__, cmd));
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
ret = QLA_LOCK(ha, __func__,
QLA_LOCK_DEFAULT_MS_TIMEOUT,
@ -1058,9 +1061,10 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ntohl(IA_SIN(ifa)->sin_addr.s_addr)));
arp_ifinit(ifp, ifa);
} else {
ether_ioctl(ifp, cmd, data);
break;
}
#endif
ether_ioctl(ifp, cmd, data);
break;
case SIOCSIFMTU:

View File

@ -36,6 +36,8 @@
#ifndef _QL_OS_H_
#define _QL_OS_H_
#include "opt_inet.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>

View File

@ -527,9 +527,12 @@ qls_init_fw_routing_table(qla_host_t *ha)
static int
qls_tx_tso_chksum(qla_host_t *ha, struct mbuf *mp, q81_tx_tso_t *tx_mac)
{
#if defined(INET) || defined(INET6)
struct ether_vlan_header *eh;
struct ip *ip;
#if defined(INET6)
struct ip6_hdr *ip6;
#endif
struct tcphdr *th;
uint32_t ehdrlen, ip_hlen;
int ret = 0;
@ -547,6 +550,7 @@ qls_tx_tso_chksum(qla_host_t *ha, struct mbuf *mp, q81_tx_tso_t *tx_mac)
}
switch (etype) {
#ifdef INET
case ETHERTYPE_IP:
ip = (struct ip *)(mp->m_data + ehdrlen);
@ -587,7 +591,9 @@ qls_tx_tso_chksum(qla_host_t *ha, struct mbuf *mp, q81_tx_tso_t *tx_mac)
tx_mac->flags |= Q81_TX_TSO_FLAGS_UC;
}
break;
#endif
#ifdef INET6
case ETHERTYPE_IPV6:
ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen);
@ -613,6 +619,7 @@ qls_tx_tso_chksum(qla_host_t *ha, struct mbuf *mp, q81_tx_tso_t *tx_mac)
tx_mac->flags |= Q81_TX_TSO_FLAGS_UC;
}
break;
#endif
default:
ret = -1;
@ -620,6 +627,9 @@ qls_tx_tso_chksum(qla_host_t *ha, struct mbuf *mp, q81_tx_tso_t *tx_mac)
}
return (ret);
#else
return (-1);
#endif
}
#define QLA_TX_MIN_FREE 2

View File

@ -130,12 +130,16 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e)
device_t dev = ha->pci_dev;
struct mbuf *mp = NULL;
struct ifnet *ifp = ha->ifp;
#if defined(INET) || defined(INET6)
struct lro_ctrl *lro;
#endif
struct ether_vlan_header *eh;
rxr = &ha->rx_ring[rxr_idx];
#if defined(INET) || defined(INET6)
lro = &rxr->lro;
#endif
rxb = &rxr->rx_buf[rxr->rx_next];
@ -200,9 +204,12 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e)
}
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
#if defined(INET) || defined(INET6)
if (lro->lro_cnt && (tcp_lro_rx(lro, mp, 0) == 0)) {
/* LRO packet has been successfully queued */
} else {
} else
#endif
{
(*ifp->if_input)(ifp, mp);
}
}
@ -228,10 +235,11 @@ qls_cq_isr(qla_host_t *ha, uint32_t cq_idx)
q81_cq_e_t *cq_e, *cq_b;
uint32_t i, cq_comp_idx;
int ret = 0, tx_comp_done = 0;
struct lro_ctrl *lro;
#if defined(INET) || defined(INET6)
struct lro_ctrl *lro = &ha->rx_ring[cq_idx].lro;
#endif
cq_b = ha->rx_ring[cq_idx].cq_base_vaddr;
lro = &ha->rx_ring[cq_idx].lro;
cq_comp_idx = *(ha->rx_ring[cq_idx].cqi_vaddr);
@ -281,7 +289,9 @@ qls_cq_isr(qla_host_t *ha, uint32_t cq_idx)
}
}
#if defined(INET) || defined(INET6)
tcp_lro_flush_all(lro);
#endif
ha->rx_ring[cq_idx].cq_next = cq_comp_idx;

View File

@ -859,7 +859,9 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
int ret = 0;
struct ifreq *ifr = (struct ifreq *)data;
#ifdef INET
struct ifaddr *ifa = (struct ifaddr *)data;
#endif
qla_host_t *ha;
ha = (qla_host_t *)ifp->if_softc;
@ -869,6 +871,7 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFADDR (0x%lx)\n",
__func__, cmd));
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
ifp->if_flags |= IFF_UP;
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
@ -882,9 +885,10 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ntohl(IA_SIN(ifa)->sin_addr.s_addr)));
arp_ifinit(ifp, ifa);
} else {
ether_ioctl(ifp, cmd, data);
break;
}
#endif
ether_ioctl(ifp, cmd, data);
break;
case SIOCSIFMTU:
@ -1450,6 +1454,7 @@ qls_tx_done(void *context, int pending)
static int
qls_config_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
struct lro_ctrl *lro;
@ -1465,12 +1470,14 @@ qls_config_lro(qla_host_t *ha)
ha->flags.lro_init = 1;
QL_DPRINT2((ha->pci_dev, "%s: LRO initialized\n", __func__));
#endif
return (0);
}
static void
qls_free_lro(qla_host_t *ha)
{
#if defined(INET) || defined(INET6)
int i;
struct lro_ctrl *lro;
@ -1482,6 +1489,7 @@ qls_free_lro(qla_host_t *ha)
tcp_lro_free(lro);
}
ha->flags.lro_init = 0;
#endif
}
static void

View File

@ -36,6 +36,8 @@
#ifndef _QLS_OS_H_
#define _QLS_OS_H_
#include "opt_inet.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>