Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion config/RdkVlanManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@
<type>unsignedInt</type>
<syntax>uint32</syntax>
<writable>true</writable>
</parameter>
</parameter>
<parameter>
<name>MACVLAN</name>
<type>unsignedInt</type>
<syntax>uint32</syntax>
<writable>true</writable>
</parameter>
<parameter>
<name>X_RDK_BaseInterface</name>
<type>string(64)</type>
Expand Down
2 changes: 2 additions & 0 deletions source/TR-181/include/vlan_apis.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define PSM_VLANMANAGER_LOWERLAYERS "dmsb.vlanmanager.%d.lowerlayers"
#define PSM_VLANMANAGER_VLANID "dmsb.vlanmanager.%d.vlanid"
#define PSM_VLANMANAGER_TPID "dmsb.vlanmanager.%d.tpid"
#define PSM_VLANMANAGER_MACVLAN "dmsb.vlanmanager.%d.macvlan"
#define PSM_VLANMANAGER_BASEINTERFACE "dmsb.vlanmanager.%d.baseinterface"
#define PSM_VLANMANAGER_PATH "dmsb.vlanmanager.%d.path"

Expand Down Expand Up @@ -88,6 +89,7 @@ _DML_VLAN
CHAR BaseInterface[64];
INT VLANId;
UINT TPId;
UINT macvlan;
CHAR Path[1024];
Comment on lines 89 to 93
Comment on lines 90 to 93
Comment on lines 90 to 93
Comment on lines 89 to 93
Comment on lines 89 to 93
}
DML_VLAN, *PDML_VLAN;
Expand Down
2 changes: 1 addition & 1 deletion source/TR-181/middle_layer_src/ethernet_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ static ANSC_STATUS EthLink_CreateUnTaggedInterface(PDML_ETHERNET pEntry)
#if !defined(VLAN_MANAGER_HAL_ENABLED)
static ANSC_STATUS EthLink_DeleteUnTaggedInterface(PDML_ETHERNET pEntry)
{

ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS;

if (pEntry == NULL)
Expand All @@ -943,7 +944,6 @@ static ANSC_STATUS EthLink_DeleteUnTaggedInterface(PDML_ETHERNET pEntry)

CcspTraceInfo(("%s-%d: Successfully deleted untagged VLAN interface %s\n",
__FUNCTION__, __LINE__, pEntry->Name));

return returnStatus;
}
#endif /* !VLAN_MANAGER_HAL_ENABLED */
Expand Down
78 changes: 70 additions & 8 deletions source/TR-181/middle_layer_src/vlan_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ void * Vlan_Disable(void *Arg)
Vlan_DeleteInterface(pEntry);
#endif
}
#if !defined(VLAN_MANAGER_HAL_ENABLED)
else if(pEntry->VLANId == -1 && pEntry->macvlan == 0)
{
Vlan_DeleteInterface(pEntry);
}
#endif
pEntry->Status = VLAN_IF_DOWN;
EthLink_SendVirtualIfaceVlanStatus(pEntry->Path, "Down");
CcspTraceInfo(("%s - %s:Successfully deleted VLAN interface %s\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_CREATE, pEntry->Name));
Expand Down Expand Up @@ -590,6 +596,32 @@ static ANSC_STATUS Vlan_CreateTaggedInterface(PDML_VLAN pEntry)
}
#endif

#if !defined(VLAN_MANAGER_HAL_ENABLED)
static ANSC_STATUS Vlan_CreateUnTaggedInterface(PDML_VLAN pEntry)
{
ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS;

if (pEntry == NULL)
{
CcspTraceError(("%s-%d: Failed to Create UnTagged Vlan Interface\n", __FUNCTION__, __LINE__));
return ANSC_STATUS_FAILURE;
}

v_secure_system("ip link add link %s name %s type vlan id 0", pEntry->Alias , pEntry->Name);

v_secure_system("ip link set %s up", pEntry->Name);

if (Vlan_SetMacAddr(pEntry) == ANSC_STATUS_FAILURE)
{
CcspTraceError(("%s Failed to Set MacAddress \n", __FUNCTION__));
return ANSC_STATUS_FAILURE;
}

return returnStatus;
}
#endif


void * Vlan_Enable(void *Arg)
{
ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS;
Expand All @@ -603,11 +635,17 @@ void * Vlan_Enable(void *Arg)
pthread_exit(NULL);
}

CcspTraceError(("%s-%d: PALAKSHA MAIN VLAN_ENABLE VLAN ID CASE %d %d %s %s\n", __FUNCTION__, __LINE__, pEntry->VLANId,pEntry->macvlan, pEntry->BaseInterface, pEntry->Name));
pthread_detach(pthread_self());

pthread_mutex_lock(&vlan_access_mutex);
//Create Vlan Tagged Interface
if(pEntry->VLANId > 0) {
#if defined(VLAN_MANAGER_HAL_ENABLED)
if(pEntry->VLANId > 0 ) {
#else
if(pEntry->VLANId > 0 || (pEntry->VLANId == -1 && pEntry->macvlan == 0)) {
#endif
CcspTraceError(("%s-%d: PALAKSHA MAIN VLAN_ENABLE VLAN ID GREATER CASE %d %d %s %s\n", __FUNCTION__, __LINE__, pEntry->VLANId,pEntry->macvlan, pEntry->BaseInterface, pEntry->Name));
if (Vlan_SetEthLink(pEntry, TRUE, TRUE) == ANSC_STATUS_FAILURE)
{
CcspTraceError(("%s-%d: Failed to Enable EthLink\n", __FUNCTION__, __LINE__));
Expand All @@ -617,25 +655,48 @@ void * Vlan_Enable(void *Arg)
{
CcspTraceError(("[%s][%d]Failed to get vlan interface status \n", __FUNCTION__, __LINE__));
}
#if defined(VLAN_MANAGER_HAL_ENABLED)
if ( ( status != VLAN_IF_NOTPRESENT ) && ( status != VLAN_IF_ERROR ) )
{
CcspTraceInfo(("%s %s:VLAN interface(%s) already exists, delete it first\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_CREATE, pEntry->Name));
#if defined(VLAN_MANAGER_HAL_ENABLED)
returnStatus = vlan_eth_hal_deleteInterface(pEntry->Name, pEntry->InstanceNumber);
if (ANSC_STATUS_SUCCESS != returnStatus)
{
CcspTraceError(("%s - Failed to delete the existing VLAN interface %s\n", __FUNCTION__, pEntry->Name));
}
CcspTraceInfo(("%s - %s:Successfully deleted VLAN interface %s\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_DELETE, pEntry->Name));
else
#else
v_secure_system("ip link set %s down", pEntry->Name);
v_secure_system("ip link delete %s",pEntry->Name);
#endif
{
CcspTraceInfo(("%s - %s:Successfully deleted VLAN interface %s\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_DELETE, pEntry->Name));
}
}

#if !defined(VLAN_MANAGER_HAL_ENABLED)
if(pEntry->VLANId > 0)
{
#endif
returnStatus = Vlan_CreateTaggedInterface(pEntry);
if (ANSC_STATUS_SUCCESS != returnStatus)
returnStatus = Vlan_CreateTaggedInterface(pEntry);
if (ANSC_STATUS_SUCCESS != returnStatus)
{
pEntry->Status = VLAN_IF_ERROR;
CcspTraceError(("[%s][%d]Failed to create VLAN Tagged interface \n", __FUNCTION__, __LINE__));
}
#if !defined(VLAN_MANAGER_HAL_ENABLED)
}
else
{
pEntry->Status = VLAN_IF_ERROR;
CcspTraceError(("[%s][%d]Failed to create VLAN Tagged interface \n", __FUNCTION__, __LINE__));
CcspTraceError(("[%s][%d]PALAKSHA CREATING UNTAGGED VLAN WITH VLAN ID 0\n", __FUNCTION__, __LINE__));
returnStatus = Vlan_CreateUnTaggedInterface(pEntry);
if (ANSC_STATUS_SUCCESS != returnStatus)
{
pEntry->Status = VLAN_IF_ERROR;
CcspTraceError(("[%s][%d]Failed to create VLAN UnTagged interface \n", __FUNCTION__, __LINE__));
}
}

#endif
//Get status of VLAN link
while(iIterator < 10)
{
Expand All @@ -661,6 +722,7 @@ void * Vlan_Enable(void *Arg)
}
else
{
CcspTraceError(("%s-%d: PALAKSHA INSIDE FULL ELSE CASE calling Vlan_SetEthLink\n", __FUNCTION__, __LINE__));
//Enable EthLink and it will take care Creation of UnTagged Vlan Interface.
if (Vlan_SetEthLink(pEntry, TRUE, FALSE) == ANSC_STATUS_FAILURE)
{
Comment on lines 727 to 728
Expand Down
11 changes: 11 additions & 0 deletions source/TR-181/middle_layer_src/vlan_dml.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ Vlan_GetParamUlongValue
*puLong = p_Vlan->TPId;
return TRUE;
}
if (strcmp(ParamName, "MACVLAN") == 0)
{
*puLong = p_Vlan->macvlan;
return TRUE;
}
/* CcspTraceWarning(("Unsupported parameter '%s'\n", ParamName)); */
return FALSE;
}
Expand Down Expand Up @@ -627,6 +632,12 @@ Vlan_SetParamUlongValue
p_Vlan->TPId = uValue;
return TRUE;
}
if (strcmp(ParamName, "MACVLAN") == 0)
{
p_Vlan->macvlan = uValue;
return TRUE;
}


/* CcspTraceWarning(("Unsupported parameter '%s'\n", ParamName)); */
return FALSE;
Expand Down
17 changes: 17 additions & 0 deletions source/TR-181/middle_layer_src/vlan_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define PSM_VLANMANAGER_CFG_REGION "dmsb.vlanmanager.cfg.%d.region"
#define PSM_VLANMANAGER_CFG_VLANID "dmsb.vlanmanager.cfg.%d.vlanid"
#define PSM_VLANMANAGER_CFG_TPID "dmsb.vlanmanager.cfg.%d.tpid"
#define PSM_VLANMANAGER_CFG_MACVLAN "dmsb.vlanmanager.cfg.%d.macvlan"

extern char g_Subsystem[32];
extern ANSC_HANDLE bus_handle;
Expand Down Expand Up @@ -278,6 +279,15 @@ static ANSC_STATUS VlanTerminationInitialize( ANSC_HANDLE hThisObject)
pVlan[nIndex].TPId = atoi(acPSMValue) ;
}

/* get macvlan from psm */
memset(acPSMQuery, 0, sizeof(acPSMQuery));
memset(acPSMValue, 0, sizeof(acPSMValue));
snprintf( acPSMQuery, sizeof( acPSMQuery ), PSM_VLANMANAGER_CFG_MACVLAN, (vlanCfgIndexes[nIndex] + 1) );
if ( CCSP_SUCCESS == DmlVlanGetPSMRecordValue( acPSMQuery, acPSMValue ) )
{
pVlan[nIndex].macvlan = atoi(acPSMValue) ;
}

/*TODO:
*Need to be Removed Path From PSM Once RBUS Support Available in VlanManager and WanManager.
*/
Expand Down Expand Up @@ -377,6 +387,13 @@ static ANSC_STATUS VlanTerminationInitialize( ANSC_HANDLE hThisObject)
pVlan[nIndex].TPId = atoi(acPSMValue) ;
}

/* get cfg macvlan from psm */
snprintf( acPSMQuery, sizeof( acPSMQuery ), PSM_VLANMANAGER_MACVLAN, nIndex + 1 );
if ( CCSP_SUCCESS == DmlVlanGetPSMRecordValue( acPSMQuery, acPSMValue ) )
{
pVlan[nIndex].macvlan = atoi(acPSMValue) ;
}

/* get base interface from psm */
snprintf( acPSMQuery, sizeof( acPSMQuery ), PSM_VLANMANAGER_BASEINTERFACE, nIndex + 1 );
if ( CCSP_SUCCESS == DmlVlanGetPSMRecordValue( acPSMQuery, acPSMValue ) )
Expand Down