cxgbe(4): Catch up with recent changes in the kernel -- it no longer

holds non-sleepable locks around any of the driver ioctls.

Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2018-06-14 01:27:35 +00:00
parent f0f8a1af01
commit 2ea5b0f54a

View File

@ -1663,7 +1663,7 @@ cxgbe_init(void *arg)
static int
cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)
{
int rc = 0, mtu, flags, can_sleep;
int rc = 0, mtu, flags;
struct vi_info *vi = ifp->if_softc;
struct port_info *pi = vi->pi;
struct adapter *sc = pi->adapter;
@ -1689,59 +1689,36 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)
break;
case SIOCSIFFLAGS:
can_sleep = 0;
redo_sifflags:
rc = begin_synchronized_op(sc, vi,
can_sleep ? (SLEEP_OK | INTR_OK) : HOLD_LOCK, "t4flg");
if (rc) {
if_printf(ifp, "%ssleepable synch operation failed: %d."
" if_flags 0x%08x, if_drv_flags 0x%08x\n",
can_sleep ? "" : "non-", rc, ifp->if_flags,
ifp->if_drv_flags);
rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4flg");
if (rc)
return (rc);
}
if (ifp->if_flags & IFF_UP) {
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
flags = vi->if_flags;
if ((ifp->if_flags ^ flags) &
(IFF_PROMISC | IFF_ALLMULTI)) {
if (can_sleep == 1) {
end_synchronized_op(sc, 0);
can_sleep = 0;
goto redo_sifflags;
}
rc = update_mac_settings(ifp,
XGMAC_PROMISC | XGMAC_ALLMULTI);
}
} else {
if (can_sleep == 0) {
end_synchronized_op(sc, LOCK_HELD);
can_sleep = 1;
goto redo_sifflags;
}
rc = cxgbe_init_synchronized(vi);
}
vi->if_flags = ifp->if_flags;
} else if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
if (can_sleep == 0) {
end_synchronized_op(sc, LOCK_HELD);
can_sleep = 1;
goto redo_sifflags;
}
rc = cxgbe_uninit_synchronized(vi);
}
end_synchronized_op(sc, can_sleep ? 0 : LOCK_HELD);
end_synchronized_op(sc, 0);
break;
case SIOCADDMULTI:
case SIOCDELMULTI: /* these two are called with a mutex held :-( */
rc = begin_synchronized_op(sc, vi, HOLD_LOCK, "t4multi");
case SIOCDELMULTI:
rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4multi");
if (rc)
return (rc);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
rc = update_mac_settings(ifp, XGMAC_MCADDRS);
end_synchronized_op(sc, LOCK_HELD);
end_synchronized_op(sc, 0);
break;
case SIOCSIFCAP: