Author: davidcs
Date: Thu Apr 20 03:41:42 2017
New Revision: 317180
URL: https://svnweb.freebsd.org/changeset/base/317180

Log:
  Cleanup QLA_LOCK/QLA_UNLOCK macros
  remove unused QLA_TX_LOCK/QLA_TX_UNLOCK macros
  format qla_error_recovery()
  
  MFC after:3 days

Modified:
  head/sys/dev/qlxgbe/ql_hw.c
  head/sys/dev/qlxgbe/ql_ioctl.c
  head/sys/dev/qlxgbe/ql_os.c
  head/sys/dev/qlxgbe/ql_os.h

Modified: head/sys/dev/qlxgbe/ql_hw.c
==============================================================================
--- head/sys/dev/qlxgbe/ql_hw.c Thu Apr 20 03:36:09 2017        (r317179)
+++ head/sys/dev/qlxgbe/ql_hw.c Thu Apr 20 03:41:42 2017        (r317180)
@@ -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;

Modified: head/sys/dev/qlxgbe/ql_ioctl.c
==============================================================================
--- head/sys/dev/qlxgbe/ql_ioctl.c      Thu Apr 20 03:36:09 2017        
(r317179)
+++ head/sys/dev/qlxgbe/ql_ioctl.c      Thu Apr 20 03:41:42 2017        
(r317180)
@@ -233,10 +233,10 @@ ql_eioctl(struct cdev *dev, u_long cmd, 
                        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, 
                        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))) {

Modified: head/sys/dev/qlxgbe/ql_os.c
==============================================================================
--- head/sys/dev/qlxgbe/ql_os.c Thu Apr 20 03:36:09 2017        (r317179)
+++ head/sys/dev/qlxgbe/ql_os.c Thu Apr 20 03:41:42 2017        (r317180)
@@ -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 a
 
        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,
                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,
                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,
                                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,
                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,
                        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 pe
        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 pe
                }
        }
 
-        QLA_UNLOCK(ha, __func__);
+        QLA_UNLOCK(ha);
 
        if ((ha->pci_func & 0x1) == 0) {
 
@@ -1957,18 +1955,22 @@ qla_error_recovery(void *context, int pe
 
                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 pe
 
                (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 pendi
 {
         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);
 }
 

Modified: head/sys/dev/qlxgbe/ql_os.h
==============================================================================
--- head/sys/dev/qlxgbe/ql_os.h Thu Apr 20 03:36:09 2017        (r317179)
+++ head/sys/dev/qlxgbe/ql_os.h Thu Apr 20 03:41:42 2017        (r317180)
@@ -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
  */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to