@@ -889,6 +889,7 @@ static void ice_lag_link(struct ice_lag *lag)
889889
890890 lag -> bonded = true;
891891 lag -> role = ICE_LAG_UNSET ;
892+ netdev_info (lag -> netdev , "Shared SR-IOV resources in bond are active\n" );
892893}
893894
894895/**
@@ -1333,6 +1334,7 @@ ice_lag_chk_comp(struct ice_lag *lag, void *ptr)
13331334 struct netdev_notifier_bonding_info * info ;
13341335 struct netdev_bonding_info * bonding_info ;
13351336 struct list_head * tmp ;
1337+ struct device * dev ;
13361338 int count = 0 ;
13371339
13381340 if (!lag -> primary )
@@ -1345,11 +1347,21 @@ ice_lag_chk_comp(struct ice_lag *lag, void *ptr)
13451347 if (event_upper != lag -> upper_netdev )
13461348 return true;
13471349
1350+ dev = ice_pf_to_dev (lag -> pf );
1351+
1352+ /* only supporting switchdev mode for SRIOV VF LAG.
1353+ * primary interface has to be in switchdev mode
1354+ */
1355+ if (!ice_is_switchdev_running (lag -> pf )) {
1356+ dev_info (dev , "Primary interface not in switchdev mode - VF LAG disabled\n" );
1357+ return false;
1358+ }
1359+
13481360 info = (struct netdev_notifier_bonding_info * )ptr ;
13491361 bonding_info = & info -> bonding_info ;
13501362 lag -> bond_mode = bonding_info -> master .bond_mode ;
13511363 if (lag -> bond_mode != BOND_MODE_ACTIVEBACKUP ) {
1352- netdev_info ( lag -> netdev , "Bond Mode not ACTIVE-BACKUP\n" );
1364+ dev_info ( dev , "Bond Mode not ACTIVE-BACKUP - VF LAG disabled \n" );
13531365 return false;
13541366 }
13551367
@@ -1359,17 +1371,19 @@ ice_lag_chk_comp(struct ice_lag *lag, void *ptr)
13591371 struct ice_netdev_priv * peer_np ;
13601372 struct net_device * peer_netdev ;
13611373 struct ice_vsi * vsi , * peer_vsi ;
1374+ struct ice_pf * peer_pf ;
13621375
13631376 entry = list_entry (tmp , struct ice_lag_netdev_list , node );
13641377 peer_netdev = entry -> netdev ;
13651378 if (!netif_is_ice (peer_netdev )) {
1366- netdev_info (lag -> netdev , "Found non-ice netdev in LAG\n" );
1379+ dev_info (dev , "Found %s non-ice netdev in LAG - VF LAG disabled\n" ,
1380+ netdev_name (peer_netdev ));
13671381 return false;
13681382 }
13691383
13701384 count ++ ;
13711385 if (count > 2 ) {
1372- netdev_info ( lag -> netdev , "Found more than two netdevs in LAG\n" );
1386+ dev_info ( dev , "Found more than two netdevs in LAG - VF LAG disabled \n" );
13731387 return false;
13741388 }
13751389
@@ -1378,15 +1392,24 @@ ice_lag_chk_comp(struct ice_lag *lag, void *ptr)
13781392 peer_vsi = peer_np -> vsi ;
13791393 if (lag -> pf -> pdev -> bus != peer_vsi -> back -> pdev -> bus ||
13801394 lag -> pf -> pdev -> slot != peer_vsi -> back -> pdev -> slot ) {
1381- netdev_info (lag -> netdev , "Found netdev on different device in LAG\n" );
1395+ dev_info (dev , "Found %s on different device in LAG - VF LAG disabled\n" ,
1396+ netdev_name (peer_netdev ));
13821397 return false;
13831398 }
13841399
13851400 dcb_cfg = & vsi -> port_info -> qos_cfg .local_dcbx_cfg ;
13861401 peer_dcb_cfg = & peer_vsi -> port_info -> qos_cfg .local_dcbx_cfg ;
13871402 if (memcmp (dcb_cfg , peer_dcb_cfg ,
13881403 sizeof (struct ice_dcbx_cfg ))) {
1389- netdev_info (lag -> netdev , "Found netdev with different DCB config in LAG\n" );
1404+ dev_info (dev , "Found %s with different DCB in LAG - VF LAG disabled\n" ,
1405+ netdev_name (peer_netdev ));
1406+ return false;
1407+ }
1408+
1409+ peer_pf = peer_vsi -> back ;
1410+ if (test_bit (ICE_FLAG_FW_LLDP_AGENT , peer_pf -> flags )) {
1411+ dev_warn (dev , "Found %s with FW LLDP agent active - VF LAG disabled\n" ,
1412+ netdev_name (peer_netdev ));
13901413 return false;
13911414 }
13921415 }
@@ -1459,6 +1482,58 @@ ice_lag_monitor_rdma(struct ice_lag *lag, void *ptr)
14591482 ice_set_rdma_cap (lag -> pf );
14601483}
14611484
1485+ /**
1486+ * ice_lag_chk_disabled_bond - monitor interfaces entering/leaving disabled bond
1487+ * @lag: lag info struct
1488+ * @ptr: opaque data containing event
1489+ *
1490+ * as interfaces enter a bond - determine if the bond is currently
1491+ * SRIOV LAG compliant and flag if not. As interfaces leave the
1492+ * bond, reset their compliant status.
1493+ */
1494+ static void ice_lag_chk_disabled_bond (struct ice_lag * lag , void * ptr )
1495+ {
1496+ struct net_device * netdev = netdev_notifier_info_to_dev (ptr );
1497+ struct netdev_notifier_changeupper_info * info = ptr ;
1498+ struct ice_lag * prim_lag ;
1499+
1500+ if (netdev != lag -> netdev )
1501+ return ;
1502+
1503+ if (info -> linking ) {
1504+ prim_lag = ice_lag_find_primary (lag );
1505+ if (prim_lag &&
1506+ !ice_is_feature_supported (prim_lag -> pf , ICE_F_SRIOV_LAG )) {
1507+ ice_clear_feature_support (lag -> pf , ICE_F_SRIOV_LAG );
1508+ netdev_info (netdev , "Interface added to non-compliant SRIOV LAG aggregate\n" );
1509+ }
1510+ } else {
1511+ ice_lag_init_feature_support_flag (lag -> pf );
1512+ }
1513+ }
1514+
1515+ /**
1516+ * ice_lag_disable_sriov_bond - set members of bond as not supporting SRIOV LAG
1517+ * @lag: primary interfaces lag struct
1518+ */
1519+ static void ice_lag_disable_sriov_bond (struct ice_lag * lag )
1520+ {
1521+ struct ice_lag_netdev_list * entry ;
1522+ struct ice_netdev_priv * np ;
1523+ struct net_device * netdev ;
1524+ struct list_head * tmp ;
1525+ struct ice_pf * pf ;
1526+
1527+ list_for_each (tmp , lag -> netdev_head ) {
1528+ entry = list_entry (tmp , struct ice_lag_netdev_list , node );
1529+ netdev = entry -> netdev ;
1530+ np = netdev_priv (netdev );
1531+ pf = np -> vsi -> back ;
1532+
1533+ ice_clear_feature_support (pf , ICE_F_SRIOV_LAG );
1534+ }
1535+ }
1536+
14621537/**
14631538 * ice_lag_process_event - process a task assigned to the lag_wq
14641539 * @work: pointer to work_struct
@@ -1480,6 +1555,7 @@ static void ice_lag_process_event(struct work_struct *work)
14801555 switch (lag_work -> event ) {
14811556 case NETDEV_CHANGEUPPER :
14821557 info = & lag_work -> info .changeupper_info ;
1558+ ice_lag_chk_disabled_bond (lag_work -> lag , info );
14831559 if (ice_is_feature_supported (pf , ICE_F_SRIOV_LAG )) {
14841560 ice_lag_monitor_link (lag_work -> lag , info );
14851561 ice_lag_changeupper_event (lag_work -> lag , info );
@@ -1491,6 +1567,9 @@ static void ice_lag_process_event(struct work_struct *work)
14911567 if (ice_is_feature_supported (pf , ICE_F_SRIOV_LAG )) {
14921568 if (!ice_lag_chk_comp (lag_work -> lag ,
14931569 & lag_work -> info .bonding_info )) {
1570+ netdev = lag_work -> info .bonding_info .info .dev ;
1571+ ice_lag_disable_sriov_bond (lag_work -> lag );
1572+ ice_lag_unregister (lag_work -> lag , netdev );
14941573 goto lag_cleanup ;
14951574 }
14961575 ice_lag_monitor_active (lag_work -> lag ,
0 commit comments