i40e/base: find partition id in NPAR mode and disable FCoE
In NPAR mode the driver instance might be controlling the base partition or one of the other "fake" PFs. There are some things that can only be done by the base partition, aka partition_id 1. This code does a bit of work to find how many partitions are there in per port and what is the current partition_id. In addition, FCOE is disabled by default, as it was pushed out from the firmware. Test report: http://www.dpdk.org/ml/archives/dev/2015-May/017384.html Signed-off-by: Helin Zhang <helin.zhang@intel.com> Acked-by: Jijiang Liu <jijiang.liu@intel.com> Tested-by: Min Cao <min.cao@intel.com>
This commit is contained in:
parent
12b116260b
commit
2450cc2dc8
@ -2697,6 +2697,7 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
|
||||
enum i40e_admin_queue_opc list_type_opc)
|
||||
{
|
||||
struct i40e_aqc_list_capabilities_element_resp *cap;
|
||||
u32 valid_functions, num_functions;
|
||||
u32 number, logical_id, phys_id;
|
||||
struct i40e_hw_capabilities *p;
|
||||
u32 i = 0;
|
||||
@ -2826,11 +2827,44 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef I40E_FCOE_ENA
|
||||
/* Software override ensuring FCoE is disabled if npar or mfp
|
||||
* mode because it is not supported in these modes.
|
||||
*/
|
||||
if (p->npar_enable || p->mfp_mode_1)
|
||||
p->fcoe = false;
|
||||
#else
|
||||
/* Always disable FCoE if compiled without the I40E_FCOE_ENA flag */
|
||||
p->fcoe = false;
|
||||
#endif
|
||||
|
||||
/* count the enabled ports (aka the "not disabled" ports) */
|
||||
hw->num_ports = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
u32 port_cfg_reg = I40E_PRTGEN_CNF + (4 * i);
|
||||
u64 port_cfg = 0;
|
||||
|
||||
/* use AQ read to get the physical register offset instead
|
||||
* of the port relative offset
|
||||
*/
|
||||
i40e_aq_debug_read_register(hw, port_cfg_reg, &port_cfg, NULL);
|
||||
if (!(port_cfg & I40E_PRTGEN_CNF_PORT_DIS_MASK))
|
||||
hw->num_ports++;
|
||||
}
|
||||
|
||||
valid_functions = p->valid_functions;
|
||||
num_functions = 0;
|
||||
while (valid_functions) {
|
||||
if (valid_functions & 1)
|
||||
num_functions++;
|
||||
valid_functions >>= 1;
|
||||
}
|
||||
|
||||
/* partition id is 1-based, and functions are evenly spread
|
||||
* across the ports as partitions
|
||||
*/
|
||||
hw->partition_id = (hw->pf_id / hw->num_ports) + 1;
|
||||
hw->num_partitions = num_functions / hw->num_ports;
|
||||
|
||||
/* additional HW specific goodies that might
|
||||
* someday be HW version specific
|
||||
|
@ -537,6 +537,11 @@ struct i40e_hw {
|
||||
u8 pf_id;
|
||||
u16 main_vsi_seid;
|
||||
|
||||
/* for multi-function MACs */
|
||||
u16 partition_id;
|
||||
u16 num_partitions;
|
||||
u16 num_ports;
|
||||
|
||||
/* Closest numa node to the device */
|
||||
u16 numa_node;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user