Author: arybchik
Date: Thu Jul 23 15:08:21 2015
New Revision: 285813
URL: https://svnweb.freebsd.org/changeset/base/285813

Log:
  MFC r285798
  
  sfxge: added fallbacks for pre 4.2.1 firmware support
  
  Driver must be able to start against older firmware that is missing
  recently added MCDI calls, otherwise firmware upgrade will not be
  possible.
  
  Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:    re (gjb)

Modified:
  stable/10/sys/dev/sfxge/common/hunt_impl.h
  stable/10/sys/dev/sfxge/common/hunt_mac.c
  stable/10/sys/dev/sfxge/common/hunt_nic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/hunt_impl.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_impl.h  Thu Jul 23 13:52:53 2015        
(r285812)
+++ stable/10/sys/dev/sfxge/common/hunt_impl.h  Thu Jul 23 15:08:21 2015        
(r285813)
@@ -695,6 +695,21 @@ hunt_tx_qstats_update(
 
 #define        HUNT_MIN_PIO_ALLOC_SIZE (HUNT_PIOBUF_SIZE / 32)
 
+#define HUNT_LEGACY_PF_PRIVILEGE_MASK                                  \
+       (MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN                     |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_LINK                       |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_ONLOAD                     |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_PTP                        |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_INSECURE_FILTERS           |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING               |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_UNICAST                    |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_MULTICAST                  |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_BROADCAST                  |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST              |       \
+       MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS)
+
+#define HUNT_LEGACY_VF_PRIVILEGE_MASK  0
+
 typedef uint32_t       efx_piobuf_handle_t;
 
 #define        EFX_PIOBUF_HANDLE_INVALID       ((efx_piobuf_handle_t) -1)

Modified: stable/10/sys/dev/sfxge/common/hunt_mac.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_mac.c   Thu Jul 23 13:52:53 2015        
(r285812)
+++ stable/10/sys/dev/sfxge/common/hunt_mac.c   Thu Jul 23 15:08:21 2015        
(r285813)
@@ -150,8 +150,19 @@ hunt_mac_addr_set(
 {
        int rc;
 
-       if ((rc = efx_mcdi_vadapter_set_mac(enp)) != 0)
-               goto fail1;
+       if ((rc = efx_mcdi_vadapter_set_mac(enp)) != 0) {
+               if (rc != ENOTSUP)
+                       goto fail1;
+
+               /* Fallback for older firmware without Vadapter support */
+               if ((rc = hunt_mac_reconfigure(enp)) != 0)
+                       goto fail2;
+       }
+
+       return (0);
+
+fail2:
+       EFSYS_PROBE(fail2);
 
 fail1:
        EFSYS_PROBE1(fail1, int, rc);

Modified: stable/10/sys/dev/sfxge/common/hunt_nic.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_nic.c   Thu Jul 23 13:52:53 2015        
(r285812)
+++ stable/10/sys/dev/sfxge/common/hunt_nic.c   Thu Jul 23 15:08:21 2015        
(r285813)
@@ -1239,8 +1239,19 @@ hunt_board_cfg(
         * the privilege mask to check for sufficient privileges, as that
         * can result in time-of-check/time-of-use bugs.
         */
-       if ((rc = efx_mcdi_privilege_mask(enp, pf, vf, &mask)) != 0)
-               goto fail13;
+       if ((rc = efx_mcdi_privilege_mask(enp, pf, vf, &mask)) != 0) {
+               if (rc != ENOTSUP)
+                       goto fail13;
+
+               /* Fallback for old firmware without privilege mask support */
+               if (EFX_PCI_FUNCTION_IS_PF(encp)) {
+                       /* Assume PF has admin privilege */
+                       mask = HUNT_LEGACY_PF_PRIVILEGE_MASK;
+               } else {
+                       /* VF is always unprivileged by default */
+                       mask = HUNT_LEGACY_VF_PRIVILEGE_MASK;
+               }
+       }
 
        encp->enc_privilege_mask = mask;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to