Cleanup QLA_LOCK/QLA_UNLOCK macros

remove unused QLA_TX_LOCK/QLA_TX_UNLOCK macros
format qla_error_recovery()

MFC after:3 days
This commit is contained in:
David C Somayajulu 2017-04-20 03:41:42 +00:00
parent 863d0264b1
commit 9a5f785486
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317180
4 changed files with 63 additions and 60 deletions

View File

@ -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;

View File

@ -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))) {

View File

@ -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);
@ -890,9 +890,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__));
}
@ -924,13 +924,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);
}
@ -953,9 +949,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",
@ -975,10 +971,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);
@ -990,7 +988,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;
@ -1002,7 +1000,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)) {
@ -1026,7 +1024,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:
@ -1917,7 +1915,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) {
@ -1943,7 +1941,7 @@ qla_error_recovery(void *context, int pending)
}
}
QLA_UNLOCK(ha, __func__);
QLA_UNLOCK(ha);
if ((ha->pci_func & 0x1) == 0) {
@ -1957,18 +1955,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);
@ -1988,39 +1990,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
@ -2028,8 +2034,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);
}

View File

@ -148,12 +148,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
*/