iPXE
Functions
igbvf_vf.c File Reference
#include "igbvf_vf.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_ONLY)
 
static s32 igbvf_init_mac_params_vf (struct e1000_hw *hw)
 igbvf_init_mac_params_vf - Inits MAC params @hw: pointer to the HW structure More...
 
static s32 igbvf_check_for_link_vf (struct e1000_hw *hw)
 igbvf_check_for_link_vf - Check for link for a virtual interface @hw: pointer to the HW structure More...
 
static s32 igbvf_get_link_up_info_vf (struct e1000_hw *hw, u16 *speed, u16 *duplex)
 igbvf_get_link_up_info_vf - Gets link info. More...
 
static s32 igbvf_init_hw_vf (struct e1000_hw *hw)
 igbvf_init_hw_vf - Inits the HW @hw: pointer to the HW structure More...
 
static s32 igbvf_reset_hw_vf (struct e1000_hw *hw)
 igbvf_reset_hw_vf - Resets the HW @hw: pointer to the HW structure More...
 
static void igbvf_update_mc_addr_list_vf (struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count)
 igbvf_update_mc_addr_list_vf - Update Multicast addresses @hw: pointer to the HW structure @mc_addr_list: array of multicast addresses to program @mc_addr_count: number of multicast addresses to program More...
 
static void igbvf_rar_set_vf (struct e1000_hw *, u8 *, u32)
 
static s32 igbvf_read_mac_addr_vf (struct e1000_hw *hw)
 igbvf_read_mac_addr_vf - Read device MAC address @hw: pointer to the HW structure More...
 
void igbvf_init_function_pointers_vf (struct e1000_hw *hw)
 igbvf_init_function_pointers_vf - Inits function pointers @hw: pointer to the HW structure More...
 
static void igbvf_rar_set_vf (struct e1000_hw *hw, u8 *addr, u32 index __unused)
 igbvf_rar_set_vf - set device MAC address @hw: pointer to the HW structure @addr: pointer to the receive address @index receive address array register More...
 
static u32 igbvf_hash_mc_addr_vf (struct e1000_hw *hw, u8 *mc_addr)
 igbvf_hash_mc_addr_vf - Generate a multicast hash value @hw: pointer to the HW structure @mc_addr: pointer to a multicast address More...
 
void igbvf_vfta_set_vf (struct e1000_hw *hw, u16 vid, bool set)
 igbvf_vfta_set_vf - Set/Unset vlan filter table address @hw: pointer to the HW structure @vid: determines the vfta register and bit to set/unset @set: if true then set bit, else clear bit More...
 
void igbvf_rlpml_set_vf (struct e1000_hw *hw, u16 max_size)
 igbvf_rlpml_set_vf - Set the maximum receive packet length @hw: pointer to the HW structure @max_size: value to assign to max frame size More...
 
s32 igbvf_promisc_set_vf (struct e1000_hw *hw, enum e1000_promisc_type type)
 igbvf_promisc_set_vf - Set flags for Unicast or Multicast promisc @hw: pointer to the HW structure @uni: boolean indicating unicast promisc status @multi: boolean indicating multicast promisc status More...
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY  )

◆ igbvf_init_mac_params_vf()

static s32 igbvf_init_mac_params_vf ( struct e1000_hw hw)
static

igbvf_init_mac_params_vf - Inits MAC params @hw: pointer to the HW structure

Definition at line 48 of file igbvf_vf.c.

