Does mpc5748g support igmp?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does mpc5748g support igmp?

1,049 Views
jianting_chen
Contributor I

hello,i'm trying to implement the igmp protocol with mpc5748G.now the  igmp's memebership report can be sent.but it can not receive the udp packet from the multicast address 01:00:5e:00:02:02. i think it should be the mac filter is affecting.how can i config it to pass the multicast packet to the lwip?

0 Kudos
6 Replies

972 Views
taibuivan
NXP Employee
NXP Employee

I mean that you aren't using tcpip stack for MPC5748G, is it correct? 

if you use SDK, you can refer to lwip_mpc5748g example in SDK package. IGMP mac filter is configured in enetif_low_level_init function.

Unless, you can config filter as below when init enet interface (ETHIF_INIT):

netif->flags = netif->flags | (u8_t)NETIF_FLAG_IGMP;
/*Will add the function igmp_mac_filter to the netif*/
(netif)->igmp_mac_filter = igmp_enet_filter;

with: 

err_t igmp_enet_filter (struct netif *netif,
const ip4_addr_t *group,
enum netif_mac_filter_action action)
{
/*Generate MAC address based on IP address*/
uint8_t group_MAC[6];
group_MAC[0] = 0x01;
group_MAC[1] = 0x00;
group_MAC[2] = 0x5e;
group_MAC[3] = (0x7f & ip4_addr2(group));
group_MAC[4] = ip4_addr3(group);
group_MAC[5] = ip4_addr4(group);

/*call function modifying the enet driver*/
ENET_DRV_SetMulticastForward(netif->num, group_MAC, (action != NETIF_DEL_MAC_FILTER));
return ERR_OK;

}

0 Kudos

947 Views
jianting_chen
Contributor I

i'm using lwip 2.0.3.First i configed the igmp_mac_filter function point,but it did not work.so i configed the registers of GAUR and GALR with value 0xfffffff,but it still did not work.

 

my code as below.

/*********************************************************************/

 

/***********************FIRST****************************************/

struct netif *
netif_add(struct netif *netif,
#if LWIP_IPV4
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
#endif /* LWIP_IPV4 */
void *state, netif_init_fn init, netif_input_fn input)
{

.....

#if LWIP_IGMP
netif->igmp_mac_filter = netif_set_igmp_mac_filter_fn;
#endif /* LWIP_IGMP */

...

return netif;
}

