Author: np
Date: Thu Nov 12 01:18:05 2020
New Revision: 367608
URL: https://svnweb.freebsd.org/changeset/base/367608

Log:
  cxgbev(4): Make sure that the iq/eq map sizes are correct for VFs.
  
  This should have been part of r366929.
  
  MFC after:    3 days
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Thu Nov 12 00:51:53 2020        
(r367607)
+++ head/sys/dev/cxgbe/t4_main.c        Thu Nov 12 01:18:05 2020        
(r367608)
@@ -4467,9 +4467,9 @@ get_params__post_init(struct adapter *sc)
                    "failed to query parameters (post_init2): %d.\n", rc);
                return (rc);
        }
-       MPASS(val[0] >= sc->sge.iq_start);
+       MPASS((int)val[0] >= sc->sge.iq_start);
        sc->sge.iqmap_sz = val[0] - sc->sge.iq_start + 1;
-       MPASS(val[1] >= sc->sge.eq_start);
+       MPASS((int)val[1] >= sc->sge.eq_start);
        sc->sge.eqmap_sz = val[1] - sc->sge.eq_start + 1;
 
        if (chip_id(sc) >= CHELSIO_T6) {

Modified: head/sys/dev/cxgbe/t4_vf.c
==============================================================================
--- head/sys/dev/cxgbe/t4_vf.c  Thu Nov 12 00:51:53 2020        (r367607)
+++ head/sys/dev/cxgbe/t4_vf.c  Thu Nov 12 01:18:05 2020        (r367608)
@@ -695,13 +695,16 @@ t4vf_attach(device_t dev)
        s->neq += sc->params.nports;    /* ctrl queues: 1 per port */
        s->niq = s->nrxq + 1;           /* 1 extra for firmware event queue */
 
+       s->iqmap_sz = s->niq;
+       s->eqmap_sz = s->neq;
+
        s->rxq = malloc(s->nrxq * sizeof(struct sge_rxq), M_CXGBE,
            M_ZERO | M_WAITOK);
        s->txq = malloc(s->ntxq * sizeof(struct sge_txq), M_CXGBE,
            M_ZERO | M_WAITOK);
-       s->iqmap = malloc(s->niq * sizeof(struct sge_iq *), M_CXGBE,
+       s->iqmap = malloc(s->iqmap_sz * sizeof(struct sge_iq *), M_CXGBE,
            M_ZERO | M_WAITOK);
-       s->eqmap = malloc(s->neq * sizeof(struct sge_eq *), M_CXGBE,
+       s->eqmap = malloc(s->eqmap_sz * sizeof(struct sge_eq *), M_CXGBE,
            M_ZERO | M_WAITOK);
 
        sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE,
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to