static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, u16 vf_number) { s32 ret_val; u16 i; /* */ ret_val = igb_obtain_mbx_lock_pf(hw, vf_number); if (ret_val) goto out_no_read; /* */ for (i = 0; i < size; i++) msg[i] = array_rd32(E1000_VMBMEM(vf_number), i); /* */ wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK); /* */ hw->mbx.stats.msgs_rx++; out_no_read: return ret_val; }
/** * igb_read_mbx_pf - Read a message from the mailbox * @hw: pointer to the HW structure * @msg: The message buffer * @size: Length of buffer * @vf_number: the VF index * * This function copies a message from the mailbox buffer to the caller's * memory buffer. The presumption is that the caller knows that there was * a message due to a VF request so no polling for message is needed. **/ static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, u16 vf_number) { s32 ret_val; u16 i; /* lock the mailbox to prevent pf/vf race condition */ ret_val = igb_obtain_mbx_lock_pf(hw, vf_number); if (ret_val) goto out_no_read; /* copy the message to the mailbox memory buffer */ for (i = 0; i < size; i++) msg[i] = array_rd32(E1000_VMBMEM(vf_number), i); /* Acknowledge the message and release buffer */ wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK); /* update stats */ hw->mbx.stats.msgs_rx++; out_no_read: return ret_val; }
} /** * igb_vfta_set - enable or disable vlan in VLAN filter table * @hw: pointer to the HW structure * @vid: VLAN id to add or remove * @add: if true add filter, if false remove * * Sets or clears a bit in the VLAN filter table array based on VLAN id * and if we are adding or removing the filter **/ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) { u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; u32 mask = 1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); u32 vfta = array_rd32(E1000_VFTA, index); s32 ret_val = 0; /* bit was set/cleared before we started */ if ((!!(vfta & mask)) == add) { ret_val = -E1000_ERR_CONFIG; } else { if (add) vfta |= mask; else vfta &= ~mask; } igb_write_vfta(hw, index, vfta); return ret_val;