err_t
igmp_start(struct netif *netif)
{
struct igmp_group* group;

LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: starting IGMP processing on if %p\n", (void*)netif));

group = igmp_lookup_group(netif, &allsystems);

if (group != NULL) {
group->group_state = IGMP_GROUP_IDLE_MEMBER;
group->use++;

/* Allow the igmp messages at the MAC level */
if (netif->igmp_mac_filter != NULL) {
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: igmp_mac_filter(ADD "));
ip4_addr_debug_print_val(IGMP_DEBUG, allsystems);
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", (void*)netif));
netif->igmp_mac_filter(netif, &allsystems, NETIF_ADD_MAC_FILTER);
}

return ERR_OK;
}

return ERR_MEM;
}

static err_t netif_set_igmp_mac_filter_fn( struct netif *netif, const ip4_addr_t *group, enum netif_mac_filter_action action )
{
uint8 macAddr[6] = {0x01,0x00,0x5e,0x00,0x02,0x02};
if( action = NETIF_DEL_MAC_FILTER )
{
EthIf_UpdatePhysAddrFilter(0,macAddr,ETH_REMOVE_FROM_FILTER);
EthIf_UpdatePhysAddrFilter(1,macAddr,ETH_REMOVE_FROM_FILTER);
}
else
{
EthIf_UpdatePhysAddrFilter(0,macAddr,ETH_ADD_TO_FILTER);
EthIf_UpdatePhysAddrFilter(1,macAddr,ETH_ADD_TO_FILTER);
}

}

/***********************FIRST****************************************/

/*********************************************************************/

 

/***************************************************************************/

/************************SECOND*****************************************/

static inline void addMulticastAdrsTablEntry(uint8 ethHwUnit,const uint8* pMacAdrs){
Eth_HwRegType *pHwPtr = ETH_GET_HW_PTR(ethHwUnit);
uint32 crc = calcCRC32(pMacAdrs);
if (crc >= 32) {
//pHwPtr->GAUR.B.GADDR1 |= (uint32)(1uL << (crc - 32));  //comented it to debug igmp
pHwPtr->GAUR.B.GADDR1 = 0xffffffff;
pHwPtr->GALR.B.GADDR2 = 0xffffffff;
} else {
//pHwPtr->GALR.B.GADDR2 |= (uint32)(1uL << crc);  //comented it to debug igmp
pHwPtr->GAUR.B.GADDR1 = 0xffffffff;
pHwPtr->GALR.B.GADDR2 = 0xffffffff;
}
}

/************************SECOND*****************************************/

/***************************************************************************/

0 Kudos

956 Views
jianting_chen
Contributor I

i'm using lwip 2.0.3.First i configed the igmp_mac_filter function point,but it did not work.so i configed the registers of GAUR and GALR with value 0xfffffff,but it still did not work.

 

my code as below.

/*********************************************************************/

 

/***********************FIRST****************************************/

struct netif *
netif_add(struct netif *netif,
#if LWIP_IPV4
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
#endif /* LWIP_IPV4 */
void *state, netif_init_fn init, netif_input_fn input)
{

.....

#if LWIP_IGMP
netif->igmp_mac_filter = netif_set_igmp_mac_filter_fn;
#endif /* LWIP_IGMP */

...

return netif;
}

err_t
igmp_start(struct netif *netif)
{
struct igmp_group* group;

LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: starting IGMP processing on if %p\n", (void*)netif));

group = igmp_lookup_group(netif, &allsystems);

if (group != NULL) {
group->group_state = IGMP_GROUP_IDLE_MEMBER;
group->use++;

/* Allow the igmp messages at the MAC level */
if (netif->igmp_mac_filter != NULL) {
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: igmp_mac_filter(ADD "));
ip4_addr_debug_print_val(IGMP_DEBUG, allsystems);
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", (void*)netif));
netif->igmp_mac_filter(netif, &allsystems, NETIF_ADD_MAC_FILTER);
}

return ERR_OK;
}

return ERR_MEM;
}

static err_t netif_set_igmp_mac_filter_fn( struct netif *netif, const ip4_addr_t *group, enum netif_mac_filter_action action )
{
uint8 macAddr[6] = {0x01,0x00,0x5e,0x00,0x02,0x02};
if( action = NETIF_DEL_MAC_FILTER )
{
EthIf_UpdatePhysAddrFilter(0,macAddr,ETH_REMOVE_FROM_FILTER);
EthIf_UpdatePhysAddrFilter(1,macAddr,ETH_REMOVE_FROM_FILTER);
}
else
{
EthIf_UpdatePhysAddrFilter(0,macAddr,ETH_ADD_TO_FILTER);
EthIf_UpdatePhysAddrFilter(1,macAddr,ETH_ADD_TO_FILTER);
}

}

/***********************FIRST****************************************/

/*********************************************************************/

 

/***************************************************************************/

/************************SECOND*****************************************/

static inline void addMulticastAdrsTablEntry(uint8 ethHwUnit,const uint8* pMacAdrs){
Eth_HwRegType *pHwPtr = ETH_GET_HW_PTR(ethHwUnit);
uint32 crc = calcCRC32(pMacAdrs);
if (crc >= 32) {
//pHwPtr->GAUR.B.GADDR1 |= (uint32)(1uL << (crc - 32));  //comented it to debug igmp
pHwPtr->GAUR.B.GADDR1 = 0xffffffff;
pHwPtr->GALR.B.GADDR2 = 0xffffffff;
} else {
//pHwPtr->GALR.B.GADDR2 |= (uint32)(1uL << crc);  //comented it to debug igmp
pHwPtr->GAUR.B.GADDR1 = 0xffffffff;
pHwPtr->GALR.B.GADDR2 = 0xffffffff;
}
}

/************************SECOND*****************************************/

/***************************************************************************/

0 Kudos

920 Views
taibuivan
NXP Employee
NXP Employee

@jianting_chen Which environment are you using in here? SDK driver or Autosar driver for MPC5748G?

and which release version are you using? 

0 Kudos

1,023 Views
taibuivan
NXP Employee
NXP Employee

Hi @jianting_chen 

I have some question. Which SDK version are you using for MPC5748G? Do you enable LWIP_UDP in your project?

If it relate to filter, you can use filter below:

filter='igmp and src ' + the multicast address + ' and dst ' + igmp's memebership report

 

Thanks and best regardings,

         Tai Bui Van

 

0 Kudos

988 Views
jianting_chen
Contributor I

i enabled the LWIP_UDP and LWIP_IGMP, but it still can not work. Now i even configed the registers of GAUR and GALR with value 0xfffffff. but it didn't work.the IGMP packet can not pass to the software.it seems the GAUR and the GALR is not working, how can i config it to make the packet passing to the software?

0 Kudos