MCPcopy Create free account
hub / github.com/F-Stack/f-stack / txgbe_validate_mac_addr

Function txgbe_validate_mac_addr

dpdk/drivers/net/txgbe/base/txgbe_hw.c:566–582  ·  view source on GitHub ↗

* txgbe_validate_mac_addr - Validate MAC address * @mac_addr: pointer to MAC address. * * Tests a MAC address to ensure it is a valid Individual Address. **/

Source from the content-addressed store, hash-verified

564 * Tests a MAC address to ensure it is a valid Individual Address.
565 **/
566s32 txgbe_validate_mac_addr(u8 *mac_addr)
567{
568 s32 status = 0;
569
570 /* Make sure it is not a multicast address */
571 if (TXGBE_IS_MULTICAST(mac_addr)) {
572 status = TXGBE_ERR_INVALID_MAC_ADDR;
573 /* Not a broadcast address */
574 } else if (TXGBE_IS_BROADCAST(mac_addr)) {
575 status = TXGBE_ERR_INVALID_MAC_ADDR;
576 /* Reject the zero address */
577 } else if (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 &&
578 mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0) {
579 status = TXGBE_ERR_INVALID_MAC_ADDR;
580 }
581 return status;
582}
583
584/**
585 * txgbe_set_rar - Set Rx address register

Callers 2

txgbe_init_rx_addrsFunction · 0.85
txgbe_reset_hwFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected