Lines Matching refs:vf
99 ixgbe_send_vf_msg(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
101 if (vf->flags & IXGBE_VF_CTS)
104 adapter->hw.mbx.ops.write(&adapter->hw, &msg, 1, vf->pool);
108 ixgbe_send_vf_ack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
111 ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_ACK);
115 ixgbe_send_vf_nack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
118 ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_NACK);
122 ixgbe_process_vf_ack(struct adapter *adapter, struct ixgbe_vf *vf)
124 if (!(vf->flags & IXGBE_VF_CTS))
125 ixgbe_send_vf_nack(adapter, vf, 0);
129 ixgbe_vf_mac_changed(struct ixgbe_vf *vf, const uint8_t *mac)
131 return (bcmp(mac, vf->ether_addr, ETHER_ADDR_LEN) != 0);
209 struct ixgbe_vf *vf;
212 vf = &adapter->vfs[i];
213 if (vf->flags & IXGBE_VF_ACTIVE)
214 ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG);
220 ixgbe_vf_set_default_vlan(struct adapter *adapter, struct ixgbe_vf *vf,
228 vf->vlan_tag = tag;
230 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf->pool));
254 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf->pool), vmolr);
255 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf->pool), vmvir);
260 ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
271 switch (vf->api_ver) {
279 vf->maximum_frame_size > ETHER_MAX_LEN)
291 if (vf->maximum_frame_size <= ETHER_MAX_LEN)
307 ixgbe_process_vf_reset(struct adapter *adapter, struct ixgbe_vf *vf)
309 ixgbe_vf_set_default_vlan(adapter, vf, vf->default_vlan);
313 ixgbe_clear_rar(&adapter->hw, vf->rar_index);
315 vf->api_ver = IXGBE_API_VER_UNKNOWN;
320 ixgbe_vf_enable_transmit(struct adapter *adapter, struct ixgbe_vf *vf)
327 vf_index = IXGBE_VF_INDEX(vf->pool);
329 vfte |= IXGBE_VF_BIT(vf->pool);
335 ixgbe_vf_enable_receive(struct adapter *adapter, struct ixgbe_vf *vf)
342 vf_index = IXGBE_VF_INDEX(vf->pool);
344 if (ixgbe_vf_frame_size_compatible(adapter, vf))
345 vfre |= IXGBE_VF_BIT(vf->pool);
347 vfre &= ~IXGBE_VF_BIT(vf->pool);
353 ixgbe_vf_reset_msg(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
361 ixgbe_process_vf_reset(adapter, vf);
363 if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) {
364 ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr,
365 vf->pool, TRUE);
370 ixgbe_vf_enable_transmit(adapter, vf);
371 ixgbe_vf_enable_receive(adapter, vf);
373 vf->flags |= IXGBE_VF_CTS;
376 bcopy(vf->ether_addr, &resp[1], ETHER_ADDR_LEN);
378 hw->mbx.ops.write(hw, resp, IXGBE_VF_PERMADDR_MSG_LEN, vf->pool);
383 ixgbe_vf_set_mac(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
390 if (!(vf->flags & IXGBE_VF_CAP_MAC) && ixgbe_vf_mac_changed(vf, mac)) {
391 ixgbe_send_vf_nack(adapter, vf, msg[0]);
396 ixgbe_send_vf_nack(adapter, vf, msg[0]);
400 bcopy(mac, vf->ether_addr, ETHER_ADDR_LEN);
402 ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr, vf->pool,
405 ixgbe_send_vf_ack(adapter, vf, msg[0]);
414 ixgbe_vf_set_mc_addr(struct adapter *adapter, struct ixgbe_vf *vf, u32 *msg)
423 vmolr = IXGBE_READ_REG(&adapter->hw, IXGBE_VMOLR(vf->pool));
425 vf->num_mc_hashes = entries;
429 vf->mc_hash[i] = list[i];
430 vec_reg = (vf->mc_hash[i] >> 5) & 0x7F;
431 vec_bit = vf->mc_hash[i] & 0x1F;
438 IXGBE_WRITE_REG(&adapter->hw, IXGBE_VMOLR(vf->pool), vmolr);
439 ixgbe_send_vf_ack(adapter, vf, msg[0]);
444 ixgbe_vf_set_vlan(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
454 if (!(vf->flags & IXGBE_VF_CAP_VLAN)) {
455 ixgbe_send_vf_nack(adapter, vf, msg[0]);
461 ixgbe_send_vf_nack(adapter, vf, msg[0]);
465 ixgbe_set_vfta(hw, tag, vf->pool, enable, false);
466 ixgbe_send_vf_ack(adapter, vf, msg[0]);
471 ixgbe_vf_set_lpe(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
481 ixgbe_send_vf_ack(adapter, vf, msg[0]);
489 ixgbe_send_vf_ack(adapter, vf, msg[0]);
493 vf->maximum_frame_size = vf_max_size;
494 ixgbe_update_max_frame(adapter, vf->maximum_frame_size);
500 ixgbe_vf_enable_receive(adapter, vf);
511 ixgbe_send_vf_ack(adapter, vf, msg[0]);
516 ixgbe_vf_set_macvlan(struct adapter *adapter, struct ixgbe_vf *vf,
520 ixgbe_send_vf_nack(adapter, vf, msg[0]);
525 ixgbe_vf_api_negotiate(struct adapter *adapter, struct ixgbe_vf *vf,
532 vf->api_ver = msg[1];
533 ixgbe_send_vf_ack(adapter, vf, msg[0]);
536 vf->api_ver = IXGBE_API_VER_UNKNOWN;
537 ixgbe_send_vf_nack(adapter, vf, msg[0]);
544 ixgbe_vf_get_queues(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
556 ixgbe_send_vf_nack(adapter, vf, msg[0]);
566 resp[IXGBE_VF_TRANS_VLAN] = (vf->default_vlan != 0);
569 hw->mbx.ops.write(hw, resp, IXGBE_VF_GET_QUEUES_RESP_LEN, vf->pool);
574 ixgbe_process_vf_msg(if_ctx_t ctx, struct ixgbe_vf *vf)
586 error = hw->mbx.ops.read(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
592 msg[0], vf->pool);
594 ixgbe_vf_reset_msg(adapter, vf, msg);
598 if (!(vf->flags & IXGBE_VF_CTS)) {
599 ixgbe_send_vf_nack(adapter, vf, msg[0]);
605 ixgbe_vf_set_mac(adapter, vf, msg);
608 ixgbe_vf_set_mc_addr(adapter, vf, msg);
611 ixgbe_vf_set_vlan(adapter, vf, msg);
614 ixgbe_vf_set_lpe(adapter, vf, msg);
617 ixgbe_vf_set_macvlan(adapter, vf, msg);
620 ixgbe_vf_api_negotiate(adapter, vf, msg);
623 ixgbe_vf_get_queues(adapter, vf, msg);
626 ixgbe_send_vf_nack(adapter, vf, msg[0]);
638 struct ixgbe_vf *vf;
644 vf = &adapter->vfs[i];
646 if (vf->flags & IXGBE_VF_ACTIVE) {
647 if (hw->mbx.ops.check_for_rst(hw, vf->pool) == 0)
648 ixgbe_process_vf_reset(adapter, vf);
650 if (hw->mbx.ops.check_for_msg(hw, vf->pool) == 0)
651 ixgbe_process_vf_msg(ctx, vf);
653 if (hw->mbx.ops.check_for_ack(hw, vf->pool) == 0)
654 ixgbe_process_vf_ack(adapter, vf);
746 ixgbe_init_vf(struct adapter *adapter, struct ixgbe_vf *vf)
753 if (!(vf->flags & IXGBE_VF_ACTIVE))
756 vf_index = IXGBE_VF_INDEX(vf->pool);
758 pfmbimr |= IXGBE_VF_BIT(vf->pool);
761 ixgbe_vf_set_default_vlan(adapter, vf, vf->vlan_tag);
765 if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) {
766 ixgbe_set_rar(&adapter->hw, vf->rar_index,
767 vf->ether_addr, vf->pool, TRUE);
770 ixgbe_vf_enable_transmit(adapter, vf);
771 ixgbe_vf_enable_receive(adapter, vf);
773 ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG);
840 struct ixgbe_vf *vf;
843 vf = &adapter->vfs[i];
844 if (vf->flags & IXGBE_VF_ACTIVE)
845 ixgbe_update_max_frame(adapter, vf->maximum_frame_size);
853 struct ixgbe_vf *vf;
861 vf = &adapter->vfs[vfnum];
862 vf->pool= vfnum;
865 vf->rar_index = vfnum + 1;
866 vf->default_vlan = 0;
867 vf->maximum_frame_size = ETHER_MAX_LEN;
868 ixgbe_update_max_frame(adapter, vf->maximum_frame_size);
872 bcopy(mac, vf->ether_addr, ETHER_ADDR_LEN);
874 vf->flags |= IXGBE_VF_CAP_MAC;
880 vf->flags |= IXGBE_VF_CAP_MAC;
882 vf->flags |= IXGBE_VF_ACTIVE;
884 ixgbe_init_vf(adapter, vf);