49 {
50  struct e1000_mac_info *mac = &hw->mac;
51 
52  DEBUGFUNC("igbvf_init_mac_params_vf");
53 
54  /* VF's have no MTA Registers - PF feature only */
55  mac->mta_reg_count = 128;
56  /* VF's have no access to RAR entries */
57  mac->rar_entry_count = 1;
58 
59  /* Function pointers */
60  /* reset */
61  mac->ops.reset_hw = igbvf_reset_hw_vf;
62  /* hw initialization */
63  mac->ops.init_hw = igbvf_init_hw_vf;
64  /* check for link */
65  mac->ops.check_for_link = igbvf_check_for_link_vf;
66  /* link info */
67  mac->ops.get_link_up_info = igbvf_get_link_up_info_vf;
68  /* multicast address update */
69  mac->ops.update_mc_addr_list = igbvf_update_mc_addr_list_vf;
70  /* set mac address */
71  mac->ops.rar_set = igbvf_rar_set_vf;
72  /* read mac address */
73  mac->ops.read_mac_addr = igbvf_read_mac_addr_vf;
74 
75 
76  return E1000_SUCCESS;
77 }
static s32 igbvf_init_hw_vf(struct e1000_hw *hw)
igbvf_init_hw_vf - Inits the HW @hw: pointer to the HW structure
Definition: igbvf_vf.c:186
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
Definition: hw.c:16
static void igbvf_rar_set_vf(struct e1000_hw *, u8 *, u32)
static void igbvf_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32)
igbvf_update_mc_addr_list_vf - Update Multicast addresses @hw: pointer to the HW structure @mc_addr_l...
Definition: igbvf_vf.c:266
static s32 igbvf_check_for_link_vf(struct e1000_hw *hw)
igbvf_check_for_link_vf - Check for link for a virtual interface @hw: pointer to the HW structure
Definition: igbvf_vf.c:402
static s32 igbvf_read_mac_addr_vf(struct e1000_hw *)
igbvf_read_mac_addr_vf - Read device MAC address @hw: pointer to the HW structure
Definition: igbvf_vf.c:384
#define E1000_SUCCESS
static s32 igbvf_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, u16 *duplex)
igbvf_get_link_up_info_vf - Gets link info.
Definition: igbvf_vf.c:100
static s32 igbvf_reset_hw_vf(struct e1000_hw *hw)
igbvf_reset_hw_vf - Resets the HW @hw: pointer to the HW structure
Definition: igbvf_vf.c:137
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References DEBUGFUNC, E1000_SUCCESS, igbvf_check_for_link_vf(), igbvf_get_link_up_info_vf(), igbvf_init_hw_vf(), igbvf_rar_set_vf(), igbvf_read_mac_addr_vf(), igbvf_reset_hw_vf(), igbvf_update_mc_addr_list_vf(), and mac.

Referenced by igbvf_init_function_pointers_vf().

◆ igbvf_check_for_link_vf()

static s32 igbvf_check_for_link_vf ( struct e1000_hw hw)
static

igbvf_check_for_link_vf - Check for link for a virtual interface @hw: pointer to the HW structure

Checks to see if the underlying PF is still talking to the VF and if it is then it reports the link state to the hardware, otherwise it reports link down and returns an error.

Definition at line 402 of file igbvf_vf.c.

403 {
404  struct e1000_mbx_info *mbx = &hw->mbx;
405  struct e1000_mac_info *mac = &hw->mac;
406  s32 ret_val = E1000_SUCCESS;
407  u32 in_msg = 0;
408 
409  DEBUGFUNC("igbvf_check_for_link_vf");
410 
411  /*
412  * We only want to run this if there has been a rst asserted.
413  * in this case that could mean a link change, device reset,
414  * or a virtual function reset
415  */
416 
417  /* If we were hit with a reset drop the link */
418  if (!mbx->ops.check_for_rst(hw, 0))
419  mac->get_link_status = true;
420 
421  if (!mac->get_link_status)
422  goto out;
423 
424  /* if link status is down no point in checking to see if pf is up */
426  goto out;
427 
428  /* if the read failed it could just be a mailbox collision, best wait
429  * until we are called again and don't report an error */
430  if (mbx->ops.read(hw, &in_msg, 1, 0))
431  goto out;
432 
433  /* if incoming message isn't clear to send we are waiting on response */
434  if (!(in_msg & E1000_VT_MSGTYPE_CTS)) {
435  /* message is not CTS and is NACK we have lost CTS status */
436  if (in_msg & E1000_VT_MSGTYPE_NACK)
437  ret_val = -E1000_ERR_MAC_INIT;
438  goto out;
439  }
440 
441  /* at this point we know the PF is talking to us, check and see if
442  * we are still accepting timeout or if we had a timeout failure.
443  * if we failed then we will need to reinit */
444  if (!mbx->timeout) {
445  ret_val = -E1000_ERR_MAC_INIT;
446  goto out;
447  }
448 
449  /* if we passed all the tests above then the link is up and we no
450  * longer need to check for link */
451  mac->get_link_status = false;
452 
453 out:
454  return ret_val;
455 }
#define E1000_VT_MSGTYPE_CTS
Definition: igbvf_mbx.h:61
int32_t s32
Definition: stdint.h:22
#define E1000_VT_MSGTYPE_NACK
Definition: igbvf_mbx.h:59
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
Definition: hw.c:16
#define E1000_STATUS
Definition: igbvf_regs.h:36
s32(* read)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:279
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
__be32 out[4]
Definition: CIB_PRM.h:36
#define E1000_STATUS_LU
#define E1000_SUCCESS
s32(* check_for_rst)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:285
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
uint32_t u32
Definition: stdint.h:23
#define E1000_ERR_MAC_INIT
if(natsemi->flags &NATSEMI_64BIT) return 1
#define E1000_READ_REG(a, reg)
Definition: igbvf_osdep.h:79

