commit 30dd545330b0b6af5a5dc3d1d559dab657428eb7
parent 1122325a610a115fce4439dcc0d8356af942d54c
Author: Broadcom SDK Release <sdk.releases@broadcom.com>
Date: Mon, 22 Apr 2019 18:50:57 -0700
SDK-177619: Users will not be allowed to add VLAN ingress only port membershi...
Devices: AllChips
Module: vlan
Symptom:
VLAN: ERROR: Operation failed - VLAN egress PORT_BITMAP_PROFILE
Users will not be allowed to add VLAN ingress only port membership if
the EGR VLAN port membership add fails. The API would either fail
completely or pass completely. However, since the API failed, it
will now not show these ports as a part of the VLAN. Further if the
PORT BITMAP PROFILE table is full and User wishes to remove some ports
from an existing VLAN such that the ports which were removed were not
referenced by any other VLAN, then the remove operation will succeed.
But if the removed ports are also reference by any other VLAN then the
API will fail.
Diffstat:
5 files changed, 117 insertions(+), 46 deletions(-)
diff --git a/sdk-6.5.16/include/bcm_int/esw/firebolt.h b/sdk-6.5.16/include/bcm_int/esw/firebolt.h
@@ -1488,6 +1488,8 @@ extern int bcm_xgs3_vlan_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp,
pbmp_t ubmp, pbmp_t ing_pbmp);
extern int bcm_xgs3_vlan_port_remove(int unit, bcm_vlan_t vid, pbmp_t pbmp,
pbmp_t ubmp, pbmp_t ing_pbmp);
+extern int _bcm_xgs3_vlan_table_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp,
+ pbmp_t ubmp, pbmp_t ing_pbmp, int table);
extern int _bcm_xgs3_vlan_table_port_remove(int unit, bcm_vlan_t vid, pbmp_t pbmp,
pbmp_t ubmp, pbmp_t ing_pbmp, int table);
extern int bcm_xgs3_vlan_port_get(int unit, bcm_vlan_t vid, pbmp_t *pbmp,
diff --git a/sdk-6.5.16/include/bcm_int/esw/tomahawk3.h b/sdk-6.5.16/include/bcm_int/esw/tomahawk3.h
@@ -197,6 +197,10 @@ _bcm_field_th3_em_udf_keygen_mask_get(int unit,
/* VLAN Port Bitmap Profile Mgmt function declarations */
extern int bcm_tomahawk3_vlan_detach(int unit);
+extern int bcm_th3_vlan_port_add(
+ int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp, pbmp_t ing_pbmp);
+extern int bcm_th3_vlan_port_remove(
+ int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp, pbmp_t ing_pbmp);
extern int _bcm_th3_vlan_pbmp_profile_init(int unit);
extern int _bcm_th3_vlan_pbmp_profile_destroy(int unit);
extern int _bcm_th3_vlan_pbmp_profile_entry_add(
diff --git a/sdk-6.5.16/src/bcm/esw/firebolt/vlan.c b/sdk-6.5.16/src/bcm/esw/firebolt/vlan.c
@@ -3293,7 +3293,7 @@ _bcm_xgs3_vlan_table_destroy(int unit, bcm_vlan_t vid, int table)
* Purpose:
* Add ports to the VLAN bitmap in a VLAN_TAB entry.
*/
-static int
+int
_bcm_xgs3_vlan_table_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp,
pbmp_t ubmp, pbmp_t ing_pbmp, int table)
{
@@ -3989,8 +3989,6 @@ int
bcm_xgs3_vlan_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp,
pbmp_t ing_pbmp)
{
- int rv = BCM_E_NONE;
-
if (SOC_IS_FBX(unit)) {
/* Check for the presence of 'ING_PORT_BITMAPf', this could either
reside in VLAN_TABm or in the 'ING_VLAN_VFI_MEMBERSHIPm' if
@@ -4009,21 +4007,9 @@ bcm_xgs3_vlan_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp,
}
if (BCM_VLAN_VALID(vid)) {
- rv = _bcm_xgs3_vlan_table_port_add(
- unit, vid, pbmp, ubmp, ing_pbmp, VLAN_TABLE(unit));
- if (BCM_FAILURE(rv)) {
-#if defined(BCM_TOMAHAWK3_SUPPORT)
- /* For TH3, if the add to the INGRESS VLAN table fails
- * revert the add to the EGR VLAN table done before.
- */
- if (SOC_IS_TOMAHAWK3(unit)) {
- BCM_IF_ERROR_RETURN(
- _bcm_xgs3_vlan_table_port_remove(
- unit, vid, pbmp, ubmp, ing_pbmp, EGR_VLANm));
- }
-#endif /* BCM_TOMAHAWK3_SUPPORT */
- return rv;
- }
+ BCM_IF_ERROR_RETURN
+ (_bcm_xgs3_vlan_table_port_add(unit, vid, pbmp, ubmp,
+ ing_pbmp, VLAN_TABLE(unit)));
}
#if defined(BCM_TRIDENT3_SUPPORT)
if (soc_feature(unit, soc_feature_vlan_vfi_untag_profile)) {
@@ -4040,7 +4026,7 @@ bcm_xgs3_vlan_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp,
unit, vid, FALSE, TRUE, ing_pbmp));
}
#endif /* BCM_TRIDENT2PLUS_SUPPORT */
- return rv;
+ return BCM_E_NONE;
}
int
diff --git a/sdk-6.5.16/src/bcm/esw/tomahawk3/mbcm.c b/sdk-6.5.16/src/bcm/esw/tomahawk3/mbcm.c
@@ -41,8 +41,8 @@ mbcm_functions_t mbcm_tomahawk3_driver = {
bcm_xgs3_vlan_reload,
bcm_xgs3_vlan_create,
bcm_xgs3_vlan_destroy,
- bcm_xgs3_vlan_port_add,
- bcm_xgs3_vlan_port_remove,
+ bcm_th3_vlan_port_add,
+ bcm_th3_vlan_port_remove,
bcm_xgs3_vlan_port_get,
bcm_xgs3_vlan_stg_get,
bcm_xgs3_vlan_stg_set,
diff --git a/sdk-6.5.16/src/bcm/esw/tomahawk3/vlan.c b/sdk-6.5.16/src/bcm/esw/tomahawk3/vlan.c
@@ -21,6 +21,7 @@
#include <bcm_int/esw/triumph.h>
#endif
#include <bcm_int/esw/tomahawk3.h>
+#include <bcm_int/esw/firebolt.h>
/* VLAN Cross Connect DB declaraions/definitions */
typedef struct _bcm_th3_vlan_xconnect_db_s {
@@ -108,6 +109,10 @@ _bcm_th3_vlan_pbmp_profile_init(int unit) {
soc_profile_mem_create(
unit, &mem, &entry_dwords, 1, vlan_pbmp_profile[unit]));
+ /* Create a default entry with empty port bitmap */
+ SOC_PBMP_CLEAR(pbmp);
+ _bcm_th3_vlan_pbmp_profile_entry_add(unit, pbmp, &profile_idx);
+
#if defined(BCM_WARM_BOOT_SUPPORT)
if (SOC_WARM_BOOT(unit)) {
/* Sync the SW profile data structure with actual indexes is use */
@@ -125,19 +130,8 @@ _bcm_th3_vlan_pbmp_profile_init(int unit) {
unit, vlan_pbmp_profile[unit], profile_idx, 1);
}
}
-
- /* One extra incr to preserve location PORTBITMAP_PROFILE_DEFAULT/
- SOC_IF_ERROR_RETURN(
- soc_profile_mem_reference(
- unit, vlan_pbmp_profile[unit], PORTBITMAP_PROFILE_DEFAULT, 1));
- */
- } else
-#endif /* BCM_WARM_BOOT_SUPPORT */
- {
- /* Create a default entry with empty port bitmap */
- SOC_PBMP_CLEAR(pbmp);
- _bcm_th3_vlan_pbmp_profile_entry_add(unit, pbmp, &profile_idx);
}
+#endif /* BCM_WARM_BOOT_SUPPORT */
return BCM_E_NONE;
}
@@ -502,21 +496,30 @@ _bcm_th3_vlan_pbmp_port_update(
/* Only perform the profile modification if the pbmp has changed */
if (BCM_PBMP_NEQ(cur_pbmp, org_pbmp)) {
- /* Insert the modified port bitmap into the profile table */
- BCM_IF_ERROR_RETURN(
- _bcm_th3_vlan_pbmp_profile_entry_add(
- unit, cur_pbmp, &new_profile_idx));
-
- /* Delete the old profile entry from the profile table */
+ /* First delete the old profile entry from the profile table */
rv = _bcm_th3_vlan_pbmp_profile_entry_delete(unit, old_profile_idx);
- /* If old entry was not able to delete then revert the new change */
- if (BCM_FAILURE(rv)) {
- _bcm_th3_vlan_pbmp_profile_entry_delete(unit, new_profile_idx);
- } else {
- /* Set the new profile index into the given VLAN table entry */
- soc_mem_field32_set(unit,
- VLAN_2_TABm, vt, PORT_BITMAP_PROFILE_PTRf, new_profile_idx);
+ if (BCM_SUCCESS(rv)) {
+ /* Insert the modified port bitmap into the profile table */
+ rv = _bcm_th3_vlan_pbmp_profile_entry_add(unit,
+ cur_pbmp,
+ &new_profile_idx);
+
+ /* If new entry add failed then add back the old pbmp */
+ if (BCM_FAILURE(rv)) {
+ if (BCM_SUCCESS(
+ _bcm_th3_vlan_pbmp_profile_entry_add(unit,
+ org_pbmp,
+ &old_profile_idx))) {
+ /* Set the old index into the given VLAN table entry */
+ soc_mem_field32_set(unit, VLAN_2_TABm,
+ vt, PORT_BITMAP_PROFILE_PTRf, old_profile_idx);
+ }
+ } else {
+ /* Set the new profile index into the given VLAN table entry */
+ soc_mem_field32_set(unit,
+ VLAN_2_TABm, vt, PORT_BITMAP_PROFILE_PTRf, new_profile_idx);
+ }
}
}
return rv;
@@ -1912,6 +1915,82 @@ _bcm_th3_vlan_xconnect_traverse(int unit,
return rv;
}
+/*
+ * Function:
+ * bcm_th3_vlan_port_add
+ *
+ * Purpose:
+ * Invokes low level functions to program the port membership bitmaps
+ * in tables VLAN_2 and EGR_VLAN.
+ *
+ * Parameters:
+ * unit - (IN) BCM unit.
+ * vid - (IN) VLAN Identifier.
+ * pbmp - (IN) Egress Tagged Port Bitmap to be added to the VLAN.
+ * upbmp - (IN) Egress Untagged Port Bitmap to be added to the VLAN.
+ * ing_pbmp - (IN) Ingress Port Bitmap to be added to the VLAN.
+ *
+ * Returns:
+ * BCM_E_NONE
+ * BCM_E_PARAM
+ * BCM_E_NOT_FOUND
+ * BCM_E_FAIL
+ * BCM_E_FULL
+ *
+ * Notes:
+ */
+int
+bcm_th3_vlan_port_add(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp,
+ pbmp_t ing_pbmp)
+{
+ if (BCM_VLAN_VALID(vid)) {
+ BCM_IF_ERROR_RETURN(_bcm_xgs3_vlan_table_port_add(
+ unit, vid, pbmp, ubmp, ing_pbmp, VLAN_2_TABm));
+
+ BCM_IF_ERROR_RETURN(_bcm_xgs3_vlan_table_port_add(
+ unit, vid, pbmp, ubmp, ing_pbmp, EGR_VLANm));
+ }
+
+ return BCM_E_NONE;
+}
+
+/*
+ * Function:
+ * bcm_th3_vlan_port_remove
+ *
+ * Purpose:
+ * Invokes low level functions to remove the ports in the given bitmaps
+ * from tables VLAN_2 and EGR_VLAN.
+ *
+ * Parameters:
+ * unit - (IN) BCM unit.
+ * vid - (IN) VLAN Identifier.
+ * pbmp - (IN) Egress Tagged Port Bitmap to be removed from the VLAN.
+ * upbmp - (IN) Egress Untagged Port Bitmap to be removed from the VLAN.
+ * ing_pbmp - (IN) Ingress Port Bitmap to be removed from the VLAN.
+ *
+ * Returns:
+ * BCM_E_NONE
+ * BCM_E_PARAM
+ * BCM_E_NOT_FOUND
+ * BCM_E_FAIL
+ * BCM_E_FULL
+ *
+ * Notes:
+ */
+int
+bcm_th3_vlan_port_remove(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp,
+ pbmp_t ing_pbmp)
+{
+ if (BCM_VLAN_VALID(vid)) {
+ BCM_IF_ERROR_RETURN(_bcm_xgs3_vlan_table_port_remove(
+ unit, vid, pbmp, ubmp, ing_pbmp, VLAN_2_TABm));
+ BCM_IF_ERROR_RETURN(_bcm_xgs3_vlan_table_port_remove(
+ unit, vid, pbmp, ubmp, ing_pbmp, EGR_VLANm));
+ }
+ return BCM_E_NONE;
+}
+
#ifndef BCM_SW_STATE_DUMP_DISABLE
/*
* Function: