cxgbe/iw_cxgbe: Replace the fatal error flag with a stopped flag.

Now that suspend/resume is supported by the base driver, a fatal error
isn't the only reason that the RNIC can stop abruptly.  Also, this state
is no longer permanent as it's possible to resume operations after a
stop.  Rename the flag and associated routines to match the new state of
affairs.

MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2024-08-28 11:41:10 -07:00
parent a852dc580c
commit 8254a276ad
4 changed files with 19 additions and 14 deletions

View file

@ -1080,7 +1080,7 @@ c4iw_so_upcall(struct socket *so, void *arg, int waitflag)
* Wake up any threads waiting in rdma_init()/rdma_fini(),
* with locks held.
*/
if (so->so_error || (ep->com.dev->rdev.flags & T4_FATAL_ERROR))
if (so->so_error || c4iw_stopped(&ep->com.dev->rdev))
c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
add_ep_to_req_list(ep, C4IW_EVENT_SOCKET);
@ -2708,8 +2708,8 @@ c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
CTR3(KTR_IW_CXGBE, "%s: cm_id %p, backlog %s", __func__, cm_id,
backlog);
if (c4iw_fatal_error(&dev->rdev)) {
CTR2(KTR_IW_CXGBE, "%s: cm_id %p, fatal error", __func__,
if (c4iw_stopped(&dev->rdev)) {
CTR2(KTR_IW_CXGBE, "%s: cm_id %p, stopped", __func__,
cm_id);
return -EIO;
}
@ -2821,8 +2821,8 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
rdev = &ep->com.dev->rdev;
if (c4iw_fatal_error(rdev)) {
CTR3(KTR_IW_CXGBE, "%s:ced1 fatal error %p %s", __func__, ep,
if (c4iw_stopped(rdev)) {
CTR3(KTR_IW_CXGBE, "%s:ced1 stopped %p %s", __func__, ep,
states[ep->com.state]);
if (ep->com.state != DEAD) {
send_abort(ep);

View file

@ -335,9 +335,8 @@ c4iw_stop(struct adapter *sc)
if (iwsc) {
struct ib_event event = {0};
device_printf(sc->dev,
"iWARP driver received FATAL ERROR event.\n");
iwsc->rdev.flags |= T4_FATAL_ERROR;
device_printf(sc->dev, "iWARP driver stopped.\n");
iwsc->rdev.flags |= T4_IW_STOPPED;
event.event = IB_EVENT_DEVICE_FATAL;
event.device = &iwsc->ibdev;
ib_dispatch_event(&event);
@ -349,6 +348,12 @@ c4iw_stop(struct adapter *sc)
static int
c4iw_restart(struct adapter *sc)
{
struct c4iw_dev *iwsc = sc->iwarp_softc;
if (iwsc) {
device_printf(sc->dev, "iWARP driver restarted.\n");
iwsc->rdev.flags &= ~T4_IW_STOPPED;
}
return (0);
}

View file

@ -116,7 +116,7 @@ struct c4iw_dev_ucontext {
};
enum c4iw_rdev_flags {
T4_FATAL_ERROR = (1<<0),
T4_IW_STOPPED = (1<<0),
T4_STATUS_PAGE_DISABLED = (1<<1),
};
@ -167,9 +167,9 @@ struct c4iw_rdev {
struct workqueue_struct *free_workq;
};
static inline int c4iw_fatal_error(struct c4iw_rdev *rdev)
static inline int c4iw_stopped(struct c4iw_rdev *rdev)
{
return rdev->flags & T4_FATAL_ERROR;
return rdev->flags & T4_IW_STOPPED;
}
static inline int c4iw_num_stags(struct c4iw_rdev *rdev)
@ -214,7 +214,7 @@ c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp,
int timedout = 0;
struct timeval t1, t2;
if (c4iw_fatal_error(rdev)) {
if (c4iw_stopped(rdev)) {
wr_waitp->ret = -EIO;
goto out;
}
@ -240,7 +240,7 @@ c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp,
"seconds - tid %u qpid %u\n", func,
device_get_nameunit(sc->dev), t2.tv_sec, t2.tv_usec,
hwtid, qpid);
if (c4iw_fatal_error(rdev)) {
if (c4iw_stopped(rdev)) {
wr_waitp->ret = -EIO;
break;
}

View file

@ -256,7 +256,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
u32 stag_idx;
static atomic_t key;
if (c4iw_fatal_error(rdev))
if (c4iw_stopped(rdev))
return -EIO;
stag_state = stag_state > 0;