References e1000_mbx_operations::check_for_rst, DEBUGFUNC, E1000_ERR_MAC_INIT, E1000_READ_REG, E1000_STATUS, E1000_STATUS_LU, E1000_SUCCESS, E1000_VT_MSGTYPE_CTS, E1000_VT_MSGTYPE_NACK, if(), mac, e1000_mbx_info::ops, out, e1000_mbx_operations::read, and e1000_mbx_info::timeout.

Referenced by igbvf_init_mac_params_vf().

◆ igbvf_get_link_up_info_vf()

static s32 igbvf_get_link_up_info_vf ( struct e1000_hw hw,
u16 speed,
u16 duplex 
)
static

igbvf_get_link_up_info_vf - Gets link info.

@hw: pointer to the HW structure @speed: pointer to 16 bit value to store link speed. @duplex: pointer to 16 bit value to store duplex.

Since we cannot read the PHY and get accurate link info, we must rely upon the status register's data which is often stale and inaccurate.

Definition at line 100 of file igbvf_vf.c.

102 {
103  s32 status;
104 
105  DEBUGFUNC("igbvf_get_link_up_info_vf");
106 
109  *speed = SPEED_1000;
110  DEBUGOUT("1000 Mbs, ");
111  } else if (status & E1000_STATUS_SPEED_100) {
112  *speed = SPEED_100;
113  DEBUGOUT("100 Mbs, ");
114  } else {
115  *speed = SPEED_10;
116  DEBUGOUT("10 Mbs, ");
117  }
118 
119  if (status & E1000_STATUS_FD) {
120  *duplex = FULL_DUPLEX;
121  DEBUGOUT("Full Duplex\n");
122  } else {
123  *duplex = HALF_DUPLEX;
124  DEBUGOUT("Half Duplex\n");
125  }
126 
127  return E1000_SUCCESS;
128 }
#define SPEED_1000
Definition: atl1e.h:52
#define DEBUGOUT(S)
Definition: igbvf_osdep.h:68
#define E1000_STATUS_SPEED_100
int32_t s32
Definition: stdint.h:22
#define SPEED_10
Definition: atl1e.h:50
Definition: hw.c:16
#define E1000_STATUS
Definition: igbvf_regs.h:36
uint8_t status
Status.
Definition: ena.h:16
#define SPEED_100
Definition: atl1e.h:51
#define E1000_STATUS_SPEED_1000
#define E1000_SUCCESS
duplex
Definition: nic.h:40
#define E1000_STATUS_FD
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
#define E1000_READ_REG(a, reg)
Definition: igbvf_osdep.h:79

References DEBUGFUNC, DEBUGOUT, E1000_READ_REG, E1000_STATUS, E1000_STATUS_FD, E1000_STATUS_SPEED_100, E1000_STATUS_SPEED_1000, E1000_SUCCESS, FULL_DUPLEX, HALF_DUPLEX, SPEED_10, SPEED_100, SPEED_1000, and status.

Referenced by igbvf_init_mac_params_vf().

◆ igbvf_init_hw_vf()

static s32 igbvf_init_hw_vf ( struct e1000_hw hw)
static

igbvf_init_hw_vf - Inits the HW @hw: pointer to the HW structure

Not much to do here except clear the PF Reset indication if there is one.

Definition at line 186 of file igbvf_vf.c.

187 {
188  DEBUGFUNC("igbvf_init_hw_vf");
189 
190  /* attempt to set and restore our mac address */
191  igbvf_rar_set_vf(hw, hw->mac.addr, 0);
192 
193  return E1000_SUCCESS;
194 }
Definition: hw.c:16
static void igbvf_rar_set_vf(struct e1000_hw *, u8 *, u32)
#define E1000_SUCCESS
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References DEBUGFUNC, E1000_SUCCESS, and igbvf_rar_set_vf().

