Author: np
Date: Tue Jun  7 07:48:36 2016
New Revision: 301542
URL: https://svnweb.freebsd.org/changeset/base/301542

Log:
  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

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Tue Jun  7 07:04:05 2016        
(r301541)
+++ head/sys/dev/cxgbe/t4_main.c        Tue Jun  7 07:48:36 2016        
(r301542)
@@ -8575,11 +8575,6 @@ set_sched_queue(struct adapter *sc, stru
        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, stru
        /* 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;
        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to