From b040ddd620d90b3f8100e43a9887dbd3ad3cf279 Mon Sep 17 00:00:00 2001 From: "Xu, Liang" <liang.xu@intel.com> Date: Wed, 14 Mar 2018 07:02:18 +0100 Subject: [PATCH] Merge pull request #276 in SW_PON/linux from bugfix/DRVLIB_SW-395-gswip3.0 to xrx500 * commit 'b5fd84e062dfb008ef4eadbb3d638e3f2edf57fc': DRVLIB_SW-395-gswip3.0: Bug Fix for GSWIP 3.0 in GSW_MAC_TableClear and GSW_VLAN_PortMemberAdd DRVLIB_SW-395-gswip3.0: Fixed Alignment issue, and corrected few Api errors for GSWIP 3.0 DRVLIB_SW-395: Missing Goto in GSWIP3.0 DRVLIB_SW-395-gswip3.0: Multicast Table Entry Add Fix DRVLIB_SW-395-gswip3.0: BugFix for Mac table Entry Add for GSWIP 3.0 --- .../lantiq/switch-api/gsw_flow_core.c | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c b/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c index 270954aaa..a8e764e3b 100644 --- a/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c +++ b/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c @@ -3153,15 +3153,15 @@ GSW_return_t GSW_MAC_TableClear(void *cdev) ethsw_api_dev_t *gswdev = GSW_PDATA_GET(cdev); u32 ret; -#ifdef __KERNEL__ - spin_lock_bh(&gswdev->lock_pce); -#endif - if (gswdev == NULL) { pr_err("%s:%s:%d", __FILE__, __func__, __LINE__); return GSW_statusErr; } +#ifdef __KERNEL__ + spin_lock_bh(&gswdev->lock_pce); +#endif + /* Flush all entries from the MAC table */ gsw_w32(cdev, PCE_GCTRL_0_MTFL_OFFSET, PCE_GCTRL_0_MTFL_SHIFT, @@ -3244,10 +3244,10 @@ GSW_return_t GSW_MAC_TableEntryAdd(void *cdev, if (gswdev->gipver == LTQ_GSWIP_3_0) { if ((parm->nPortId >= gswdev->tpnum) && - (!(parm->nPortId & 0x80000000))) + (!(parm->nPortId & 0x80000000))) { ret = GSW_statusErr; - - goto UNLOCK_AND_RETURN; + goto UNLOCK_AND_RETURN; + } } memset(&tbl_prog, 0, sizeof(pctbl_prog_t)); @@ -5574,8 +5574,10 @@ GSW_return_t GSW_VLAN_PortMemberAdd(void *cdev, goto UNLOCK_AND_RETURN; } - if (pcindex >= 64) - return GSW_statusValueRange; + if (pcindex >= 64) { + ret = GSW_statusValueRange; + goto UNLOCK_AND_RETURN; + } get_vlan_sw_table(cdev, pcindex, &avlantbl); @@ -5762,6 +5764,7 @@ GSW_return_t GSW_VLAN_PortMemberRemove(void *cdev, if (pcindex == 0xFF) { pr_err("This vid doesn't exists\n"); ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; } if (pcindex >= 64) { @@ -5831,6 +5834,7 @@ GSW_return_t GSW_VLAN_ReservedAdd(void *cdev, pr_err("ERROR: %s:%s:%d,(VID:%d)\n", __FILE__, __func__, __LINE__, parm->nVId); ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; } memset(&pcetable, 0, sizeof(pctbl_prog_t)); @@ -5921,6 +5925,7 @@ GSW_return_t GSW_VLAN_ReservedRemove(void *cdev, pr_err("ERROR: %s:%s:%d,(VID:%d)\n", __FILE__, __func__, __LINE__, parm->nVId); ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; } memset(&pcetable, 0, sizeof(pctbl_prog_t)); @@ -6567,7 +6572,7 @@ GSW_return_t GSW_QoS_SVLAN_ClassPCP_PortSet(void *cdev, if (gswdev == NULL) { pr_err("%s:%s:%d", __FILE__, __func__, __LINE__); - ret = GSW_statusErr; + return GSW_statusErr; } #ifdef __KERNEL__ @@ -10925,10 +10930,10 @@ GSW_return_t GSW_MulticastTableEntryAdd(void *cdev, #endif if (IS_VRSN_NOT_31(gswdev->gipver)) { - if (parm->nPortId >= gswdev->tpnum) + if (parm->nPortId >= gswdev->tpnum) { ret = GSW_statusErr; - - goto UNLOCK_AND_RETURN; + goto UNLOCK_AND_RETURN; + } } memset(&ptdata, 0, sizeof(pctbl_prog_t)); @@ -11391,8 +11396,10 @@ GSW_return_t GSW_MulticastTableEntryRemove(void *cdev, #endif if (IS_VRSN_NOT_31(gswdev->gipver)) { - if (parm->nPortId >= gswdev->tpnum) + if (parm->nPortId >= gswdev->tpnum) { ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; + } } memset(&ptdata, 0, sizeof(pctbl_prog_t)); @@ -20215,7 +20222,6 @@ GSW_return_t GSW_ExtendedVlanGet(void *cdev, GSW_EXTENDEDVLAN_config_t *parm) if (ret == GSW_statusErr) { pr_err("%s:%s:%d - GSW_QOS_Dscp2PcpTableGet", __FILE__, __func__, __LINE__); goto UNLOCK_AND_RETURN; - ; } memcpy(parm->sTreatment.nDscp2PcpMap, dscp2pcp_get.nMap, (sizeof(u8) * 64)); -- GitLab