Referenced by igbvf_init_mac_params_vf().

◆ igbvf_reset_hw_vf()

static s32 igbvf_reset_hw_vf ( struct e1000_hw hw)
static

igbvf_reset_hw_vf - Resets the HW @hw: pointer to the HW structure

VF's provide a function level reset. This is done using bit 26 of ctrl_reg. This is all the reset we can perform on a VF.

Definition at line 137 of file igbvf_vf.c.

138 {
139  struct e1000_mbx_info *mbx = &hw->mbx;
141  s32 ret_val = -E1000_ERR_MAC_INIT;
142  u32 ctrl, msgbuf[3];
143  u8 *addr = (u8 *)(&msgbuf[1]);
144 
145  DEBUGFUNC("igbvf_reset_hw_vf");
146 
147  DEBUGOUT("Issuing a function level reset to MAC\n");
150 
151  /* we cannot reset while the RSTI / RSTD bits are asserted */
152  while (!mbx->ops.check_for_rst(hw, 0) && timeout) {
153  timeout--;
154  usec_delay(5);
155  }
156 
157  if (timeout) {
158  /* mailbox timeout can now become active */
160 
161  msgbuf[0] = E1000_VF_RESET;
162  mbx->ops.write_posted(hw, msgbuf, 1, 0);
163 
164  msec_delay(10);
165 
166  /* set our "perm_addr" based on info provided by PF */
167  ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
168  if (!ret_val) {
169  if (msgbuf[0] == (E1000_VF_RESET |
171  memcpy(hw->mac.perm_addr, addr, 6);
172  else
173  ret_val = -E1000_ERR_MAC_INIT;
174  }
175  }
176 
177  return ret_val;
178 }
#define DEBUGOUT(S)
Definition: igbvf_osdep.h:68
s32(* read_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:281
#define E1000_VF_MBX_INIT_TIMEOUT
Definition: igbvf_mbx.h:81
#define E1000_CTRL
Definition: igbvf_regs.h:34
int32_t s32
Definition: stdint.h:22
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_VT_MSGTYPE_ACK
Definition: igbvf_mbx.h:57
#define usec_delay(x)
Definition: igbvf_osdep.h:59
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define E1000_VF_RESET
Definition: igbvf_mbx.h:67
#define E1000_WRITE_REG(a, reg, value)
Definition: igbvf_osdep.h:76
#define E1000_CTRL_RST
u32 addr
Definition: sky2.h:8
#define msec_delay(x)
Definition: igbvf_osdep.h:60
s32(* check_for_rst)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:285
#define E1000_VF_INIT_TIMEOUT
Definition: igbvf_vf.h:59
static unsigned int ctrl
Definition: intel.h:270
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
void timeout(int)
uint8_t u8
Definition: stdint.h:19
uint32_t u32
Definition: stdint.h:23
#define E1000_ERR_MAC_INIT
#define E1000_READ_REG(a, reg)
Definition: igbvf_osdep.h:79

References addr, e1000_mbx_operations::check_for_rst, ctrl, DEBUGFUNC, DEBUGOUT, E1000_CTRL, E1000_CTRL_RST, E1000_ERR_MAC_INIT, E1000_READ_REG, E1000_VF_INIT_TIMEOUT, E1000_VF_MBX_INIT_TIMEOUT, E1000_VF_RESET, E1000_VT_MSGTYPE_ACK, E1000_WRITE_REG, memcpy(), msec_delay, e1000_mbx_info::ops, e1000_mbx_operations::read_posted, e1000_mbx_info::timeout, timeout(), usec_delay, and e1000_mbx_operations::write_posted.

Referenced by igbvf_init_mac_params_vf().

◆ igbvf_update_mc_addr_list_vf()

void igbvf_update_mc_addr_list_vf ( struct e1000_hw hw,
u8 mc_addr_list,
u32  mc_addr_count 
)
static

igbvf_update_mc_addr_list_vf - Update Multicast addresses @hw: pointer to the HW structure @mc_addr_list: array of multicast addresses to program @mc_addr_count: number of multicast addresses to program

Updates the Multicast Table Array. The caller must have a packed mc_addr_list of multicast addresses.

Definition at line 266 of file igbvf_vf.c.

268 {
269  struct e1000_mbx_info *mbx = &hw->mbx;
270  u32 msgbuf[E1000_VFMAILBOX_SIZE];
271  u16 *hash_list = (u16 *)&msgbuf[1];
272  u32 hash_value;
273  u32 i;
274 
275  DEBUGFUNC("igbvf_update_mc_addr_list_vf");
276 
277  /* Each entry in the list uses 1 16 bit word. We have 30
278  * 16 bit words available in our HW msg buffer (minus 1 for the
279  * msg type). That's 30 hash values if we pack 'em right. If
280  * there are more than 30 MC addresses to add then punt the
281  * extras for now and then add code to handle more than 30 later.
282  * It would be unusual for a server to request that many multi-cast
283  * addresses except for in large enterprise network environments.
284  */
285 
286  DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count);
287 
288  msgbuf[0] = E1000_VF_SET_MULTICAST;
289 
290  if (mc_addr_count > 30) {
291  msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW;
292  mc_addr_count = 30;
293  }
294 
295  msgbuf[0] |= mc_addr_count << E1000_VT_MSGINFO_SHIFT;
296 
297  for (i = 0; i < mc_addr_count; i++) {
298  hash_value = igbvf_hash_mc_addr_vf(hw, mc_addr_list);
299  DEBUGOUT1("Hash value = 0x%03X\n", hash_value);
300  hash_list[i] = hash_value & 0x0FFF;
301  mc_addr_list += ETH_ADDR_LEN;
302  }
303 
304  mbx->ops.write_posted(hw, msgbuf, E1000_VFMAILBOX_SIZE, 0);
305 }
uint16_t u16
Definition: stdint.h:21
#define DEBUGOUT1(S, A...)
Definition: igbvf_osdep.h:69
#define E1000_VF_SET_MULTICAST_OVERFLOW
Definition: igbvf_mbx.h:71
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_VFMAILBOX_SIZE
Definition: igbvf_mbx.h:51
#define E1000_VF_SET_MULTICAST
Definition: igbvf_mbx.h:69
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
static u32 igbvf_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
igbvf_hash_mc_addr_vf - Generate a multicast hash value @hw: pointer to the HW structure @mc_addr: po...
Definition: igbvf_vf.c:234
#define ETH_ADDR_LEN
uint32_t u32
Definition: stdint.h:23
#define E1000_VT_MSGINFO_SHIFT
Definition: igbvf_mbx.h:63

References DEBUGFUNC, DEBUGOUT1, E1000_VF_SET_MULTICAST, E1000_VF_SET_MULTICAST_OVERFLOW, E1000_VFMAILBOX_SIZE, E1000_VT_MSGINFO_SHIFT, ETH_ADDR_LEN, igbvf_hash_mc_addr_vf(), e1000_mbx_info::ops, and e1000_mbx_operations::write_posted.

Referenced by igbvf_init_mac_params_vf().

◆ igbvf_rar_set_vf() [1/2]

static void igbvf_rar_set_vf ( struct e1000_hw ,
u8 ,
u32   
)
static

◆ igbvf_read_mac_addr_vf()

static s32 igbvf_read_mac_addr_vf ( struct e1000_hw hw)
static

igbvf_read_mac_addr_vf - Read device MAC address @hw: pointer to the HW structure

Definition at line 384 of file igbvf_vf.c.

385 {
386  int i;
387 
388  for (i = 0; i < ETH_ADDR_LEN; i++)
389  hw->mac.addr[i] = hw->mac.perm_addr[i];
390 
391  return E1000_SUCCESS;
392 }
Definition: hw.c:16
#define E1000_SUCCESS
#define ETH_ADDR_LEN

References E1000_SUCCESS, and ETH_ADDR_LEN.

Referenced by igbvf_init_mac_params_vf(), and igbvf_rar_set_vf().

◆ igbvf_init_function_pointers_vf()

void igbvf_init_function_pointers_vf ( struct e1000_hw hw)

igbvf_init_function_pointers_vf - Inits function pointers @hw: pointer to the HW structure

Definition at line 83 of file igbvf_vf.c.

84 {
85  DEBUGFUNC("igbvf_init_function_pointers_vf");
86 
87  hw->mac.ops.init_params = igbvf_init_mac_params_vf;
88  hw->mbx.ops.init_params = igbvf_init_mbx_params_vf;
89 }
Definition: hw.c:16
static s32 igbvf_init_mac_params_vf(struct e1000_hw *hw)
igbvf_init_mac_params_vf - Inits MAC params @hw: pointer to the HW structure
Definition: igbvf_vf.c:48
s32 igbvf_init_mbx_params_vf(struct e1000_hw *hw)
igbvf_init_mbx_params_vf - set initial values for vf mailbox @hw: pointer to the HW structure
Definition: igbvf_mbx.c:377
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References DEBUGFUNC, igbvf_init_mac_params_vf(), and igbvf_init_mbx_params_vf().

Referenced by igbvf_sw_init().

◆ igbvf_rar_set_vf() [2/2]

static void igbvf_rar_set_vf ( struct e1000_hw hw,
u8 addr,
u32 index  __unused 
)
static

igbvf_rar_set_vf - set device MAC address @hw: pointer to the HW structure @addr: pointer to the receive address @index receive address array register

Definition at line 202 of file igbvf_vf.c.

203 {
204  struct e1000_mbx_info *mbx = &hw->mbx;
205  u32 msgbuf[3];
206  u8 *msg_addr = (u8 *)(&msgbuf[1]);
207  s32 ret_val;
208 
209  memset(msgbuf, 0, 12);
210  msgbuf[0] = E1000_VF_SET_MAC_ADDR;
211  memcpy(msg_addr, addr, 6);
212  ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
213 
214  if (!ret_val)
215  ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
216 
217  msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
218 
219  /* if nacked the address was rejected, use "perm_addr" */
220  if (!ret_val &&
221  (msgbuf[0] == (E1000_VF_SET_MAC_ADDR | E1000_VT_MSGTYPE_NACK)))
223 }
s32(* read_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:281
#define E1000_VT_MSGTYPE_CTS
Definition: igbvf_mbx.h:61
int32_t s32
Definition: stdint.h:22
#define E1000_VT_MSGTYPE_NACK
Definition: igbvf_mbx.h:59
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static s32 igbvf_read_mac_addr_vf(struct e1000_hw *)
igbvf_read_mac_addr_vf - Read device MAC address @hw: pointer to the HW structure
Definition: igbvf_vf.c:384
u32 addr
Definition: sky2.h:8
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
uint8_t u8
Definition: stdint.h:19
uint32_t u32
Definition: stdint.h:23
#define E1000_VF_SET_MAC_ADDR
Definition: igbvf_mbx.h:68
void * memset(void *dest, int character, size_t len) __nonnull

References addr, E1000_VF_SET_MAC_ADDR, E1000_VT_MSGTYPE_CTS, E1000_VT_MSGTYPE_NACK, igbvf_read_mac_addr_vf(), memcpy(), memset(), e1000_mbx_info::ops, e1000_mbx_operations::read_posted, and e1000_mbx_operations::write_posted.

◆ igbvf_hash_mc_addr_vf()

static u32 igbvf_hash_mc_addr_vf ( struct e1000_hw hw,
u8 mc_addr 
)
static

igbvf_hash_mc_addr_vf - Generate a multicast hash value @hw: pointer to the HW structure @mc_addr: pointer to a multicast address

Generates a multicast address hash value which is used to determine the multicast filter table array address and new table value. See igbvf_mta_set_generic()

Definition at line 234 of file igbvf_vf.c.

235 {
236  u32 hash_value, hash_mask;
237  u8 bit_shift = 0;
238 
239  DEBUGFUNC("igbvf_hash_mc_addr_generic");
240 
241  /* Register count multiplied by bits per register */
242  hash_mask = (hw->mac.mta_reg_count * 32) - 1;
243 
244  /*
245  * The bit_shift is the number of left-shifts
246  * where 0xFF would still fall within the hash mask.
247  */
248  while (hash_mask >> bit_shift != 0xFF)
249  bit_shift++;
250 
251  hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
252  (((u16) mc_addr[5]) << bit_shift)));
253 
254  return hash_value;
255 }
#define u16
Definition: vga.h:20
Definition: hw.c:16
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
uint8_t u8
Definition: stdint.h:19
uint32_t u32
Definition: stdint.h:23

References DEBUGFUNC, and u16.

Referenced by igbvf_update_mc_addr_list_vf().

◆ igbvf_vfta_set_vf()

void igbvf_vfta_set_vf ( struct e1000_hw hw,
u16  vid,
bool  set 
)

igbvf_vfta_set_vf - Set/Unset vlan filter table address @hw: pointer to the HW structure @vid: determines the vfta register and bit to set/unset @set: if true then set bit, else clear bit

Definition at line 313 of file igbvf_vf.c.

314 {
315  struct e1000_mbx_info *mbx = &hw->mbx;
316  u32 msgbuf[2];
317 
318  msgbuf[0] = E1000_VF_SET_VLAN;
319  msgbuf[1] = vid;
320  /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
321  if (set)
322  msgbuf[0] |= E1000_VF_SET_VLAN_ADD;
323 
324  mbx->ops.write_posted(hw, msgbuf, 2, 0);
325 }
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_VF_SET_VLAN
Definition: igbvf_mbx.h:72
static fd_set * set
Definition: posix_io.h:48
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
uint32_t u32
Definition: stdint.h:23
#define E1000_VF_SET_VLAN_ADD
Definition: igbvf_mbx.h:73

References E1000_VF_SET_VLAN, E1000_VF_SET_VLAN_ADD, e1000_mbx_info::ops, set, and e1000_mbx_operations::write_posted.

◆ igbvf_rlpml_set_vf()

void igbvf_rlpml_set_vf ( struct e1000_hw hw,
u16  max_size 
)

igbvf_rlpml_set_vf - Set the maximum receive packet length @hw: pointer to the HW structure @max_size: value to assign to max frame size

Definition at line 331 of file igbvf_vf.c.

332 {
333  struct e1000_mbx_info *mbx = &hw->mbx;
334  u32 msgbuf[2];
335 
336  msgbuf[0] = E1000_VF_SET_LPE;
337  msgbuf[1] = max_size;
338 
339  mbx->ops.write_posted(hw, msgbuf, 2, 0);
340 }
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_VF_SET_LPE
Definition: igbvf_mbx.h:74
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
uint32_t u32
Definition: stdint.h:23

References E1000_VF_SET_LPE, e1000_mbx_info::ops, and e1000_mbx_operations::write_posted.

Referenced by igbvf_configure_rx().

◆ igbvf_promisc_set_vf()

s32 igbvf_promisc_set_vf ( struct e1000_hw hw,
enum e1000_promisc_type  type 
)

igbvf_promisc_set_vf - Set flags for Unicast or Multicast promisc @hw: pointer to the HW structure @uni: boolean indicating unicast promisc status @multi: boolean indicating multicast promisc status

Definition at line 348 of file igbvf_vf.c.

349 {
350  struct e1000_mbx_info *mbx = &hw->mbx;
351  u32 msgbuf = E1000_VF_SET_PROMISC;
352  s32 ret_val;
353 
354  switch (type) {
357  break;
360  /* Fall through */
364  break;
365  default:
366  return -E1000_ERR_MAC_INIT;
367  }
368 
369  ret_val = mbx->ops.write_posted(hw, &msgbuf, 1, 0);
370 
371  if (!ret_val)
372  ret_val = mbx->ops.read_posted(hw, &msgbuf, 1, 0);
373 
374  if (!ret_val && !(msgbuf & E1000_VT_MSGTYPE_ACK))
375  ret_val = -E1000_ERR_MAC_INIT;
376 
377  return ret_val;
378 }
#define E1000_VF_SET_PROMISC
Definition: igbvf_mbx.h:75
s32(* read_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:281
int32_t s32
Definition: stdint.h:22
uint8_t type
Type.
Definition: ena.h:16
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_VT_MSGTYPE_ACK
Definition: igbvf_mbx.h:57
#define E1000_VF_SET_PROMISC_UNICAST
Definition: igbvf_mbx.h:76
#define E1000_VF_SET_PROMISC_MULTICAST
Definition: igbvf_mbx.h:77
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
uint32_t u32
Definition: stdint.h:23
#define E1000_ERR_MAC_INIT

References E1000_ERR_MAC_INIT, e1000_promisc_disabled, e1000_promisc_enabled, e1000_promisc_multicast, e1000_promisc_unicast, E1000_VF_SET_PROMISC, E1000_VF_SET_PROMISC_MULTICAST, E1000_VF_SET_PROMISC_UNICAST, E1000_VT_MSGTYPE_ACK, e1000_mbx_info::ops, e1000_mbx_operations::read_posted, type, and e1000_mbx_operations::write_posted.