2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 11:13:58 +08:00

Merge branch 'be2net-next'

Sathya Perla says:

====================
be2net: patch set

Hi Dave, pls consider commiting the following patches to the net-next tree.
Thanks!

Patch 1 replaces the be_max_eqs() macro with two new macros called
be_max_nic_eqs() and be_max_func_eqs() to clear confusion in that part
of the code.

Patch 2 adds support to configure asymmetric number of rx/tx queues via
ethtool set-channels option.

Patch 3 disables EVB when VFs are not enabled on a BE3 SR-IOV config to
avoid the broadcast echo problem.

Patch 4 updates copyright markings in be2net src files

Patch 5 updates the be2net maintainers' list
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2016-06-27 04:06:31 -04:00
commit f1eecb7ea8
8 changed files with 132 additions and 51 deletions

View File

@ -10280,10 +10280,9 @@ W: http://www.avagotech.com
S: Supported
F: drivers/scsi/be2iscsi/
Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER
Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER (be2net)
M: Sathya Perla <sathya.perla@broadcom.com>
M: Ajit Khaparde <ajit.khaparde@broadcom.com>
M: Padmanabh Ratnakar <padmanabh.ratnakar@broadcom.com>
M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
M: Somnath Kotur <somnath.kotur@broadcom.com>
L: netdev@vger.kernel.org

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
@ -443,6 +443,7 @@ struct be_resources {
u16 max_iface_count;
u16 max_mcc_count;
u16 max_evt_qs;
u16 max_nic_evt_qs; /* NIC's share of evt qs */
u32 if_cap_flags;
u32 vf_if_cap_flags; /* VF if capability flags */
u32 flags;
@ -525,7 +526,8 @@ struct be_adapter {
spinlock_t mcc_lock; /* For serializing mcc cmds to BE card */
spinlock_t mcc_cq_lock;
u16 cfg_num_qs; /* configured via set-channels */
u16 cfg_num_rx_irqs; /* configured via set-channels */
u16 cfg_num_tx_irqs; /* configured via set-channels */
u16 num_evt_qs;
u16 num_msix_vec;
struct be_eq_obj eq_obj[MAX_EVT_QS];
@ -644,18 +646,42 @@ struct be_adapter {
#define be_max_txqs(adapter) (adapter->res.max_tx_qs)
#define be_max_prio_txqs(adapter) (adapter->res.max_prio_tx_qs)
#define be_max_rxqs(adapter) (adapter->res.max_rx_qs)
#define be_max_eqs(adapter) (adapter->res.max_evt_qs)
/* Max number of EQs available for the function (NIC + RoCE (if enabled)) */
#define be_max_func_eqs(adapter) (adapter->res.max_evt_qs)
/* Max number of EQs available avaialble only for NIC */
#define be_max_nic_eqs(adapter) (adapter->res.max_nic_evt_qs)
#define be_if_cap_flags(adapter) (adapter->res.if_cap_flags)
#define be_max_pf_pool_rss_tables(adapter) \
(adapter->pool_res.max_rss_tables)
/* Max irqs avaialble for NIC */
#define be_max_irqs(adapter) \
(min_t(u16, be_max_nic_eqs(adapter), num_online_cpus()))
static inline u16 be_max_qs(struct be_adapter *adapter)
/* Max irqs *needed* for RX queues */
static inline u16 be_max_rx_irqs(struct be_adapter *adapter)
{
/* If no RSS, need atleast the one def RXQ */
/* If no RSS, need atleast one irq for def-RXQ */
u16 num = max_t(u16, be_max_rss(adapter), 1);
num = min(num, be_max_eqs(adapter));
return min_t(u16, num, num_online_cpus());
return min_t(u16, num, be_max_irqs(adapter));
}
/* Max irqs *needed* for TX queues */
static inline u16 be_max_tx_irqs(struct be_adapter *adapter)
{
return min_t(u16, be_max_txqs(adapter), be_max_irqs(adapter));
}
/* Max irqs *needed* for combined queues */
static inline u16 be_max_qp_irqs(struct be_adapter *adapter)
{
return min(be_max_tx_irqs(adapter), be_max_rx_irqs(adapter));
}
/* Max irqs *needed* for RX and TX queues together */
static inline u16 be_max_any_irqs(struct be_adapter *adapter)
{
return max(be_max_tx_irqs(adapter), be_max_rx_irqs(adapter));
}
/* Is BE in pvid_tagging mode */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
@ -87,6 +87,11 @@ static struct be_cmd_priv_map cmd_priv_map[] = {
CMD_SUBSYSTEM_LOWLEVEL,
BE_PRIV_DEVCFG | BE_PRIV_DEVSEC
},
{
OPCODE_COMMON_SET_HSW_CONFIG,
CMD_SUBSYSTEM_COMMON,
BE_PRIV_DEVCFG | BE_PRIV_VHADM
},
};
static bool be_cmd_allowed(struct be_adapter *adapter, u8 opcode, u8 subsystem)
@ -3850,6 +3855,10 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid,
void *ctxt;
int status;
if (!be_cmd_allowed(adapter, OPCODE_COMMON_SET_HSW_CONFIG,
CMD_SUBSYSTEM_COMMON))
return -EPERM;
spin_lock_bh(&adapter->mcc_lock);
wrb = wrb_from_mccq(adapter);
@ -3871,7 +3880,7 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid,
AMAP_SET_BITS(struct amap_set_hsw_context, pvid_valid, ctxt, 1);
AMAP_SET_BITS(struct amap_set_hsw_context, pvid, ctxt, pvid);
}
if (!BEx_chip(adapter) && hsw_mode) {
if (hsw_mode) {
AMAP_SET_BITS(struct amap_set_hsw_context, interface_id,
ctxt, adapter->hba_port_num);
AMAP_SET_BITS(struct amap_set_hsw_context, pport, ctxt, 1);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
@ -1196,9 +1196,17 @@ static void be_get_channels(struct net_device *netdev,
struct ethtool_channels *ch)
{
struct be_adapter *adapter = netdev_priv(netdev);
u16 num_rx_irqs = max_t(u16, adapter->num_rss_qs, 1);
ch->combined_count = adapter->num_evt_qs;
ch->max_combined = be_max_qs(adapter);
/* num_tx_qs is always same as the number of irqs used for TX */
ch->combined_count = min(adapter->num_tx_qs, num_rx_irqs);
ch->rx_count = num_rx_irqs - ch->combined_count;
ch->tx_count = adapter->num_tx_qs - ch->combined_count;
ch->max_combined = be_max_qp_irqs(adapter);
/* The user must create atleast one combined channel */
ch->max_rx = be_max_rx_irqs(adapter) - 1;
ch->max_tx = be_max_tx_irqs(adapter) - 1;
}
static int be_set_channels(struct net_device *netdev,
@ -1207,11 +1215,22 @@ static int be_set_channels(struct net_device *netdev,
struct be_adapter *adapter = netdev_priv(netdev);
int status;
if (ch->rx_count || ch->tx_count || ch->other_count ||
!ch->combined_count || ch->combined_count > be_max_qs(adapter))
/* we support either only combined channels or a combination of
* combined and either RX-only or TX-only channels.
*/
if (ch->other_count || !ch->combined_count ||
(ch->rx_count && ch->tx_count))
return -EINVAL;
adapter->cfg_num_qs = ch->combined_count;
if (ch->combined_count > be_max_qp_irqs(adapter) ||
(ch->rx_count &&
(ch->rx_count + ch->combined_count) > be_max_rx_irqs(adapter)) ||
(ch->tx_count &&
(ch->tx_count + ch->combined_count) > be_max_tx_irqs(adapter)))
return -EINVAL;
adapter->cfg_num_rx_irqs = ch->combined_count + ch->rx_count;
adapter->cfg_num_tx_irqs = ch->combined_count + ch->tx_count;
status = be_update_queues(adapter);
return be_cmd_status(status);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
@ -2620,8 +2620,10 @@ static int be_evt_queues_create(struct be_adapter *adapter)
struct be_aic_obj *aic;
int i, rc;
/* need enough EQs to service both RX and TX queues */
adapter->num_evt_qs = min_t(u16, num_irqs(adapter),
adapter->cfg_num_qs);
max(adapter->cfg_num_rx_irqs,
adapter->cfg_num_tx_irqs));
for_all_evt_queues(adapter, eqo, i) {
int numa_node = dev_to_node(&adapter->pdev->dev);
@ -2726,7 +2728,7 @@ static int be_tx_qs_create(struct be_adapter *adapter)
struct be_eq_obj *eqo;
int status, i;
adapter->num_tx_qs = min(adapter->num_evt_qs, be_max_txqs(adapter));
adapter->num_tx_qs = min(adapter->num_evt_qs, adapter->cfg_num_tx_irqs);
for_all_tx_queues(adapter, txo, i) {
cq = &txo->cq;
@ -2784,11 +2786,11 @@ static int be_rx_cqs_create(struct be_adapter *adapter)
struct be_rx_obj *rxo;
int rc, i;
/* We can create as many RSS rings as there are EQs. */
adapter->num_rss_qs = adapter->num_evt_qs;
adapter->num_rss_qs =
min(adapter->num_evt_qs, adapter->cfg_num_rx_irqs);
/* We'll use RSS only if atleast 2 RSS rings are supported. */
if (adapter->num_rss_qs <= 1)
if (adapter->num_rss_qs < 2)
adapter->num_rss_qs = 0;
adapter->num_rx_qs = adapter->num_rss_qs + adapter->need_def_rxq;
@ -3249,18 +3251,22 @@ static void be_msix_disable(struct be_adapter *adapter)
static int be_msix_enable(struct be_adapter *adapter)
{
int i, num_vec;
unsigned int i, num_vec, max_roce_eqs;
struct device *dev = &adapter->pdev->dev;
/* If RoCE is supported, program the max number of NIC vectors that
* may be configured via set-channels, along with vectors needed for
* RoCe. Else, just program the number we'll use initially.
/* If RoCE is supported, program the max number of vectors that
* could be used for NIC and RoCE, else, just program the number
* we'll use initially.
*/
if (be_roce_supported(adapter))
num_vec = min_t(int, 2 * be_max_eqs(adapter),
2 * num_online_cpus());
else
num_vec = adapter->cfg_num_qs;
if (be_roce_supported(adapter)) {
max_roce_eqs =
be_max_func_eqs(adapter) - be_max_nic_eqs(adapter);
max_roce_eqs = min(max_roce_eqs, num_online_cpus());
num_vec = be_max_any_irqs(adapter) + max_roce_eqs;
} else {
num_vec = max(adapter->cfg_num_rx_irqs,
adapter->cfg_num_tx_irqs);
}
for (i = 0; i < num_vec; i++)
adapter->msix_entries[i].entry = i;
@ -3723,6 +3729,11 @@ static void be_vf_clear(struct be_adapter *adapter)
be_cmd_if_destroy(adapter, vf_cfg->if_handle, vf + 1);
}
if (BE3_chip(adapter))
be_cmd_set_hsw_config(adapter, 0, 0,
adapter->if_handle,
PORT_FWD_TYPE_PASSTHRU, 0);
done:
kfree(adapter->vf_cfg);
adapter->num_vfs = 0;
@ -4013,6 +4024,15 @@ static int be_vf_setup(struct be_adapter *adapter)
}
}
if (BE3_chip(adapter)) {
/* On BE3, enable VEB only when SRIOV is enabled */
status = be_cmd_set_hsw_config(adapter, 0, 0,
adapter->if_handle,
PORT_FWD_TYPE_VEB, 0);
if (status)
goto err;
}
adapter->flags |= BE_FLAGS_SRIOV_ENABLED;
return 0;
err:
@ -4219,16 +4239,13 @@ static int be_get_resources(struct be_adapter *adapter)
struct be_resources res = {0};
int status;
if (BEx_chip(adapter)) {
BEx_get_resources(adapter, &res);
adapter->res = res;
}
/* For Lancer, SH etc read per-function resource limits from FW.
* GET_FUNC_CONFIG returns per function guaranteed limits.
* GET_PROFILE_CONFIG returns PCI-E related limits PF-pool limits
*/
if (!BEx_chip(adapter)) {
if (BEx_chip(adapter)) {
BEx_get_resources(adapter, &res);
} else {
status = be_cmd_get_func_config(adapter, &res);
if (status)
return status;
@ -4237,13 +4254,13 @@ static int be_get_resources(struct be_adapter *adapter)
if (res.max_rss_qs && res.max_rss_qs == res.max_rx_qs &&
!(res.if_cap_flags & BE_IF_FLAGS_DEFQ_RSS))
res.max_rss_qs -= 1;
/* If RoCE may be enabled stash away half the EQs for RoCE */
if (be_roce_supported(adapter))
res.max_evt_qs /= 2;
adapter->res = res;
}
/* If RoCE is supported stash away half the EQs for RoCE */
res.max_nic_evt_qs = be_roce_supported(adapter) ?
res.max_evt_qs / 2 : res.max_evt_qs;
adapter->res = res;
/* If FW supports RSS default queue, then skip creating non-RSS
* queue for non-IP traffic.
*/
@ -4252,15 +4269,17 @@ static int be_get_resources(struct be_adapter *adapter)
dev_info(dev, "Max: txqs %d, rxqs %d, rss %d, eqs %d, vfs %d\n",
be_max_txqs(adapter), be_max_rxqs(adapter),
be_max_rss(adapter), be_max_eqs(adapter),
be_max_rss(adapter), be_max_nic_eqs(adapter),
be_max_vfs(adapter));
dev_info(dev, "Max: uc-macs %d, mc-macs %d, vlans %d\n",
be_max_uc(adapter), be_max_mc(adapter),
be_max_vlans(adapter));
/* Sanitize cfg_num_qs based on HW and platform limits */
adapter->cfg_num_qs = min_t(u16, netif_get_num_default_rss_queues(),
be_max_qs(adapter));
/* Ensure RX and TX queues are created in pairs at init time */
adapter->cfg_num_rx_irqs =
min_t(u16, netif_get_num_default_rss_queues(),
be_max_qp_irqs(adapter));
adapter->cfg_num_tx_irqs = adapter->cfg_num_rx_irqs;
return 0;
}
@ -4373,7 +4392,7 @@ static int be_if_create(struct be_adapter *adapter)
u32 cap_flags = be_if_cap_flags(adapter);
int status;
if (adapter->cfg_num_qs == 1)
if (adapter->cfg_num_rx_irqs == 1)
cap_flags &= ~(BE_IF_FLAGS_DEFQ_RSS | BE_IF_FLAGS_RSS);
en_flags &= cap_flags;
@ -4559,6 +4578,15 @@ static int be_setup(struct be_adapter *adapter)
be_cmd_set_logical_link_config(adapter,
IFLA_VF_LINK_STATE_AUTO, 0);
/* BE3 EVB echoes broadcast/multicast packets back to PF's vport
* confusing a linux bridge or OVS that it might be connected to.
* Set the EVB to PASSTHRU mode which effectively disables the EVB
* when SRIOV is not enabled.
*/
if (BE3_chip(adapter))
be_cmd_set_hsw_config(adapter, 0, 0, adapter->if_handle,
PORT_FWD_TYPE_PASSTHRU, 0);
if (adapter->num_vfs)
be_vf_setup(adapter);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 - 2015 Emulex
* Copyright (C) 2005 - 2016 Broadcom
* All rights reserved.
*
* This program is free software; you can redistribute it and/or