Mechanically convert qlxgb(4) to IfAPI
Reviewed by: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37820
This commit is contained in:
parent
64c618ed7d
commit
5b587352a2
@ -146,7 +146,7 @@ struct qla_host {
|
|||||||
bus_dma_tag_t parent_tag;
|
bus_dma_tag_t parent_tag;
|
||||||
|
|
||||||
/* interface to o.s */
|
/* interface to o.s */
|
||||||
struct ifnet *ifp;
|
if_t ifp;
|
||||||
|
|
||||||
struct ifmedia media;
|
struct ifmedia media;
|
||||||
uint16_t max_frame_size;
|
uint16_t max_frame_size;
|
||||||
@ -206,7 +206,7 @@ typedef struct qla_host qla_host_t;
|
|||||||
#define QL_MIN(x, y) ((x < y) ? x : y)
|
#define QL_MIN(x, y) ((x < y) ? x : y)
|
||||||
|
|
||||||
#define QL_RUNNING(ifp) \
|
#define QL_RUNNING(ifp) \
|
||||||
((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \
|
((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \
|
||||||
IFF_DRV_RUNNING)
|
IFF_DRV_RUNNING)
|
||||||
|
|
||||||
#endif /* #ifndef _QLA_DEF_H_ */
|
#endif /* #ifndef _QLA_DEF_H_ */
|
||||||
|
@ -54,7 +54,7 @@ extern uint32_t free_pkt_thres;
|
|||||||
|
|
||||||
extern int qla_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
|
extern int qla_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
|
||||||
extern void qla_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
|
extern void qla_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
|
||||||
extern void qla_start(struct ifnet *ifp);
|
extern void qla_start(if_t ifp);
|
||||||
extern int qla_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp,
|
extern int qla_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp,
|
||||||
uint32_t jumbo);
|
uint32_t jumbo);
|
||||||
|
|
||||||
|
@ -1733,7 +1733,7 @@ qla_hw_tx_done(qla_host_t *ha)
|
|||||||
qla_hw_tx_done_locked(ha);
|
qla_hw_tx_done_locked(ha);
|
||||||
|
|
||||||
if (ha->hw.txr_free > free_pkt_thres)
|
if (ha->hw.txr_free > free_pkt_thres)
|
||||||
ha->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
if_setdrvflagbits(ha->ifp, 0, IFF_DRV_OACTIVE);
|
||||||
|
|
||||||
mtx_unlock(&ha->tx_lock);
|
mtx_unlock(&ha->tx_lock);
|
||||||
return;
|
return;
|
||||||
@ -1745,7 +1745,7 @@ qla_update_link_state(qla_host_t *ha)
|
|||||||
uint32_t link_state;
|
uint32_t link_state;
|
||||||
uint32_t prev_link_state;
|
uint32_t prev_link_state;
|
||||||
|
|
||||||
if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) {
|
||||||
ha->hw.flags.link_up = 0;
|
ha->hw.flags.link_up = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ int
|
|||||||
qla_make_cdev(qla_host_t *ha)
|
qla_make_cdev(qla_host_t *ha)
|
||||||
{
|
{
|
||||||
ha->ioctl_dev = make_dev(&qla_cdevsw,
|
ha->ioctl_dev = make_dev(&qla_cdevsw,
|
||||||
ha->ifp->if_dunit,
|
if_getdunit(ha->ifp),
|
||||||
UID_ROOT,
|
UID_ROOT,
|
||||||
GID_WHEEL,
|
GID_WHEEL,
|
||||||
0600,
|
0600,
|
||||||
|
@ -58,7 +58,7 @@ qla_rx_intr(qla_host_t *ha, uint64_t data, uint32_t sds_idx,
|
|||||||
uint32_t idx, length, status, ring;
|
uint32_t idx, length, status, ring;
|
||||||
qla_rx_buf_t *rxb;
|
qla_rx_buf_t *rxb;
|
||||||
struct mbuf *mp;
|
struct mbuf *mp;
|
||||||
struct ifnet *ifp = ha->ifp;
|
if_t ifp = ha->ifp;
|
||||||
qla_sds_t *sdsp;
|
qla_sds_t *sdsp;
|
||||||
struct ether_vlan_header *eh;
|
struct ether_vlan_header *eh;
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ qla_rx_intr(qla_host_t *ha, uint64_t data, uint32_t sds_idx,
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
(*ifp->if_input)(ifp, mp);
|
if_input(ifp, mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdsp->rx_free > std_replenish)
|
if (sdsp->rx_free > std_replenish)
|
||||||
@ -386,7 +386,7 @@ qla_rcv(void *context, int pending)
|
|||||||
qla_hw_t *hw;
|
qla_hw_t *hw;
|
||||||
uint32_t sds_idx;
|
uint32_t sds_idx;
|
||||||
uint32_t ret;
|
uint32_t ret;
|
||||||
struct ifnet *ifp;
|
if_t ifp;
|
||||||
|
|
||||||
ha = ivec->ha;
|
ha = ivec->ha;
|
||||||
hw = &ha->hw;
|
hw = &ha->hw;
|
||||||
@ -397,7 +397,7 @@ qla_rcv(void *context, int pending)
|
|||||||
if (sds_idx == 0) {
|
if (sds_idx == 0) {
|
||||||
if (qla_le32_to_host(*(hw->tx_cons)) != hw->txr_comp) {
|
if (qla_le32_to_host(*(hw->tx_cons)) != hw->txr_comp) {
|
||||||
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
||||||
} else if ((ifp->if_snd.ifq_head != NULL) &&
|
} else if (!if_sendq_empty(ifp) &&
|
||||||
QL_RUNNING(ifp)) {
|
QL_RUNNING(ifp)) {
|
||||||
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,9 @@ static int qla_pci_attach (device_t);
|
|||||||
static int qla_pci_detach (device_t);
|
static int qla_pci_detach (device_t);
|
||||||
|
|
||||||
static void qla_init(void *arg);
|
static void qla_init(void *arg);
|
||||||
static int qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
|
static int qla_ioctl(if_t ifp, u_long cmd, caddr_t data);
|
||||||
static int qla_media_change(struct ifnet *ifp);
|
static int qla_media_change(if_t ifp);
|
||||||
static void qla_media_status(struct ifnet *ifp, struct ifmediareq *ifmr);
|
static void qla_media_status(if_t ifp, struct ifmediareq *ifmr);
|
||||||
|
|
||||||
static device_method_t qla_pci_methods[] = {
|
static device_method_t qla_pci_methods[] = {
|
||||||
/* Device interface */
|
/* Device interface */
|
||||||
@ -208,7 +208,7 @@ qla_watchdog(void *arg)
|
|||||||
{
|
{
|
||||||
qla_host_t *ha = arg;
|
qla_host_t *ha = arg;
|
||||||
qla_hw_t *hw;
|
qla_hw_t *hw;
|
||||||
struct ifnet *ifp;
|
if_t ifp;
|
||||||
|
|
||||||
hw = &ha->hw;
|
hw = &ha->hw;
|
||||||
ifp = ha->ifp;
|
ifp = ha->ifp;
|
||||||
@ -219,7 +219,7 @@ qla_watchdog(void *arg)
|
|||||||
if (!ha->flags.qla_watchdog_pause) {
|
if (!ha->flags.qla_watchdog_pause) {
|
||||||
if (qla_le32_to_host(*(hw->tx_cons)) != hw->txr_comp) {
|
if (qla_le32_to_host(*(hw->tx_cons)) != hw->txr_comp) {
|
||||||
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
||||||
} else if ((ifp->if_snd.ifq_head != NULL) && QL_RUNNING(ifp)) {
|
} else if (!if_sendq_empty(ifp) && QL_RUNNING(ifp)) {
|
||||||
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -654,7 +654,7 @@ qla_free_parent_dma_tag(qla_host_t *ha)
|
|||||||
static void
|
static void
|
||||||
qla_init_ifnet(device_t dev, qla_host_t *ha)
|
qla_init_ifnet(device_t dev, qla_host_t *ha)
|
||||||
{
|
{
|
||||||
struct ifnet *ifp;
|
if_t ifp;
|
||||||
|
|
||||||
QL_DPRINT2((dev, "%s: enter\n", __func__));
|
QL_DPRINT2((dev, "%s: enter\n", __func__));
|
||||||
|
|
||||||
@ -665,32 +665,31 @@ qla_init_ifnet(device_t dev, qla_host_t *ha)
|
|||||||
|
|
||||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||||
|
|
||||||
ifp->if_mtu = ETHERMTU;
|
if_setmtu(ifp, ETHERMTU);
|
||||||
ifp->if_baudrate = IF_Gbps(10);
|
if_setbaudrate(ifp, IF_Gbps(10));
|
||||||
ifp->if_init = qla_init;
|
if_setinitfn(ifp, qla_init);
|
||||||
ifp->if_softc = ha;
|
if_setsoftc(ifp, ha);
|
||||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
|
||||||
ifp->if_ioctl = qla_ioctl;
|
if_setioctlfn(ifp, qla_ioctl);
|
||||||
ifp->if_start = qla_start;
|
if_setstartfn(ifp, qla_start);
|
||||||
|
|
||||||
IFQ_SET_MAXLEN(&ifp->if_snd, qla_get_ifq_snd_maxlen(ha));
|
if_setsendqlen(ifp, qla_get_ifq_snd_maxlen(ha));
|
||||||
ifp->if_snd.ifq_drv_maxlen = qla_get_ifq_snd_maxlen(ha);
|
if_setsendqready(ifp);
|
||||||
IFQ_SET_READY(&ifp->if_snd);
|
|
||||||
|
|
||||||
ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
|
ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN;
|
||||||
|
|
||||||
ether_ifattach(ifp, qla_get_mac_addr(ha));
|
ether_ifattach(ifp, qla_get_mac_addr(ha));
|
||||||
|
|
||||||
ifp->if_capabilities = IFCAP_HWCSUM |
|
if_setcapabilities(ifp, IFCAP_HWCSUM |
|
||||||
IFCAP_TSO4 |
|
IFCAP_TSO4 |
|
||||||
IFCAP_JUMBO_MTU;
|
IFCAP_JUMBO_MTU);
|
||||||
|
|
||||||
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU;
|
if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU, 0);
|
||||||
ifp->if_capabilities |= IFCAP_LINKSTATE;
|
if_setcapabilitiesbit(ifp, IFCAP_LINKSTATE, 0);
|
||||||
|
|
||||||
ifp->if_capenable = ifp->if_capabilities;
|
if_setcapenable(ifp, if_getcapabilities(ifp));
|
||||||
|
|
||||||
ifp->if_hdrlen = sizeof(struct ether_vlan_header);
|
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
|
||||||
|
|
||||||
ifmedia_init(&ha->media, IFM_IMASK, qla_media_change, qla_media_status);
|
ifmedia_init(&ha->media, IFM_IMASK, qla_media_change, qla_media_status);
|
||||||
|
|
||||||
@ -708,7 +707,7 @@ qla_init_ifnet(device_t dev, qla_host_t *ha)
|
|||||||
static void
|
static void
|
||||||
qla_init_locked(qla_host_t *ha)
|
qla_init_locked(qla_host_t *ha)
|
||||||
{
|
{
|
||||||
struct ifnet *ifp = ha->ifp;
|
if_t ifp = ha->ifp;
|
||||||
|
|
||||||
qla_stop(ha);
|
qla_stop(ha);
|
||||||
|
|
||||||
@ -721,15 +720,15 @@ qla_init_locked(qla_host_t *ha)
|
|||||||
if (qla_config_lro(ha))
|
if (qla_config_lro(ha))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bcopy(IF_LLADDR(ha->ifp), ha->hw.mac_addr, ETHER_ADDR_LEN);
|
bcopy(if_getlladdr(ha->ifp), ha->hw.mac_addr, ETHER_ADDR_LEN);
|
||||||
|
|
||||||
ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO;
|
if_sethwassist(ifp, CSUM_TCP | CSUM_UDP | CSUM_TSO);
|
||||||
|
|
||||||
ha->flags.stop_rcv = 0;
|
ha->flags.stop_rcv = 0;
|
||||||
if (qla_init_hw_if(ha) == 0) {
|
if (qla_init_hw_if(ha) == 0) {
|
||||||
ifp = ha->ifp;
|
ifp = ha->ifp;
|
||||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
|
||||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||||
ha->flags.qla_watchdog_pause = 0;
|
ha->flags.qla_watchdog_pause = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,7 +767,7 @@ static void
|
|||||||
qla_set_multi(qla_host_t *ha, uint32_t add_multi)
|
qla_set_multi(qla_host_t *ha, uint32_t add_multi)
|
||||||
{
|
{
|
||||||
uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN];
|
uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN];
|
||||||
struct ifnet *ifp = ha->ifp;
|
if_t ifp = ha->ifp;
|
||||||
int mcnt;
|
int mcnt;
|
||||||
|
|
||||||
mcnt = if_foreach_llmaddr(ifp, qla_copy_maddr, mta);
|
mcnt = if_foreach_llmaddr(ifp, qla_copy_maddr, mta);
|
||||||
@ -778,7 +777,7 @@ qla_set_multi(qla_host_t *ha, uint32_t add_multi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
qla_ioctl(if_t ifp, u_long cmd, caddr_t data)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct ifreq *ifr = (struct ifreq *)data;
|
struct ifreq *ifr = (struct ifreq *)data;
|
||||||
@ -787,7 +786,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
#endif
|
#endif
|
||||||
qla_host_t *ha;
|
qla_host_t *ha;
|
||||||
|
|
||||||
ha = (qla_host_t *)ifp->if_softc;
|
ha = (qla_host_t *)if_getsoftc(ifp);
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SIOCSIFADDR:
|
case SIOCSIFADDR:
|
||||||
@ -796,8 +795,8 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
|
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
if (ifa->ifa_addr->sa_family == AF_INET) {
|
if (ifa->ifa_addr->sa_family == AF_INET) {
|
||||||
ifp->if_flags |= IFF_UP;
|
if_setflagbits(ifp, IFF_UP, 0);
|
||||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
|
||||||
QLA_LOCK(ha, __func__);
|
QLA_LOCK(ha, __func__);
|
||||||
qla_init_locked(ha);
|
qla_init_locked(ha);
|
||||||
QLA_UNLOCK(ha, __func__);
|
QLA_UNLOCK(ha, __func__);
|
||||||
@ -825,10 +824,10 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
} else {
|
} else {
|
||||||
QLA_LOCK(ha, __func__);
|
QLA_LOCK(ha, __func__);
|
||||||
ifp->if_mtu = ifr->ifr_mtu;
|
if_setmtu(ifp, ifr->ifr_mtu);
|
||||||
ha->max_frame_size =
|
ha->max_frame_size =
|
||||||
ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
|
if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN;
|
||||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
|
||||||
ret = qla_set_max_mtu(ha, ha->max_frame_size,
|
ret = qla_set_max_mtu(ha, ha->max_frame_size,
|
||||||
(ha->hw.rx_cntxt_rsp)->rx_rsp.cntxt_id);
|
(ha->hw.rx_cntxt_rsp)->rx_rsp.cntxt_id);
|
||||||
}
|
}
|
||||||
@ -844,19 +843,19 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFFLAGS (0x%lx)\n",
|
QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFFLAGS (0x%lx)\n",
|
||||||
__func__, cmd));
|
__func__, cmd));
|
||||||
|
|
||||||
if (ifp->if_flags & IFF_UP) {
|
if (if_getflags(ifp) & IFF_UP) {
|
||||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
|
||||||
if ((ifp->if_flags ^ ha->if_flags) &
|
if ((if_getflags(ifp) ^ ha->if_flags) &
|
||||||
IFF_PROMISC) {
|
IFF_PROMISC) {
|
||||||
qla_set_promisc(ha);
|
qla_set_promisc(ha);
|
||||||
} else if ((ifp->if_flags ^ ha->if_flags) &
|
} else if ((if_getflags(ifp) ^ ha->if_flags) &
|
||||||
IFF_ALLMULTI) {
|
IFF_ALLMULTI) {
|
||||||
qla_set_allmulti(ha);
|
qla_set_allmulti(ha);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QLA_LOCK(ha, __func__);
|
QLA_LOCK(ha, __func__);
|
||||||
qla_init_locked(ha);
|
qla_init_locked(ha);
|
||||||
ha->max_frame_size = ifp->if_mtu +
|
ha->max_frame_size = if_getmtu(ifp) +
|
||||||
ETHER_HDR_LEN + ETHER_CRC_LEN;
|
ETHER_HDR_LEN + ETHER_CRC_LEN;
|
||||||
ret = qla_set_max_mtu(ha, ha->max_frame_size,
|
ret = qla_set_max_mtu(ha, ha->max_frame_size,
|
||||||
(ha->hw.rx_cntxt_rsp)->rx_rsp.cntxt_id);
|
(ha->hw.rx_cntxt_rsp)->rx_rsp.cntxt_id);
|
||||||
@ -864,9 +863,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QLA_LOCK(ha, __func__);
|
QLA_LOCK(ha, __func__);
|
||||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
|
||||||
qla_stop(ha);
|
qla_stop(ha);
|
||||||
ha->if_flags = ifp->if_flags;
|
ha->if_flags = if_getflags(ifp);
|
||||||
QLA_UNLOCK(ha, __func__);
|
QLA_UNLOCK(ha, __func__);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -875,7 +874,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
QL_DPRINT4((ha->pci_dev,
|
QL_DPRINT4((ha->pci_dev,
|
||||||
"%s: %s (0x%lx)\n", __func__, "SIOCADDMULTI", cmd));
|
"%s: %s (0x%lx)\n", __func__, "SIOCADDMULTI", cmd));
|
||||||
|
|
||||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
|
||||||
qla_set_multi(ha, 1);
|
qla_set_multi(ha, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -884,7 +883,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
QL_DPRINT4((ha->pci_dev,
|
QL_DPRINT4((ha->pci_dev,
|
||||||
"%s: %s (0x%lx)\n", __func__, "SIOCDELMULTI", cmd));
|
"%s: %s (0x%lx)\n", __func__, "SIOCDELMULTI", cmd));
|
||||||
|
|
||||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
|
||||||
qla_set_multi(ha, 0);
|
qla_set_multi(ha, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -899,21 +898,21 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
|
|
||||||
case SIOCSIFCAP:
|
case SIOCSIFCAP:
|
||||||
{
|
{
|
||||||
int mask = ifr->ifr_reqcap ^ ifp->if_capenable;
|
int mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
|
||||||
|
|
||||||
QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFCAP (0x%lx)\n",
|
QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFCAP (0x%lx)\n",
|
||||||
__func__, cmd));
|
__func__, cmd));
|
||||||
|
|
||||||
if (mask & IFCAP_HWCSUM)
|
if (mask & IFCAP_HWCSUM)
|
||||||
ifp->if_capenable ^= IFCAP_HWCSUM;
|
if_togglecapenable(ifp, IFCAP_HWCSUM);
|
||||||
if (mask & IFCAP_TSO4)
|
if (mask & IFCAP_TSO4)
|
||||||
ifp->if_capenable ^= IFCAP_TSO4;
|
if_togglecapenable(ifp, IFCAP_TSO4);
|
||||||
if (mask & IFCAP_TSO6)
|
if (mask & IFCAP_TSO6)
|
||||||
ifp->if_capenable ^= IFCAP_TSO6;
|
if_togglecapenable(ifp, IFCAP_TSO6);
|
||||||
if (mask & IFCAP_VLAN_HWTAGGING)
|
if (mask & IFCAP_VLAN_HWTAGGING)
|
||||||
ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
|
if_togglecapenable(ifp, IFCAP_VLAN_HWTAGGING);
|
||||||
|
|
||||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||||
qla_init(ha);
|
qla_init(ha);
|
||||||
|
|
||||||
VLAN_CAPABILITIES(ifp);
|
VLAN_CAPABILITIES(ifp);
|
||||||
@ -931,13 +930,13 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qla_media_change(struct ifnet *ifp)
|
qla_media_change(if_t ifp)
|
||||||
{
|
{
|
||||||
qla_host_t *ha;
|
qla_host_t *ha;
|
||||||
struct ifmedia *ifm;
|
struct ifmedia *ifm;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ha = (qla_host_t *)ifp->if_softc;
|
ha = (qla_host_t *)if_getsoftc(ifp);
|
||||||
|
|
||||||
QL_DPRINT2((ha->pci_dev, "%s: enter\n", __func__));
|
QL_DPRINT2((ha->pci_dev, "%s: enter\n", __func__));
|
||||||
|
|
||||||
@ -952,11 +951,11 @@ qla_media_change(struct ifnet *ifp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qla_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
|
qla_media_status(if_t ifp, struct ifmediareq *ifmr)
|
||||||
{
|
{
|
||||||
qla_host_t *ha;
|
qla_host_t *ha;
|
||||||
|
|
||||||
ha = (qla_host_t *)ifp->if_softc;
|
ha = (qla_host_t *)if_getsoftc(ifp);
|
||||||
|
|
||||||
QL_DPRINT2((ha->pci_dev, "%s: enter\n", __func__));
|
QL_DPRINT2((ha->pci_dev, "%s: enter\n", __func__));
|
||||||
|
|
||||||
@ -976,10 +975,10 @@ qla_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
qla_start(struct ifnet *ifp)
|
qla_start(if_t ifp)
|
||||||
{
|
{
|
||||||
struct mbuf *m_head;
|
struct mbuf *m_head;
|
||||||
qla_host_t *ha = (qla_host_t *)ifp->if_softc;
|
qla_host_t *ha = (qla_host_t *)if_getsoftc(ifp);
|
||||||
|
|
||||||
QL_DPRINT8((ha->pci_dev, "%s: enter\n", __func__));
|
QL_DPRINT8((ha->pci_dev, "%s: enter\n", __func__));
|
||||||
|
|
||||||
@ -989,7 +988,7 @@ qla_start(struct ifnet *ifp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
|
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
|
||||||
IFF_DRV_RUNNING) {
|
IFF_DRV_RUNNING) {
|
||||||
QL_DPRINT8((ha->pci_dev, "%s: !IFF_DRV_RUNNING\n", __func__));
|
QL_DPRINT8((ha->pci_dev, "%s: !IFF_DRV_RUNNING\n", __func__));
|
||||||
QLA_TX_UNLOCK(ha);
|
QLA_TX_UNLOCK(ha);
|
||||||
@ -1005,8 +1004,8 @@ qla_start(struct ifnet *ifp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ifp->if_snd.ifq_head != NULL) {
|
while (!if_sendq_empty(ifp)) {
|
||||||
IF_DEQUEUE(&ifp->if_snd, m_head);
|
m_head = if_dequeue(ifp);
|
||||||
|
|
||||||
if (m_head == NULL) {
|
if (m_head == NULL) {
|
||||||
QL_DPRINT8((ha->pci_dev, "%s: m_head == NULL\n",
|
QL_DPRINT8((ha->pci_dev, "%s: m_head == NULL\n",
|
||||||
@ -1018,8 +1017,8 @@ qla_start(struct ifnet *ifp)
|
|||||||
if (m_head == NULL)
|
if (m_head == NULL)
|
||||||
break;
|
break;
|
||||||
QL_DPRINT8((ha->pci_dev, "%s: PREPEND\n", __func__));
|
QL_DPRINT8((ha->pci_dev, "%s: PREPEND\n", __func__));
|
||||||
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
|
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||||
IF_PREPEND(&ifp->if_snd, m_head);
|
if_sendq_prepend(ifp, m_head);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Send a copy of the frame to the BPF listener */
|
/* Send a copy of the frame to the BPF listener */
|
||||||
@ -1123,7 +1122,7 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp)
|
|||||||
static void
|
static void
|
||||||
qla_stop(qla_host_t *ha)
|
qla_stop(qla_host_t *ha)
|
||||||
{
|
{
|
||||||
struct ifnet *ifp = ha->ifp;
|
if_t ifp = ha->ifp;
|
||||||
|
|
||||||
ha->flags.qla_watchdog_pause = 1;
|
ha->flags.qla_watchdog_pause = 1;
|
||||||
qla_mdelay(__func__, 100);
|
qla_mdelay(__func__, 100);
|
||||||
@ -1138,7 +1137,7 @@ qla_stop(qla_host_t *ha)
|
|||||||
qla_free_xmt_bufs(ha);
|
qla_free_xmt_bufs(ha);
|
||||||
qla_free_rcv_bufs(ha);
|
qla_free_rcv_bufs(ha);
|
||||||
|
|
||||||
ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING);
|
if_setdrvflagbits(ifp, 0, (IFF_DRV_OACTIVE | IFF_DRV_RUNNING));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user