Author: davidcs
Date: Mon May  8 22:44:16 2017
New Revision: 317992
URL: https://svnweb.freebsd.org/changeset/base/317992

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

Modified:
  stable/9/sys/dev/qlxgbe/ql_hw.c
  stable/9/sys/dev/qlxgbe/ql_ioctl.c
  stable/9/sys/dev/qlxgbe/ql_os.c
  stable/9/sys/dev/qlxgbe/ql_os.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/qlxgbe/ql_hw.c
==============================================================================
--- stable/9/sys/dev/qlxgbe/ql_hw.c     Mon May  8 22:41:13 2017        
(r317991)
+++ stable/9/sys/dev/qlxgbe/ql_hw.c     Mon May  8 22:44:16 2017        
(r317992)
@@ -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: stable/9/sys/dev/qlxgbe/ql_ioctl.c
==============================================================================
--- stable/9/sys/dev/qlxgbe/ql_ioctl.c  Mon May  8 22:41:13 2017        
(r317991)
+++ stable/9/sys/dev/qlxgbe/ql_ioctl.c  Mon May  8 22:44:16 2017        
(r317992)
@@ -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: stable/9/sys/dev/qlxgbe/ql_os.c
==============================================================================
--- stable/9/sys/dev/qlxgbe/ql_os.c     Mon May  8 22:41:13 2017        
(r317991)
+++ stable/9/sys/dev/qlxgbe/ql_os.c     Mon May  8 22:44:16 2017        
(r317992)
@@ -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 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);
 }
@@ -958,9 +954,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",
@@ -980,10 +976,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);
@@ -995,7 +993,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;
@@ -1007,7 +1005,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)) {
@@ -1031,7 +1029,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:
@@ -1938,7 +1936,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) {
 
@@ -1964,7 +1962,7 @@ qla_error_recovery(void *context, int pe
                }
        }
 
-        QLA_UNLOCK(ha, __func__);
+        QLA_UNLOCK(ha);
 
        if ((ha->pci_func & 0x1) == 0) {
 
@@ -1978,18 +1976,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);
 
@@ -2009,39 +2011,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
@@ -2049,8 +2055,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: stable/9/sys/dev/qlxgbe/ql_os.h
==============================================================================
--- stable/9/sys/dev/qlxgbe/ql_os.h     Mon May  8 22:41:13 2017        
(r317991)
+++ stable/9/sys/dev/qlxgbe/ql_os.h     Mon May  8 22:44:16 2017        
(r317992)
@@ -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
  */
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to