I am trying to use dual PL ethernet connection for redundancy on Xilinx Zynq 7020. At the normal scenarios the ethernets can work separately. So I started by adding network interface for second ethernet too. After adding it with different address which comes from digital design that corresponds to ethernet 2 I can use dual ethernet. My question is that I cannot use only first ethernet when I unplug eth2 cord. But I can use only second ethernet when I unplug first cable. I commented out the netif_set_default part but I believe because of I initialized second ethernet later it overrides ethernet 1. Is there a way for using both ethernet ports separately and together? I also use one pcb that works for both. When I tried to seperate it, there were many problems occur. Thanks for any advice.
netif = &server_netif;
netif2 = &server_netif2;
ipaddr = (ip_addr_t
) IPADDR4_INIT(ip);
netif->ip_addr = ipaddr;
local_multicast = (ip_addr_t
) IPADDR4_INIT(multicast_ip);
if (!xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address,
PLATFORM_EMAC_BASEADDR_0))
{
xil_printf("Error adding N/W interfacern");
return;
}
// netif_set_default(netif);
netif_set_up(netif);
ipaddr2 = (ip_addr_t
) IPADDR4_INIT(ip2nd);
netif2->ip_addr = ipaddr2;
local_multicast2 = (ip_addr_t
) IPADDR4_INIT(multicast_ip2);
if (!xemac_add(netif2, &ipaddr2, &netmask, &gw, mac_ethernet_address2,
PLATFORM_EMAC_BASEADDR_1))
{
xil_printf("Error adding N/W interfacern");
return;
}
// netif_set_default(netif2);
netif_set_up(netif2);
err = igmp_joingroup(&ipaddr, &local_multicast);
err = igmp_joingroup(&ipaddr2, &local_multicast2);
pcb = udp_new();
err = udp_bind(pcb, IP_ANY_TYPE, IGMP_MULTICAST_PORT);
udp_recv(pcb, udp_multicast_recv, NULL);