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

Function txgbe_set_rar

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

* txgbe_set_rar - Set Rx address register * @hw: pointer to hardware structure * @index: Receive address register to write * @addr: Address to put into receive address register * @vmdq: VMDq "set" or "pool" index * @enable_addr: set flag that address is active * * Puts an ethernet address into a receive address register. **/

Source from the content-addressed store, hash-verified

592 * Puts an ethernet address into a receive address register.
593 **/
594s32 txgbe_set_rar(struct txgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
595 u32 enable_addr)
596{
597 u32 rar_low, rar_high;
598 u32 rar_entries = hw->mac.num_rar_entries;
599
600 /* Make sure we are using a valid rar index range */
601 if (index >= rar_entries) {
602 DEBUGOUT("RAR index %d is out of range.", index);
603 return TXGBE_ERR_INVALID_ARGUMENT;
604 }
605
606 /* setup VMDq pool selection before this RAR gets enabled */
607 hw->mac.set_vmdq(hw, index, vmdq);
608
609 /*
610 * HW expects these in little endian so we reverse the byte
611 * order from network order (big endian) to little endian
612 */
613 rar_low = TXGBE_ETHADDRL_AD0(addr[5]) |
614 TXGBE_ETHADDRL_AD1(addr[4]) |
615 TXGBE_ETHADDRL_AD2(addr[3]) |
616 TXGBE_ETHADDRL_AD3(addr[2]);
617 /*
618 * Some parts put the VMDq setting in the extra RAH bits,
619 * so save everything except the lower 16 bits that hold part
620 * of the address and the address valid bit.
621 */
622 rar_high = rd32(hw, TXGBE_ETHADDRH);
623 rar_high &= ~TXGBE_ETHADDRH_AD_MASK;
624 rar_high |= (TXGBE_ETHADDRH_AD4(addr[1]) |
625 TXGBE_ETHADDRH_AD5(addr[0]));
626
627 rar_high &= ~TXGBE_ETHADDRH_VLD;
628 if (enable_addr != 0)
629 rar_high |= TXGBE_ETHADDRH_VLD;
630
631 wr32(hw, TXGBE_ETHADDRIDX, index);
632 wr32(hw, TXGBE_ETHADDRL, rar_low);
633 wr32(hw, TXGBE_ETHADDRH, rar_high);
634
635 return 0;
636}
637
638/**
639 * txgbe_clear_rar - Remove Rx address register

Callers 2

txgbe_dev_closeFunction · 0.85
txgbe_add_rarFunction · 0.85

Calls 2

rd32Function · 0.70
wr32Function · 0.70

Tested by

no test coverage detected