driver: eth_stm32_hal: disable hardware multicast filtering
Until Zephyr has infrastructure to enable/disable the reception of multicast frames we disable the hardware multicast frame filter completly and pass all multicast frames to the upper layer and let that deal with them. Signed-off-by: Erwin Rol <erwin@erwinrol.com>
This commit is contained in:
parent
3eb373eddb
commit
ad8f83733c
1 changed files with 26 additions and 0 deletions
|
@ -27,6 +27,30 @@ static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __aligned(4);
|
||||||
static u8_t dma_rx_buffer[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __aligned(4);
|
static u8_t dma_rx_buffer[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __aligned(4);
|
||||||
static u8_t dma_tx_buffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __aligned(4);
|
static u8_t dma_tx_buffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __aligned(4);
|
||||||
|
|
||||||
|
static inline void disable_mcast_filter(ETH_HandleTypeDef *heth)
|
||||||
|
{
|
||||||
|
__ASSERT_NO_MSG(heth != NULL);
|
||||||
|
|
||||||
|
u32_t tmp = heth->Instance->MACFFR;
|
||||||
|
|
||||||
|
/* disable multicast filtering */
|
||||||
|
tmp &= ~(ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE |
|
||||||
|
ETH_MULTICASTFRAMESFILTER_HASHTABLE |
|
||||||
|
ETH_MULTICASTFRAMESFILTER_PERFECT);
|
||||||
|
|
||||||
|
/* enable receiving all multicast frames */
|
||||||
|
tmp |= ETH_MULTICASTFRAMESFILTER_NONE;
|
||||||
|
|
||||||
|
heth->Instance->MACFFR = tmp;
|
||||||
|
|
||||||
|
/* Wait until the write operation will be taken into account:
|
||||||
|
* at least four TX_CLK/RX_CLK clock cycles
|
||||||
|
*/
|
||||||
|
tmp = heth->Instance->MACFFR;
|
||||||
|
k_sleep(1);
|
||||||
|
heth->Instance->MACFFR = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
static int eth_tx(struct net_if *iface, struct net_pkt *pkt)
|
static int eth_tx(struct net_if *iface, struct net_pkt *pkt)
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -327,6 +351,8 @@ static void eth0_iface_init(struct net_if *iface)
|
||||||
|
|
||||||
HAL_ETH_Start(heth);
|
HAL_ETH_Start(heth);
|
||||||
|
|
||||||
|
disable_mcast_filter(heth);
|
||||||
|
|
||||||
/* Register Ethernet MAC Address with the upper layer */
|
/* Register Ethernet MAC Address with the upper layer */
|
||||||
net_if_set_link_addr(iface, dev_data->mac_addr,
|
net_if_set_link_addr(iface, dev_data->mac_addr,
|
||||||
sizeof(dev_data->mac_addr),
|
sizeof(dev_data->mac_addr),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue