Author: arybchik
Date: Fri Nov 30 07:04:48 2018
New Revision: 341293
URL: https://svnweb.freebsd.org/changeset/base/341293

Log:
  sfxge(4): add accessor for default port mode
  
  Extend efx_mcdi_get_port_modes() to optionally pass on the default
  port mode field. This provides a more direct way of handling the case
  where the dynamic config does not specify the port mode than the
  alternative of a lookup table indexed by MCFW subtype.
  
  Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18255

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/hunt_nic.c
  head/sys/dev/sfxge/common/medford2_nic.c
  head/sys/dev/sfxge/common/medford_nic.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/ef10_impl.h       Fri Nov 30 07:04:37 2018        
(r341292)
+++ head/sys/dev/sfxge/common/ef10_impl.h       Fri Nov 30 07:04:48 2018        
(r341293)
@@ -1154,7 +1154,8 @@ extern    __checkReturn   efx_rc_t
 efx_mcdi_get_port_modes(
        __in            efx_nic_t *enp,
        __out           uint32_t *modesp,
-       __out_opt       uint32_t *current_modep);
+       __out_opt       uint32_t *current_modep,
+       __out_opt       uint32_t *default_modep);
 
 extern __checkReturn   efx_rc_t
 ef10_nic_get_port_mode_bandwidth(

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_nic.c        Fri Nov 30 07:04:37 2018        
(r341292)
+++ head/sys/dev/sfxge/common/ef10_nic.c        Fri Nov 30 07:04:48 2018        
(r341293)
@@ -90,7 +90,8 @@ fail1:
 efx_mcdi_get_port_modes(
        __in            efx_nic_t *enp,
        __out           uint32_t *modesp,
-       __out_opt       uint32_t *current_modep)
+       __out_opt       uint32_t *current_modep,
+       __out_opt       uint32_t *default_modep)
 {
        efx_mcdi_req_t req;
        uint8_t payload[MAX(MC_CMD_GET_PORT_MODES_IN_LEN,
@@ -137,6 +138,11 @@ efx_mcdi_get_port_modes(
                                            GET_PORT_MODES_OUT_CURRENT_MODE);
        }
 
+       if (default_modep != NULL) {
+               *default_modep = MCDI_OUT_DWORD(req,
+                                           GET_PORT_MODES_OUT_DEFAULT_MODE);
+       }
+
        return (0);
 
 fail3:
@@ -1662,13 +1668,14 @@ ef10_external_port_mapping(
        int32_t count = 1; /* Default 1-1 mapping */
        int32_t offset = 1; /* Default starting external port number */
 
-       if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, &current)) != 0) {
+       if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, &current,
+                   NULL)) != 0) {
                /*
                 * No current port mode information (i.e. Huntington)
                 * - infer mapping from available modes
                 */
                if ((rc = efx_mcdi_get_port_modes(enp,
-                           &port_modes, NULL)) != 0) {
+                           &port_modes, NULL, NULL)) != 0) {
                        /*
                         * No port mode information available
                         * - use default mapping

Modified: head/sys/dev/sfxge/common/hunt_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/hunt_nic.c        Fri Nov 30 07:04:37 2018        
(r341292)
+++ head/sys/dev/sfxge/common/hunt_nic.c        Fri Nov 30 07:04:48 2018        
(r341293)
@@ -57,7 +57,8 @@ hunt_nic_get_required_pcie_bandwidth(
         * capable mode is in use.
         */
 
-       if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, NULL)) != 0) {
+       if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
+                   NULL, NULL)) != 0) {
                /* No port mode info available */
                bandwidth = 0;
                goto out;

Modified: head/sys/dev/sfxge/common/medford2_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/medford2_nic.c    Fri Nov 30 07:04:37 2018        
(r341292)
+++ head/sys/dev/sfxge/common/medford2_nic.c    Fri Nov 30 07:04:48 2018        
(r341293)
@@ -52,7 +52,7 @@ medford2_nic_get_required_pcie_bandwidth(
        /* FIXME: support new Medford2 dynamic port modes */
 
        if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
-                                   &current_mode)) != 0) {
+                                   &current_mode, NULL)) != 0) {
                /* No port mode info available. */
                bandwidth = 0;
                goto out;

Modified: head/sys/dev/sfxge/common/medford_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/medford_nic.c     Fri Nov 30 07:04:37 2018        
(r341292)
+++ head/sys/dev/sfxge/common/medford_nic.c     Fri Nov 30 07:04:48 2018        
(r341293)
@@ -48,7 +48,7 @@ medford_nic_get_required_pcie_bandwidth(
        efx_rc_t rc;
 
        if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
-                                   &current_mode)) != 0) {
+                                   &current_mode, NULL)) != 0) {
                /* No port mode info available. */
                bandwidth = 0;
                goto out;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to