Author: np
Date: Thu Aug 23 00:58:10 2018
New Revision: 338218
URL: https://svnweb.freebsd.org/changeset/base/338218

Log:
  cxgbev(4): Updates to the VF driver to cope with recent ifmedia and
  ctrlq changes in the base driver.
  
  MFC after:    1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/t4_vf.c

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h        Thu Aug 23 00:05:13 2018        
(r338217)
+++ head/sys/dev/cxgbe/adapter.h        Thu Aug 23 00:58:10 2018        
(r338218)
@@ -1180,6 +1180,8 @@ int alloc_atid(struct adapter *, void *);
 void *lookup_atid(struct adapter *, int);
 void free_atid(struct adapter *, int);
 void release_tid(struct adapter *, int, struct sge_wrq *);
+int cxgbe_media_change(struct ifnet *);
+void cxgbe_media_status(struct ifnet *, struct ifmediareq *);
 
 #ifdef DEV_NETMAP
 /* t4_netmap.c */

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Thu Aug 23 00:05:13 2018        
(r338217)
+++ head/sys/dev/cxgbe/t4_main.c        Thu Aug 23 00:58:10 2018        
(r338218)
@@ -215,13 +215,11 @@ static driver_t vcc_driver = {
        sizeof(struct vi_info)
 };
 
-/* ifnet + media interface */
+/* ifnet interface */
 static void cxgbe_init(void *);
 static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t);
 static int cxgbe_transmit(struct ifnet *, struct mbuf *);
 static void cxgbe_qflush(struct ifnet *);
-static int cxgbe_media_change(struct ifnet *);
-static void cxgbe_media_status(struct ifnet *, struct ifmediareq *);
 
 MALLOC_DEFINE(M_CXGBE, "cxgbe", "Chelsio T4/T5 Ethernet driver and services");
 
@@ -2066,7 +2064,7 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c)
  * The kernel picks a media from the list we had provided so we do not have to
  * validate the request.
  */
-static int
+int
 cxgbe_media_change(struct ifnet *ifp)
 {
        struct vi_info *vi = ifp->if_softc;
@@ -2263,7 +2261,7 @@ port_mword(struct port_info *pi, uint16_t speed)
        return (IFM_UNKNOWN);
 }
 
-static void
+void
 cxgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
        struct vi_info *vi = ifp->if_softc;
@@ -4378,7 +4376,9 @@ apply_l1cfg(struct port_info *pi)
 #endif
        rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc);
        if (rc != 0) {
-               device_printf(pi->dev, "l1cfg failed: %d\n", rc);
+               /* Don't complain if the VF driver gets back an EPERM. */
+               if (!(sc->flags & IS_VF) || rc != FW_EPERM)
+                       device_printf(pi->dev, "l1cfg failed: %d\n", rc);
        } else {
                lc->fc = lc->requested_fc;
                lc->fec = lc->requested_fec;

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Thu Aug 23 00:05:13 2018        (r338217)
+++ head/sys/dev/cxgbe/t4_sge.c Thu Aug 23 00:58:10 2018        (r338218)
@@ -1079,8 +1079,10 @@ t4_teardown_adapter_queues(struct adapter *sc)
                sc->flags &= ~ADAP_SYSCTL_CTX;
        }
 
-       for_each_port(sc, i)
-               free_wrq(sc, &sc->sge.ctrlq[i]);
+       if (!(sc->flags & IS_VF)) {
+               for_each_port(sc, i)
+                       free_wrq(sc, &sc->sge.ctrlq[i]);
+       }
        free_fwq(sc);
 
        return (0);

Modified: head/sys/dev/cxgbe/t4_vf.c
==============================================================================
--- head/sys/dev/cxgbe/t4_vf.c  Thu Aug 23 00:05:13 2018        (r338217)
+++ head/sys/dev/cxgbe/t4_vf.c  Thu Aug 23 00:58:10 2018        (r338218)
@@ -637,6 +637,10 @@ t4vf_attach(device_t dev)
                mtx_init(&pi->pi_lock, pi->lockname, 0, MTX_DEF);
                sc->chan_map[pi->tx_chan] = i;
 
+               /* All VIs on this port share this media. */
+               ifmedia_init(&pi->media, IFM_IMASK, cxgbe_media_change,
+                   cxgbe_media_status);
+
                pi->dev = device_add_child(dev, sc->names->vf_ifnet_name, -1);
                if (pi->dev == NULL) {
                        device_printf(dev,
_______________________________________________
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