@@ -2517,6 +2517,20 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index)
25172517 fp -> mode = TPA_MODE_DISABLED ;
25182518}
25192519
2520+ void bnx2x_set_os_driver_state (struct bnx2x * bp , u32 state )
2521+ {
2522+ u32 cur ;
2523+
2524+ if (!IS_MF_BD (bp ) || !SHMEM2_HAS (bp , os_driver_state ) || IS_VF (bp ))
2525+ return ;
2526+
2527+ cur = SHMEM2_RD (bp , os_driver_state [BP_FW_MB_IDX (bp )]);
2528+ DP (NETIF_MSG_IFUP , "Driver state %08x-->%08x\n" ,
2529+ cur , state );
2530+
2531+ SHMEM2_WR (bp , os_driver_state [BP_FW_MB_IDX (bp )], state );
2532+ }
2533+
25202534int bnx2x_load_cnic (struct bnx2x * bp )
25212535{
25222536 int i , rc , port = BP_PORT (bp );
@@ -2880,6 +2894,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
28802894 /* mark driver is loaded in shmem2 */
28812895 u32 val ;
28822896 val = SHMEM2_RD (bp , drv_capabilities_flag [BP_FW_MB_IDX (bp )]);
2897+ val &= ~DRV_FLAGS_MTU_MASK ;
2898+ val |= (bp -> dev -> mtu << DRV_FLAGS_MTU_SHIFT );
28832899 SHMEM2_WR (bp , drv_capabilities_flag [BP_FW_MB_IDX (bp )],
28842900 val | DRV_FLAGS_CAPABILITIES_LOADED_SUPPORTED |
28852901 DRV_FLAGS_CAPABILITIES_LOADED_L2 );
@@ -2896,6 +2912,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
28962912 if (bp -> port .pmf && (bp -> state != BNX2X_STATE_DIAG ))
28972913 bnx2x_dcbx_init (bp , false);
28982914
2915+ if (!IS_MF_SD_STORAGE_PERSONALITY_ONLY (bp ))
2916+ bnx2x_set_os_driver_state (bp , OS_DRIVER_STATE_ACTIVE );
2917+
28992918 DP (NETIF_MSG_IFUP , "Ending successfully NIC load\n" );
29002919
29012920 return 0 ;
@@ -2963,6 +2982,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
29632982
29642983 DP (NETIF_MSG_IFUP , "Starting NIC unload\n" );
29652984
2985+ if (!IS_MF_SD_STORAGE_PERSONALITY_ONLY (bp ))
2986+ bnx2x_set_os_driver_state (bp , OS_DRIVER_STATE_DISABLED );
2987+
29662988 /* mark driver is unloaded in shmem2 */
29672989 if (IS_PF (bp ) && SHMEM2_HAS (bp , drv_capabilities_flag )) {
29682990 u32 val ;
@@ -4191,6 +4213,41 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
41914213 return NETDEV_TX_OK ;
41924214}
41934215
4216+ void bnx2x_get_c2s_mapping (struct bnx2x * bp , u8 * c2s_map , u8 * c2s_default )
4217+ {
4218+ int mfw_vn = BP_FW_MB_IDX (bp );
4219+ u32 tmp ;
4220+
4221+ /* If the shmem shouldn't affect configuration, reflect */
4222+ if (!IS_MF_BD (bp )) {
4223+ int i ;
4224+
4225+ for (i = 0 ; i < BNX2X_MAX_PRIORITY ; i ++ )
4226+ c2s_map [i ] = i ;
4227+ * c2s_default = 0 ;
4228+
4229+ return ;
4230+ }
4231+
4232+ tmp = SHMEM2_RD (bp , c2s_pcp_map_lower [mfw_vn ]);
4233+ tmp = (__force u32 )be32_to_cpu ((__force __be32 )tmp );
4234+ c2s_map [0 ] = tmp & 0xff ;
4235+ c2s_map [1 ] = (tmp >> 8 ) & 0xff ;
4236+ c2s_map [2 ] = (tmp >> 16 ) & 0xff ;
4237+ c2s_map [3 ] = (tmp >> 24 ) & 0xff ;
4238+
4239+ tmp = SHMEM2_RD (bp , c2s_pcp_map_upper [mfw_vn ]);
4240+ tmp = (__force u32 )be32_to_cpu ((__force __be32 )tmp );
4241+ c2s_map [4 ] = tmp & 0xff ;
4242+ c2s_map [5 ] = (tmp >> 8 ) & 0xff ;
4243+ c2s_map [6 ] = (tmp >> 16 ) & 0xff ;
4244+ c2s_map [7 ] = (tmp >> 24 ) & 0xff ;
4245+
4246+ tmp = SHMEM2_RD (bp , c2s_pcp_map_default [mfw_vn ]);
4247+ tmp = (__force u32 )be32_to_cpu ((__force __be32 )tmp );
4248+ * c2s_default = (tmp >> (8 * mfw_vn )) & 0xff ;
4249+ }
4250+
41944251/**
41954252 * bnx2x_setup_tc - routine to configure net_device for multi tc
41964253 *
@@ -4201,8 +4258,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
42014258 */
42024259int bnx2x_setup_tc (struct net_device * dev , u8 num_tc )
42034260{
4204- int cos , prio , count , offset ;
42054261 struct bnx2x * bp = netdev_priv (dev );
4262+ u8 c2s_map [BNX2X_MAX_PRIORITY ], c2s_def ;
4263+ int cos , prio , count , offset ;
42064264
42074265 /* setup tc must be called under rtnl lock */
42084266 ASSERT_RTNL ();
@@ -4226,12 +4284,16 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc)
42264284 return - EINVAL ;
42274285 }
42284286
4287+ bnx2x_get_c2s_mapping (bp , c2s_map , & c2s_def );
4288+
42294289 /* configure priority to traffic class mapping */
42304290 for (prio = 0 ; prio < BNX2X_MAX_PRIORITY ; prio ++ ) {
4231- netdev_set_prio_tc_map (dev , prio , bp -> prio_to_cos [prio ]);
4291+ int outer_prio = c2s_map [prio ];
4292+
4293+ netdev_set_prio_tc_map (dev , prio , bp -> prio_to_cos [outer_prio ]);
42324294 DP (BNX2X_MSG_SP | NETIF_MSG_IFUP ,
42334295 "mapping priority %d to tc %d\n" ,
4234- prio , bp -> prio_to_cos [prio ]);
4296+ outer_prio , bp -> prio_to_cos [outer_prio ]);
42354297 }
42364298
42374299 /* Use this configuration to differentiate tc0 from other COSes
@@ -4285,6 +4347,9 @@ int bnx2x_change_mac_addr(struct net_device *dev, void *p)
42854347 if (netif_running (dev ))
42864348 rc = bnx2x_set_eth_mac (bp , true);
42874349
4350+ if (IS_PF (bp ) && SHMEM2_HAS (bp , curr_cfg ))
4351+ SHMEM2_WR (bp , curr_cfg , CURR_CFG_MET_OS );
4352+
42884353 return rc ;
42894354}
42904355
@@ -4838,6 +4903,9 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
48384903 */
48394904 dev -> mtu = new_mtu ;
48404905
4906+ if (IS_PF (bp ) && SHMEM2_HAS (bp , curr_cfg ))
4907+ SHMEM2_WR (bp , curr_cfg , CURR_CFG_MET_OS );
4908+
48414909 return bnx2x_reload_if_running (dev );
48424910}
48434911
0 commit comments