From 220aea232f0876eb3d06304daf8fe53f7b1b1042 Mon Sep 17 00:00:00 2001 From: davidcs Date: Mon, 8 May 2017 22:44:16 +0000 Subject: [PATCH] MFC r317180 Cleanup QLA_LOCK/QLA_UNLOCK macros remove unused QLA_TX_LOCK/QLA_TX_UNLOCK macros format qla_error_recovery() git-svn-id: svn://svn.freebsd.org/base/stable/9@317992 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/qlxgbe/ql_hw.c | 4 +- sys/dev/qlxgbe/ql_ioctl.c | 8 +-- sys/dev/qlxgbe/ql_os.c | 104 ++++++++++++++++++++------------------ sys/dev/qlxgbe/ql_os.h | 7 +-- 4 files changed, 63 insertions(+), 60 deletions(-) diff --git a/sys/dev/qlxgbe/ql_hw.c b/sys/dev/qlxgbe/ql_hw.c index 961e59e94..097933e05 100644 --- a/sys/dev/qlxgbe/ql_hw.c +++ b/sys/dev/qlxgbe/ql_hw.c @@ -183,9 +183,9 @@ qla_sysctl_stop_pegs(SYSCTL_HANDLER_ARGS) if (ret == 1) { ha = (qla_host_t *)arg1; - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); qla_stop_pegs(ha); - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); } return err; diff --git a/sys/dev/qlxgbe/ql_ioctl.c b/sys/dev/qlxgbe/ql_ioctl.c index c16224b27..9695e20b7 100644 --- a/sys/dev/qlxgbe/ql_ioctl.c +++ b/sys/dev/qlxgbe/ql_ioctl.c @@ -233,10 +233,10 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, break; } - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); if (!ha->hw.mdump_done) ha->qla_initiate_recovery = 1; - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); #define QLNX_DUMP_WAIT_SECS 30 @@ -254,9 +254,9 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, break; } - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); ha->hw.mdump_done = 0; - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); if ((rval = copyout(ha->hw.mdump_template, fw_dump->minidump, ha->hw.mdump_template_size))) { diff --git a/sys/dev/qlxgbe/ql_os.c b/sys/dev/qlxgbe/ql_os.c index 5f298edd1..d5c9490db 100644 --- a/sys/dev/qlxgbe/ql_os.c +++ b/sys/dev/qlxgbe/ql_os.c @@ -519,9 +519,9 @@ qla_pci_detach(device_t dev) ifp = ha->ifp; - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); qla_stop(ha); - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); qla_release(ha); @@ -895,9 +895,9 @@ qla_init(void *arg) QL_DPRINT2(ha, (ha->pci_dev, "%s: enter\n", __func__)); - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); qla_init_locked(ha); - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); QL_DPRINT2(ha, (ha->pci_dev, "%s: exit\n", __func__)); } @@ -929,13 +929,9 @@ qla_set_multi(qla_host_t *ha, uint32_t add_multi) if_maddr_runlock(ifp); - //if (QLA_LOCK(ha, __func__, 1) == 0) { - // ret = ql_hw_set_multi(ha, mta, mcnt, add_multi); - // QLA_UNLOCK(ha, __func__); - //} - QLA_LOCK(ha, __func__, 1); + QLA_LOCK(ha); ret = ql_hw_set_multi(ha, mta, mcnt, add_multi); - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); return (ret); } @@ -958,9 +954,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (ifa->ifa_addr->sa_family == AF_INET) { ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); qla_init_locked(ha); - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); } QL_DPRINT4(ha, (ha->pci_dev, "%s: SIOCSIFADDR (0x%lx) ipv4 [0x%08x]\n", @@ -980,10 +976,12 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (ifr->ifr_mtu > QLA_MAX_MTU) { ret = EINVAL; } else { - (void) QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); + ifp->if_mtu = ifr->ifr_mtu; ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { ret = ql_set_max_mtu(ha, ha->max_frame_size, ha->hw.rcv_cntxt_id); @@ -995,7 +993,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ha->std_replenish = QL_STD_REPLENISH_THRES; - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); if (ret) ret = EINVAL; @@ -1007,7 +1005,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) QL_DPRINT4(ha, (ha->pci_dev, "%s: SIOCSIFFLAGS (0x%lx)\n", __func__, cmd)); - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); if (ifp->if_flags & IFF_UP) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { @@ -1031,7 +1029,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ha->if_flags = ifp->if_flags; } - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); break; case SIOCADDMULTI: @@ -1938,7 +1936,7 @@ qla_error_recovery(void *context, int pending) struct ifnet *ifp = ha->ifp; int i = 0; - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); if (ha->flags.qla_interface_up) { @@ -1964,7 +1962,7 @@ qla_error_recovery(void *context, int pending) } } - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); if ((ha->pci_func & 0x1) == 0) { @@ -1978,18 +1976,22 @@ qla_error_recovery(void *context, int pending) ha->msg_from_peer = 0; - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); + ql_minidump(ha); - QLA_UNLOCK(ha, __func__); + + QLA_UNLOCK(ha); (void) ql_init_hw(ha); - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); + if (ha->flags.qla_interface_up) { - qla_free_xmt_bufs(ha); - qla_free_rcv_bufs(ha); + qla_free_xmt_bufs(ha); + qla_free_rcv_bufs(ha); } - QLA_UNLOCK(ha, __func__); + + QLA_UNLOCK(ha); qla_send_msg_to_peer(ha, QL_PEER_MSG_ACK); @@ -2009,39 +2011,43 @@ qla_error_recovery(void *context, int pending) (void) ql_init_hw(ha); - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); + if (ha->flags.qla_interface_up) { - qla_free_xmt_bufs(ha); - qla_free_rcv_bufs(ha); - } - QLA_UNLOCK(ha, __func__); + qla_free_xmt_bufs(ha); + qla_free_rcv_bufs(ha); + } + + QLA_UNLOCK(ha); } - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); if (ha->flags.qla_interface_up) { - if (qla_alloc_xmt_bufs(ha) != 0) { - QLA_UNLOCK(ha, __func__); - return; - } - qla_confirm_9kb_enable(ha); - if (qla_alloc_rcv_bufs(ha) != 0) { - QLA_UNLOCK(ha, __func__); - return; - } + if (qla_alloc_xmt_bufs(ha) != 0) { + QLA_UNLOCK(ha); + return; + } + qla_confirm_9kb_enable(ha); - ha->flags.stop_rcv = 0; - if (ql_init_hw_if(ha) == 0) { - ifp = ha->ifp; - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ha->flags.qla_watchdog_pause = 0; - } + if (qla_alloc_rcv_bufs(ha) != 0) { + QLA_UNLOCK(ha); + return; + } + + ha->flags.stop_rcv = 0; + + if (ql_init_hw_if(ha) == 0) { + ifp = ha->ifp; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + ha->flags.qla_watchdog_pause = 0; + } } else ha->flags.qla_watchdog_pause = 0; - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); } static void @@ -2049,8 +2055,8 @@ qla_async_event(void *context, int pending) { qla_host_t *ha = context; - (void)QLA_LOCK(ha, __func__, 0); + QLA_LOCK(ha); qla_hw_async_event(ha); - QLA_UNLOCK(ha, __func__); + QLA_UNLOCK(ha); } diff --git a/sys/dev/qlxgbe/ql_os.h b/sys/dev/qlxgbe/ql_os.h index db717720e..eb90c34c1 100644 --- a/sys/dev/qlxgbe/ql_os.h +++ b/sys/dev/qlxgbe/ql_os.h @@ -147,12 +147,9 @@ MALLOC_DECLARE(M_QLA83XXBUF); /* * Locks */ -#define QLA_LOCK(ha, str, no_delay) mtx_lock(&ha->hw_lock) -#define QLA_UNLOCK(ha, str) mtx_unlock(&ha->hw_lock) +#define QLA_LOCK(ha) mtx_lock(&ha->hw_lock) +#define QLA_UNLOCK(ha) mtx_unlock(&ha->hw_lock) -#define QLA_TX_LOCK(ha) mtx_lock(&ha->tx_lock); -#define QLA_TX_UNLOCK(ha) mtx_unlock(&ha->tx_lock); - /* * structure encapsulating a DMA buffer */ -- 2.45.0