cxgbe(4): A couple of fixes to set_sched_queue.

- Validate the scheduling class against the actual limit (which is chip
  specific) instead of a magic number.

- Return an error if an attempt is made to manipulate the tx queues of a
  VI that hasn't been initialized.

Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2016-06-07 07:48:36 +00:00
parent 1830617ec9
commit 468646f716
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301542

View File

@ -8575,11 +8575,6 @@ set_sched_queue(struct adapter *sc, struct t4_sched_queue *p)
if (rc)
return (rc);
if (!(sc->flags & FULL_INIT_DONE)) {
rc = EAGAIN;
goto done;
}
if (p->port >= sc->params.nports) {
rc = EINVAL;
goto done;
@ -8588,7 +8583,14 @@ set_sched_queue(struct adapter *sc, struct t4_sched_queue *p)
/* XXX: Only supported for the main VI. */
pi = sc->port[p->port];
vi = &pi->vi[0];
if (!in_range(p->queue, 0, vi->ntxq - 1) || !in_range(p->cl, 0, 7)) {
if (!(vi->flags & VI_INIT_DONE)) {
/* tx queues not set up yet */
rc = EAGAIN;
goto done;
}
if (!in_range(p->queue, 0, vi->ntxq - 1) ||
!in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) {
rc = EINVAL;
goto done;
}