Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/ixgbe_vf.c
/****************************************************************************** | /****************************************************************************** | ||||
Copyright (c) 2001-2015, Intel Corporation | Copyright (c) 2001-2017, Intel Corporation | ||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
1. Redistributions of source code must retain the above copyright notice, | 1. Redistributions of source code must retain the above copyright notice, | ||||
this list of conditions and the following disclaimer. | this list of conditions and the following disclaimer. | ||||
2. Redistributions in binary form must reproduce the above copyright | 2. Redistributions in binary form must reproduce the above copyright | ||||
notice, this list of conditions and the following disclaimer in the | notice, this list of conditions and the following disclaimer in the | ||||
documentation and/or other materials provided with the distribution. | documentation and/or other materials provided with the distribution. | ||||
3. Neither the name of the Intel Corporation nor the names of its | 3. Neither the name of the Intel Corporation nor the names of its | ||||
contributors may be used to endorse or promote products derived from | contributors may be used to endorse or promote products derived from | ||||
this software without specific prior written permission. | this software without specific prior written permission. | ||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
POSSIBILITY OF SUCH DAMAGE. | POSSIBILITY OF SUCH DAMAGE. | ||||
******************************************************************************/ | ******************************************************************************/ | ||||
/*$FreeBSD$*/ | /*$FreeBSD$*/ | ||||
#include "ixgbe_api.h" | #include "ixgbe.h" | ||||
#include "ixgbe_type.h" | |||||
#include "ixgbe_vf.h" | |||||
#ifndef IXGBE_VFWRITE_REG | #ifndef IXGBE_VFWRITE_REG | ||||
#define IXGBE_VFWRITE_REG IXGBE_WRITE_REG | #define IXGBE_VFWRITE_REG IXGBE_WRITE_REG | ||||
#endif | #endif | ||||
#ifndef IXGBE_VFREAD_REG | #ifndef IXGBE_VFREAD_REG | ||||
#define IXGBE_VFREAD_REG IXGBE_READ_REG | #define IXGBE_VFREAD_REG IXGBE_READ_REG | ||||
#endif | #endif | ||||
Show All 13 Lines | s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw) | ||||
hw->mac.ops.reset_hw = ixgbe_reset_hw_vf; | hw->mac.ops.reset_hw = ixgbe_reset_hw_vf; | ||||
hw->mac.ops.start_hw = ixgbe_start_hw_vf; | hw->mac.ops.start_hw = ixgbe_start_hw_vf; | ||||
/* Cannot clear stats on VF */ | /* Cannot clear stats on VF */ | ||||
hw->mac.ops.clear_hw_cntrs = NULL; | hw->mac.ops.clear_hw_cntrs = NULL; | ||||
hw->mac.ops.get_media_type = NULL; | hw->mac.ops.get_media_type = NULL; | ||||
hw->mac.ops.get_mac_addr = ixgbe_get_mac_addr_vf; | hw->mac.ops.get_mac_addr = ixgbe_get_mac_addr_vf; | ||||
hw->mac.ops.stop_adapter = ixgbe_stop_adapter_vf; | hw->mac.ops.stop_adapter = ixgbe_stop_adapter_vf; | ||||
hw->mac.ops.get_bus_info = NULL; | hw->mac.ops.get_bus_info = NULL; | ||||
hw->mac.ops.negotiate_api_version = ixgbevf_negotiate_api_version; | |||||
/* Link */ | /* Link */ | ||||
hw->mac.ops.setup_link = ixgbe_setup_mac_link_vf; | hw->mac.ops.setup_link = ixgbe_setup_mac_link_vf; | ||||
hw->mac.ops.check_link = ixgbe_check_mac_link_vf; | hw->mac.ops.check_link = ixgbe_check_mac_link_vf; | ||||
hw->mac.ops.get_link_capabilities = NULL; | hw->mac.ops.get_link_capabilities = NULL; | ||||
/* RAR, Multicast, VLAN */ | /* RAR, Multicast, VLAN */ | ||||
hw->mac.ops.set_rar = ixgbe_set_rar_vf; | hw->mac.ops.set_rar = ixgbe_set_rar_vf; | ||||
hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf; | hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf; | ||||
hw->mac.ops.init_rx_addrs = NULL; | hw->mac.ops.init_rx_addrs = NULL; | ||||
hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf; | hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf; | ||||
hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode; | |||||
hw->mac.ops.enable_mc = NULL; | hw->mac.ops.enable_mc = NULL; | ||||
hw->mac.ops.disable_mc = NULL; | hw->mac.ops.disable_mc = NULL; | ||||
hw->mac.ops.clear_vfta = NULL; | hw->mac.ops.clear_vfta = NULL; | ||||
hw->mac.ops.set_vfta = ixgbe_set_vfta_vf; | hw->mac.ops.set_vfta = ixgbe_set_vfta_vf; | ||||
hw->mac.ops.set_rlpml = ixgbevf_rlpml_set_vf; | |||||
hw->mac.max_tx_queues = 1; | hw->mac.max_tx_queues = 1; | ||||
hw->mac.max_rx_queues = 1; | hw->mac.max_rx_queues = 1; | ||||
hw->mbx.ops.init_params = ixgbe_init_mbx_params_vf; | hw->mbx.ops.init_params = ixgbe_init_mbx_params_vf; | ||||
return IXGBE_SUCCESS; | return IXGBE_SUCCESS; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | ret_val = mbx->ops.read_posted(hw, msgbuf, | ||||
IXGBE_VF_PERMADDR_MSG_LEN, 0); | IXGBE_VF_PERMADDR_MSG_LEN, 0); | ||||
if (ret_val) | if (ret_val) | ||||
return ret_val; | return ret_val; | ||||
if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK) && | if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK) && | ||||
msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK)) | msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK)) | ||||
return IXGBE_ERR_INVALID_MAC_ADDR; | return IXGBE_ERR_INVALID_MAC_ADDR; | ||||
if (msgbuf[0] == (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK)) | |||||
memcpy(hw->mac.perm_addr, addr, IXGBE_ETH_LENGTH_OF_ADDRESS); | memcpy(hw->mac.perm_addr, addr, IXGBE_ETH_LENGTH_OF_ADDRESS); | ||||
hw->mac.mc_filter_type = msgbuf[IXGBE_VF_MC_TYPE_WORD]; | hw->mac.mc_filter_type = msgbuf[IXGBE_VF_MC_TYPE_WORD]; | ||||
return ret_val; | return ret_val; | ||||
} | } | ||||
/** | /** | ||||
* ixgbe_stop_adapter_vf - Generic stop Tx/Rx units | * ixgbe_stop_adapter_vf - Generic stop Tx/Rx units | ||||
* @hw: pointer to hardware structure | * @hw: pointer to hardware structure | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | default: /* Invalid mc_filter_type */ | ||||
break; | break; | ||||
} | } | ||||
/* vector can only be 12-bits or boundary will be exceeded */ | /* vector can only be 12-bits or boundary will be exceeded */ | ||||
vector &= 0xFFF; | vector &= 0xFFF; | ||||
return vector; | return vector; | ||||
} | } | ||||
static void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, | static s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg, | ||||
u32 *msg, u16 size) | u32 *retmsg, u16 size) | ||||
{ | { | ||||
struct ixgbe_mbx_info *mbx = &hw->mbx; | struct ixgbe_mbx_info *mbx = &hw->mbx; | ||||
u32 retmsg[IXGBE_VFMAILBOX_SIZE]; | |||||
s32 retval = mbx->ops.write_posted(hw, msg, size, 0); | s32 retval = mbx->ops.write_posted(hw, msg, size, 0); | ||||
if (!retval) | if (retval) | ||||
mbx->ops.read_posted(hw, retmsg, size, 0); | return retval; | ||||
return mbx->ops.read_posted(hw, retmsg, size, 0); | |||||
} | } | ||||
/** | /** | ||||
* ixgbe_set_rar_vf - set device MAC address | * ixgbe_set_rar_vf - set device MAC address | ||||
* @hw: pointer to hardware structure | * @hw: pointer to hardware structure | ||||
* @index: Receive address register to write | * @index: Receive address register to write | ||||
* @addr: Address to put into receive address register | * @addr: Address to put into receive address register | ||||
* @vmdq: VMDq "set" or "pool" index | * @vmdq: VMDq "set" or "pool" index | ||||
* @enable_addr: set flag that address is active | * @enable_addr: set flag that address is active | ||||
**/ | **/ | ||||
s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, | s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, | ||||
u32 enable_addr) | u32 enable_addr) | ||||
{ | { | ||||
struct ixgbe_mbx_info *mbx = &hw->mbx; | |||||
u32 msgbuf[3]; | u32 msgbuf[3]; | ||||
u8 *msg_addr = (u8 *)(&msgbuf[1]); | u8 *msg_addr = (u8 *)(&msgbuf[1]); | ||||
s32 ret_val; | s32 ret_val; | ||||
UNREFERENCED_3PARAMETER(vmdq, enable_addr, index); | UNREFERENCED_3PARAMETER(vmdq, enable_addr, index); | ||||
memset(msgbuf, 0, 12); | memset(msgbuf, 0, 12); | ||||
msgbuf[0] = IXGBE_VF_SET_MAC_ADDR; | msgbuf[0] = IXGBE_VF_SET_MAC_ADDR; | ||||
memcpy(msg_addr, addr, 6); | memcpy(msg_addr, addr, 6); | ||||
ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0); | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3); | ||||
if (!ret_val) | |||||
ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0); | |||||
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||||
/* if nacked the address was rejected, use "perm_addr" */ | /* if nacked the address was rejected, use "perm_addr" */ | ||||
if (!ret_val && | if (!ret_val && | ||||
(msgbuf[0] == (IXGBE_VF_SET_MAC_ADDR | IXGBE_VT_MSGTYPE_NACK))) | (msgbuf[0] == (IXGBE_VF_SET_MAC_ADDR | IXGBE_VT_MSGTYPE_NACK))) { | ||||
ixgbe_get_mac_addr_vf(hw, hw->mac.addr); | ixgbe_get_mac_addr_vf(hw, hw->mac.addr); | ||||
return IXGBE_ERR_MBX; | |||||
} | |||||
return ret_val; | return ret_val; | ||||
} | } | ||||
/** | /** | ||||
* ixgbe_update_mc_addr_list_vf - Update Multicast addresses | * ixgbe_update_mc_addr_list_vf - Update Multicast addresses | ||||
* @hw: pointer to the HW structure | * @hw: pointer to the HW structure | ||||
* @mc_addr_list: array of multicast addresses to program | * @mc_addr_list: array of multicast addresses to program | ||||
Show All 37 Lines | for (i = 0; i < cnt; i++) { | ||||
DEBUGOUT1("Hash value = 0x%03X\n", vector); | DEBUGOUT1("Hash value = 0x%03X\n", vector); | ||||
vector_list[i] = (u16)vector; | vector_list[i] = (u16)vector; | ||||
} | } | ||||
return mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE, 0); | return mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE, 0); | ||||
} | } | ||||
/** | /** | ||||
* ixgbevf_update_xcast_mode - Update Multicast mode | |||||
* @hw: pointer to the HW structure | |||||
* @xcast_mode: new multicast mode | |||||
* | |||||
* Updates the Multicast Mode of VF. | |||||
**/ | |||||
s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode) | |||||
{ | |||||
u32 msgbuf[2]; | |||||
s32 err; | |||||
switch (hw->api_version) { | |||||
case ixgbe_mbox_api_12: | |||||
/* New modes were introduced in 1.3 version */ | |||||
if (xcast_mode > IXGBEVF_XCAST_MODE_ALLMULTI) | |||||
return IXGBE_ERR_FEATURE_NOT_SUPPORTED; | |||||
/* Fall through */ | |||||
case ixgbe_mbox_api_13: | |||||
break; | |||||
default: | |||||
return IXGBE_ERR_FEATURE_NOT_SUPPORTED; | |||||
} | |||||
msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE; | |||||
msgbuf[1] = xcast_mode; | |||||
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2); | |||||
if (err) | |||||
return err; | |||||
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | |||||
if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK)) | |||||
return IXGBE_ERR_FEATURE_NOT_SUPPORTED; | |||||
return IXGBE_SUCCESS; | |||||
} | |||||
/** | |||||
* ixgbe_set_vfta_vf - Set/Unset vlan filter table address | * ixgbe_set_vfta_vf - Set/Unset vlan filter table address | ||||
* @hw: pointer to the HW structure | * @hw: pointer to the HW structure | ||||
* @vlan: 12 bit VLAN ID | * @vlan: 12 bit VLAN ID | ||||
* @vind: unused by VF drivers | * @vind: unused by VF drivers | ||||
* @vlan_on: if TRUE then set bit, else clear bit | * @vlan_on: if TRUE then set bit, else clear bit | ||||
* @vlvf_bypass: boolean flag indicating updating default pool is okay | |||||
* | |||||
* Turn on/off specified VLAN in the VLAN filter table. | |||||
**/ | **/ | ||||
s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on) | s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, | ||||
bool vlan_on, bool vlvf_bypass) | |||||
{ | { | ||||
struct ixgbe_mbx_info *mbx = &hw->mbx; | |||||
u32 msgbuf[2]; | u32 msgbuf[2]; | ||||
s32 ret_val; | s32 ret_val; | ||||
UNREFERENCED_1PARAMETER(vind); | UNREFERENCED_2PARAMETER(vind, vlvf_bypass); | ||||
msgbuf[0] = IXGBE_VF_SET_VLAN; | msgbuf[0] = IXGBE_VF_SET_VLAN; | ||||
msgbuf[1] = vlan; | msgbuf[1] = vlan; | ||||
/* Setting the 8 bit field MSG INFO to TRUE indicates "add" */ | /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */ | ||||
msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; | msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; | ||||
ret_val = mbx->ops.write_posted(hw, msgbuf, 2, 0); | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2); | ||||
if (!ret_val) | |||||
ret_val = mbx->ops.read_posted(hw, msgbuf, 1, 0); | |||||
if (!ret_val && (msgbuf[0] & IXGBE_VT_MSGTYPE_ACK)) | if (!ret_val && (msgbuf[0] & IXGBE_VT_MSGTYPE_ACK)) | ||||
return IXGBE_SUCCESS; | return IXGBE_SUCCESS; | ||||
return ret_val | (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK); | return ret_val | (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK); | ||||
} | } | ||||
/** | /** | ||||
* ixgbe_get_num_of_tx_queues_vf - Get number of TX queues | * ixgbe_get_num_of_tx_queues_vf - Get number of TX queues | ||||
Show All 30 Lines | s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr) | ||||
for (i = 0; i < IXGBE_ETH_LENGTH_OF_ADDRESS; i++) | for (i = 0; i < IXGBE_ETH_LENGTH_OF_ADDRESS; i++) | ||||
mac_addr[i] = hw->mac.perm_addr[i]; | mac_addr[i] = hw->mac.perm_addr[i]; | ||||
return IXGBE_SUCCESS; | return IXGBE_SUCCESS; | ||||
} | } | ||||
s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr) | s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr) | ||||
{ | { | ||||
struct ixgbe_mbx_info *mbx = &hw->mbx; | u32 msgbuf[3], msgbuf_chk; | ||||
u32 msgbuf[3]; | |||||
u8 *msg_addr = (u8 *)(&msgbuf[1]); | u8 *msg_addr = (u8 *)(&msgbuf[1]); | ||||
s32 ret_val; | s32 ret_val; | ||||
memset(msgbuf, 0, sizeof(msgbuf)); | memset(msgbuf, 0, sizeof(msgbuf)); | ||||
/* | /* | ||||
* If index is one then this is the start of a new list and needs | * If index is one then this is the start of a new list and needs | ||||
* indication to the PF so it can do it's own list management. | * indication to the PF so it can do it's own list management. | ||||
* If it is zero then that tells the PF to just clear all of | * If it is zero then that tells the PF to just clear all of | ||||
* this VF's macvlans and there is no new list. | * this VF's macvlans and there is no new list. | ||||
*/ | */ | ||||
msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT; | msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT; | ||||
msgbuf[0] |= IXGBE_VF_SET_MACVLAN; | msgbuf[0] |= IXGBE_VF_SET_MACVLAN; | ||||
msgbuf_chk = msgbuf[0]; | |||||
if (addr) | if (addr) | ||||
memcpy(msg_addr, addr, 6); | memcpy(msg_addr, addr, 6); | ||||
ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0); | |||||
if (!ret_val) | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3); | ||||
ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0); | if (!ret_val) { | ||||
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||||
if (!ret_val) | if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_NACK)) | ||||
if (msgbuf[0] == (IXGBE_VF_SET_MACVLAN | IXGBE_VT_MSGTYPE_NACK)) | return IXGBE_ERR_OUT_OF_MEM; | ||||
ret_val = IXGBE_ERR_OUT_OF_MEM; | } | ||||
return ret_val; | return ret_val; | ||||
} | } | ||||
/** | /** | ||||
* ixgbe_setup_mac_link_vf - Setup MAC link settings | * ixgbe_setup_mac_link_vf - Setup MAC link settings | ||||
* @hw: pointer to hardware structure | * @hw: pointer to hardware structure | ||||
* @speed: new link speed | * @speed: new link speed | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | for (i = 0; i < 5; i++) { | ||||
if (!(links_reg & IXGBE_LINKS_UP)) | if (!(links_reg & IXGBE_LINKS_UP)) | ||||
goto out; | goto out; | ||||
} | } | ||||
} | } | ||||
switch (links_reg & IXGBE_LINKS_SPEED_82599) { | switch (links_reg & IXGBE_LINKS_SPEED_82599) { | ||||
case IXGBE_LINKS_SPEED_10G_82599: | case IXGBE_LINKS_SPEED_10G_82599: | ||||
*speed = IXGBE_LINK_SPEED_10GB_FULL; | *speed = IXGBE_LINK_SPEED_10GB_FULL; | ||||
if (hw->mac.type >= ixgbe_mac_X550) { | |||||
if (links_reg & IXGBE_LINKS_SPEED_NON_STD) | |||||
*speed = IXGBE_LINK_SPEED_2_5GB_FULL; | |||||
} | |||||
break; | break; | ||||
case IXGBE_LINKS_SPEED_1G_82599: | case IXGBE_LINKS_SPEED_1G_82599: | ||||
*speed = IXGBE_LINK_SPEED_1GB_FULL; | *speed = IXGBE_LINK_SPEED_1GB_FULL; | ||||
break; | break; | ||||
case IXGBE_LINKS_SPEED_100_82599: | case IXGBE_LINKS_SPEED_100_82599: | ||||
*speed = IXGBE_LINK_SPEED_100_FULL; | *speed = IXGBE_LINK_SPEED_100_FULL; | ||||
if (hw->mac.type == ixgbe_mac_X550) { | |||||
if (links_reg & IXGBE_LINKS_SPEED_NON_STD) | |||||
*speed = IXGBE_LINK_SPEED_5GB_FULL; | |||||
} | |||||
break; | break; | ||||
case IXGBE_LINKS_SPEED_10_X550EM_A: | |||||
*speed = IXGBE_LINK_SPEED_UNKNOWN; | |||||
/* Since Reserved in older MAC's */ | |||||
if (hw->mac.type >= ixgbe_mac_X550) | |||||
*speed = IXGBE_LINK_SPEED_10_FULL; | |||||
break; | |||||
default: | |||||
*speed = IXGBE_LINK_SPEED_UNKNOWN; | |||||
} | } | ||||
/* if the read failed it could just be a mailbox collision, best wait | /* if the read failed it could just be a mailbox collision, best wait | ||||
* until we are called again and don't report an error | * until we are called again and don't report an error | ||||
*/ | */ | ||||
if (mbx->ops.read(hw, &in_msg, 1, 0)) | if (mbx->ops.read(hw, &in_msg, 1, 0)) | ||||
goto out; | goto out; | ||||
Show All 20 Lines | out: | ||||
return ret_val; | return ret_val; | ||||
} | } | ||||
/** | /** | ||||
* ixgbevf_rlpml_set_vf - Set the maximum receive packet length | * ixgbevf_rlpml_set_vf - Set the maximum receive packet length | ||||
* @hw: pointer to the HW structure | * @hw: pointer to the HW structure | ||||
* @max_size: value to assign to max frame size | * @max_size: value to assign to max frame size | ||||
**/ | **/ | ||||
void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size) | s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size) | ||||
{ | { | ||||
u32 msgbuf[2]; | u32 msgbuf[2]; | ||||
s32 retval; | |||||
msgbuf[0] = IXGBE_VF_SET_LPE; | msgbuf[0] = IXGBE_VF_SET_LPE; | ||||
msgbuf[1] = max_size; | msgbuf[1] = max_size; | ||||
ixgbevf_write_msg_read_ack(hw, msgbuf, 2); | |||||
retval = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2); | |||||
if (retval) | |||||
return retval; | |||||
if ((msgbuf[0] & IXGBE_VF_SET_LPE) && | |||||
(msgbuf[0] & IXGBE_VT_MSGTYPE_NACK)) | |||||
return IXGBE_ERR_MBX; | |||||
return 0; | |||||
} | } | ||||
/** | /** | ||||
* ixgbevf_negotiate_api_version - Negotiate supported API version | * ixgbevf_negotiate_api_version - Negotiate supported API version | ||||
* @hw: pointer to the HW structure | * @hw: pointer to the HW structure | ||||
* @api: integer containing requested API version | * @api: integer containing requested API version | ||||
**/ | **/ | ||||
int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api) | int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api) | ||||
{ | { | ||||
int err; | int err; | ||||
u32 msg[3]; | u32 msg[3]; | ||||
/* Negotiate the mailbox API version */ | /* Negotiate the mailbox API version */ | ||||
msg[0] = IXGBE_VF_API_NEGOTIATE; | msg[0] = IXGBE_VF_API_NEGOTIATE; | ||||
msg[1] = api; | msg[1] = api; | ||||
msg[2] = 0; | msg[2] = 0; | ||||
err = hw->mbx.ops.write_posted(hw, msg, 3, 0); | |||||
if (!err) | err = ixgbevf_write_msg_read_ack(hw, msg, msg, 3); | ||||
err = hw->mbx.ops.read_posted(hw, msg, 3, 0); | |||||
if (!err) { | if (!err) { | ||||
msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||||
/* Store value and return 0 on success */ | /* Store value and return 0 on success */ | ||||
if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_ACK)) { | if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_ACK)) { | ||||
hw->api_version = api; | hw->api_version = api; | ||||
return 0; | return 0; | ||||
} | } | ||||
err = IXGBE_ERR_INVALID_ARGUMENT; | err = IXGBE_ERR_INVALID_ARGUMENT; | ||||
} | } | ||||
return err; | return err; | ||||
} | } | ||||
int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, | int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, | ||||
unsigned int *default_tc) | unsigned int *default_tc) | ||||
{ | { | ||||
int err; | int err; | ||||
u32 msg[5]; | u32 msg[5]; | ||||
/* do nothing if API doesn't support ixgbevf_get_queues */ | /* do nothing if API doesn't support ixgbevf_get_queues */ | ||||
switch (hw->api_version) { | switch (hw->api_version) { | ||||
case ixgbe_mbox_api_11: | case ixgbe_mbox_api_11: | ||||
case ixgbe_mbox_api_12: | |||||
case ixgbe_mbox_api_13: | |||||
break; | break; | ||||
default: | default: | ||||
return 0; | return 0; | ||||
} | } | ||||
/* Fetch queue configuration from the PF */ | /* Fetch queue configuration from the PF */ | ||||
msg[0] = IXGBE_VF_GET_QUEUES; | msg[0] = IXGBE_VF_GET_QUEUES; | ||||
msg[1] = msg[2] = msg[3] = msg[4] = 0; | msg[1] = msg[2] = msg[3] = msg[4] = 0; | ||||
err = hw->mbx.ops.write_posted(hw, msg, 5, 0); | |||||
if (!err) | err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5); | ||||
err = hw->mbx.ops.read_posted(hw, msg, 5, 0); | |||||
if (!err) { | if (!err) { | ||||
msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||||
/* | /* | ||||
* if we we didn't get an ACK there must have been | * if we we didn't get an ACK there must have been | ||||
* some sort of mailbox error so we should treat it | * some sort of mailbox error so we should treat it | ||||
* as such | * as such | ||||
*/ | */ | ||||
Show All 27 Lines |