Skip to content

Commit 53d56f7

Browse files
committed
Merge branch 'qed-next'
Manish Chopra says: ==================== qed/qede: Enhancements This patch series adds these below features support in qed/qede 1) Ntuple filter configuration [via ethtool -n/N] 2) EEE (energy efficient ethernet) support [ethtool --set-eee/show-eee] 3) Coalescing configuration support for VFs [via ethtool -c/C] Please consider applying this to "net-next" V1->V2: * Fixes below Kbuild test robot warning. drivers/net//ethernet/qlogic/qed/qed_l2.c: In function 'qed_get_queue_coalesce': drivers/net//ethernet/qlogic/qed/qed_l2.c:2137:8: error: implicit declaration of function 'qed_vf_pf_get_coalesce' [-Werror=implicit-function-declaration] ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents e27a879 + 4182287 commit 53d56f7

File tree

18 files changed

+1393
-180
lines changed

18 files changed

+1393
-180
lines changed

drivers/net/ethernet/qlogic/qed/qed_dev.c

Lines changed: 117 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,8 @@ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params)
16841684
"Load request was sent. Load code: 0x%x\n",
16851685
load_code);
16861686

1687+
qed_mcp_set_capabilities(p_hwfn, p_hwfn->p_main_ptt);
1688+
16871689
qed_reset_mb_shadow(p_hwfn, p_hwfn->p_main_ptt);
16881690

16891691
p_hwfn->first_on_engine = (load_code ==
@@ -2472,6 +2474,7 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
24722474
{
24732475
u32 port_cfg_addr, link_temp, nvm_cfg_addr, device_capabilities;
24742476
u32 nvm_cfg1_offset, mf_mode, addr, generic_cont0, core_cfg;
2477+
struct qed_mcp_link_capabilities *p_caps;
24752478
struct qed_mcp_link_params *link;
24762479

24772480
/* Read global nvm_cfg address */
@@ -2534,6 +2537,7 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
25342537

25352538
/* Read default link configuration */
25362539
link = &p_hwfn->mcp_info->link_input;
2540+
p_caps = &p_hwfn->mcp_info->link_capabilities;
25372541
port_cfg_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
25382542
offsetof(struct nvm_cfg1, port[MFW_PORT(p_hwfn)]);
25392543
link_temp = qed_rd(p_hwfn, p_ptt,
@@ -2588,10 +2592,45 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
25882592
NVM_CFG1_PORT_DRV_FLOW_CONTROL_TX);
25892593
link->loopback_mode = 0;
25902594

2591-
DP_VERBOSE(p_hwfn, NETIF_MSG_LINK,
2592-
"Read default link: Speed 0x%08x, Adv. Speed 0x%08x, AN: 0x%02x, PAUSE AN: 0x%02x\n",
2593-
link->speed.forced_speed, link->speed.advertised_speeds,
2594-
link->speed.autoneg, link->pause.autoneg);
2595+
if (p_hwfn->mcp_info->capabilities & FW_MB_PARAM_FEATURE_SUPPORT_EEE) {
2596+
link_temp = qed_rd(p_hwfn, p_ptt, port_cfg_addr +
2597+
offsetof(struct nvm_cfg1_port, ext_phy));
2598+
link_temp &= NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_MASK;
2599+
link_temp >>= NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_OFFSET;
2600+
p_caps->default_eee = QED_MCP_EEE_ENABLED;
2601+
link->eee.enable = true;
2602+
switch (link_temp) {
2603+
case NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_DISABLED:
2604+
p_caps->default_eee = QED_MCP_EEE_DISABLED;
2605+
link->eee.enable = false;
2606+
break;
2607+
case NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_BALANCED:
2608+
p_caps->eee_lpi_timer = EEE_TX_TIMER_USEC_BALANCED_TIME;
2609+
break;
2610+
case NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_AGGRESSIVE:
2611+
p_caps->eee_lpi_timer =
2612+
EEE_TX_TIMER_USEC_AGGRESSIVE_TIME;
2613+
break;
2614+
case NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_LOW_LATENCY:
2615+
p_caps->eee_lpi_timer = EEE_TX_TIMER_USEC_LATENCY_TIME;
2616+
break;
2617+
}
2618+
2619+
link->eee.tx_lpi_timer = p_caps->eee_lpi_timer;
2620+
link->eee.tx_lpi_enable = link->eee.enable;
2621+
link->eee.adv_caps = QED_EEE_1G_ADV | QED_EEE_10G_ADV;
2622+
} else {
2623+
p_caps->default_eee = QED_MCP_EEE_UNSUPPORTED;
2624+
}
2625+
2626+
DP_VERBOSE(p_hwfn,
2627+
NETIF_MSG_LINK,
2628+
"Read default link: Speed 0x%08x, Adv. Speed 0x%08x, AN: 0x%02x, PAUSE AN: 0x%02x EEE: %02x [%08x usec]\n",
2629+
link->speed.forced_speed,
2630+
link->speed.advertised_speeds,
2631+
link->speed.autoneg,
2632+
link->pause.autoneg,
2633+
p_caps->default_eee, p_caps->eee_lpi_timer);
25952634

25962635
/* Read Multi-function information from shmem */
25972636
addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
@@ -2751,6 +2790,27 @@ static void qed_hw_info_port_num(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
27512790
qed_hw_info_port_num_ah(p_hwfn, p_ptt);
27522791
}
27532792

2793+
static void qed_get_eee_caps(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
2794+
{
2795+
struct qed_mcp_link_capabilities *p_caps;
2796+
u32 eee_status;
2797+
2798+
p_caps = &p_hwfn->mcp_info->link_capabilities;
2799+
if (p_caps->default_eee == QED_MCP_EEE_UNSUPPORTED)
2800+
return;
2801+
2802+
p_caps->eee_speed_caps = 0;
2803+
eee_status = qed_rd(p_hwfn, p_ptt, p_hwfn->mcp_info->port_addr +
2804+
offsetof(struct public_port, eee_status));
2805+
eee_status = (eee_status & EEE_SUPPORTED_SPEED_MASK) >>
2806+
EEE_SUPPORTED_SPEED_OFFSET;
2807+
2808+
if (eee_status & EEE_1G_SUPPORTED)
2809+
p_caps->eee_speed_caps |= QED_EEE_1G_ADV;
2810+
if (eee_status & EEE_10G_ADV)
2811+
p_caps->eee_speed_caps |= QED_EEE_10G_ADV;
2812+
}
2813+
27542814
static int
27552815
qed_get_hw_info(struct qed_hwfn *p_hwfn,
27562816
struct qed_ptt *p_ptt,
@@ -2767,6 +2827,8 @@ qed_get_hw_info(struct qed_hwfn *p_hwfn,
27672827

27682828
qed_hw_info_port_num(p_hwfn, p_ptt);
27692829

2830+
qed_mcp_get_capabilities(p_hwfn, p_ptt);
2831+
27702832
qed_hw_get_nvm_info(p_hwfn, p_ptt);
27712833

27722834
rc = qed_int_igu_read_cam(p_hwfn, p_ptt);
@@ -2785,6 +2847,8 @@ qed_get_hw_info(struct qed_hwfn *p_hwfn,
27852847
p_hwfn->mcp_info->func_info.ovlan;
27862848

27872849
qed_mcp_cmd_port_init(p_hwfn, p_ptt);
2850+
2851+
qed_get_eee_caps(p_hwfn, p_ptt);
27882852
}
27892853

27902854
if (qed_mcp_is_init(p_hwfn)) {
@@ -3630,20 +3694,54 @@ static int qed_set_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
36303694
}
36313695

36323696
p_coal_timeset = p_eth_qzone;
3633-
memset(p_coal_timeset, 0, eth_qzone_size);
3697+
memset(p_eth_qzone, 0, eth_qzone_size);
36343698
SET_FIELD(p_coal_timeset->value, COALESCING_TIMESET_TIMESET, timeset);
36353699
SET_FIELD(p_coal_timeset->value, COALESCING_TIMESET_VALID, 1);
36363700
qed_memcpy_to(p_hwfn, p_ptt, hw_addr, p_eth_qzone, eth_qzone_size);
36373701

36383702
return 0;
36393703
}
36403704

3641-
int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3642-
u16 coalesce, u16 qid, u16 sb_id)
3705+
int qed_set_queue_coalesce(u16 rx_coal, u16 tx_coal, void *p_handle)
3706+
{
3707+
struct qed_queue_cid *p_cid = p_handle;
3708+
struct qed_hwfn *p_hwfn;
3709+
struct qed_ptt *p_ptt;
3710+
int rc = 0;
3711+
3712+
p_hwfn = p_cid->p_owner;
3713+
3714+
if (IS_VF(p_hwfn->cdev))
3715+
return qed_vf_pf_set_coalesce(p_hwfn, rx_coal, tx_coal, p_cid);
3716+
3717+
p_ptt = qed_ptt_acquire(p_hwfn);
3718+
if (!p_ptt)
3719+
return -EAGAIN;
3720+
3721+
if (rx_coal) {
3722+
rc = qed_set_rxq_coalesce(p_hwfn, p_ptt, rx_coal, p_cid);
3723+
if (rc)
3724+
goto out;
3725+
p_hwfn->cdev->rx_coalesce_usecs = rx_coal;
3726+
}
3727+
3728+
if (tx_coal) {
3729+
rc = qed_set_txq_coalesce(p_hwfn, p_ptt, tx_coal, p_cid);
3730+
if (rc)
3731+
goto out;
3732+
p_hwfn->cdev->tx_coalesce_usecs = tx_coal;
3733+
}
3734+
out:
3735+
qed_ptt_release(p_hwfn, p_ptt);
3736+
return rc;
3737+
}
3738+
3739+
int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn,
3740+
struct qed_ptt *p_ptt,
3741+
u16 coalesce, struct qed_queue_cid *p_cid)
36433742
{
36443743
struct ustorm_eth_queue_zone eth_qzone;
36453744
u8 timeset, timer_res;
3646-
u16 fw_qid = 0;
36473745
u32 address;
36483746
int rc;
36493747

@@ -3660,32 +3758,29 @@ int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
36603758
}
36613759
timeset = (u8)(coalesce >> timer_res);
36623760

3663-
rc = qed_fw_l2_queue(p_hwfn, qid, &fw_qid);
3664-
if (rc)
3665-
return rc;
3666-
3667-
rc = qed_int_set_timer_res(p_hwfn, p_ptt, timer_res, sb_id, false);
3761+
rc = qed_int_set_timer_res(p_hwfn, p_ptt, timer_res,
3762+
p_cid->sb_igu_id, false);
36683763
if (rc)
36693764
goto out;
36703765

3671-
address = BAR0_MAP_REG_USDM_RAM + USTORM_ETH_QUEUE_ZONE_OFFSET(fw_qid);
3766+
address = BAR0_MAP_REG_USDM_RAM +
3767+
USTORM_ETH_QUEUE_ZONE_OFFSET(p_cid->abs.queue_id);
36723768

36733769
rc = qed_set_coalesce(p_hwfn, p_ptt, address, &eth_qzone,
36743770
sizeof(struct ustorm_eth_queue_zone), timeset);
36753771
if (rc)
36763772
goto out;
36773773

3678-
p_hwfn->cdev->rx_coalesce_usecs = coalesce;
36793774
out:
36803775
return rc;
36813776
}
36823777

3683-
int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3684-
u16 coalesce, u16 qid, u16 sb_id)
3778+
int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn,
3779+
struct qed_ptt *p_ptt,
3780+
u16 coalesce, struct qed_queue_cid *p_cid)
36853781
{
36863782
struct xstorm_eth_queue_zone eth_qzone;
36873783
u8 timeset, timer_res;
3688-
u16 fw_qid = 0;
36893784
u32 address;
36903785
int rc;
36913786

@@ -3702,22 +3797,16 @@ int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
37023797
}
37033798
timeset = (u8)(coalesce >> timer_res);
37043799

3705-
rc = qed_fw_l2_queue(p_hwfn, qid, &fw_qid);
3706-
if (rc)
3707-
return rc;
3708-
3709-
rc = qed_int_set_timer_res(p_hwfn, p_ptt, timer_res, sb_id, true);
3800+
rc = qed_int_set_timer_res(p_hwfn, p_ptt, timer_res,
3801+
p_cid->sb_igu_id, true);
37103802
if (rc)
37113803
goto out;
37123804

3713-
address = BAR0_MAP_REG_XSDM_RAM + XSTORM_ETH_QUEUE_ZONE_OFFSET(fw_qid);
3805+
address = BAR0_MAP_REG_XSDM_RAM +
3806+
XSTORM_ETH_QUEUE_ZONE_OFFSET(p_cid->abs.queue_id);
37143807

37153808
rc = qed_set_coalesce(p_hwfn, p_ptt, address, &eth_qzone,
37163809
sizeof(struct xstorm_eth_queue_zone), timeset);
3717-
if (rc)
3718-
goto out;
3719-
3720-
p_hwfn->cdev->tx_coalesce_usecs = coalesce;
37213810
out:
37223811
return rc;
37233812
}

drivers/net/ethernet/qlogic/qed/qed_dev_api.h

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -443,38 +443,35 @@ int qed_final_cleanup(struct qed_hwfn *p_hwfn,
443443
struct qed_ptt *p_ptt, u16 id, bool is_vf);
444444

445445
/**
446-
* @brief qed_set_rxq_coalesce - Configure coalesce parameters for an Rx queue
447-
* The fact that we can configure coalescing to up to 511, but on varying
448-
* accuracy [the bigger the value the less accurate] up to a mistake of 3usec
449-
* for the highest values.
446+
* @brief qed_get_queue_coalesce - Retrieve coalesce value for a given queue.
450447
*
451448
* @param p_hwfn
452-
* @param p_ptt
453-
* @param coalesce - Coalesce value in micro seconds.
454-
* @param qid - Queue index.
455-
* @param qid - SB Id
449+
* @param p_coal - store coalesce value read from the hardware.
450+
* @param p_handle
456451
*
457452
* @return int
458-
*/
459-
int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
460-
u16 coalesce, u16 qid, u16 sb_id);
453+
**/
454+
int qed_get_queue_coalesce(struct qed_hwfn *p_hwfn, u16 *coal, void *handle);
461455

462456
/**
463-
* @brief qed_set_txq_coalesce - Configure coalesce parameters for a Tx queue
464-
* While the API allows setting coalescing per-qid, all tx queues sharing a
465-
* SB should be in same range [i.e., either 0-0x7f, 0x80-0xff or 0x100-0x1ff]
466-
* otherwise configuration would break.
457+
* @brief qed_set_queue_coalesce - Configure coalesce parameters for Rx and
458+
* Tx queue. The fact that we can configure coalescing to up to 511, but on
459+
* varying accuracy [the bigger the value the less accurate] up to a mistake
460+
* of 3usec for the highest values.
461+
* While the API allows setting coalescing per-qid, all queues sharing a SB
462+
* should be in same range [i.e., either 0-0x7f, 0x80-0xff or 0x100-0x1ff]
463+
* otherwise configuration would break.
467464
*
468-
* @param p_hwfn
469-
* @param p_ptt
470-
* @param coalesce - Coalesce value in micro seconds.
471-
* @param qid - Queue index.
472-
* @param qid - SB Id
465+
*
466+
* @param rx_coal - Rx Coalesce value in micro seconds.
467+
* @param tx_coal - TX Coalesce value in micro seconds.
468+
* @param p_handle
473469
*
474470
* @return int
475-
*/
476-
int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
477-
u16 coalesce, u16 qid, u16 sb_id);
471+
**/
472+
int
473+
qed_set_queue_coalesce(u16 rx_coal, u16 tx_coal, void *p_handle);
474+
478475

479476
const char *qed_hw_get_resc_name(enum qed_resources res_id);
480477
#endif

drivers/net/ethernet/qlogic/qed/qed_hsi.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10825,6 +10825,17 @@ struct eth_phy_cfg {
1082510825
#define ETH_LOOPBACK_EXT (3)
1082610826
#define ETH_LOOPBACK_MAC (4)
1082710827

10828+
u32 eee_cfg;
10829+
#define EEE_CFG_EEE_ENABLED BIT(0)
10830+
#define EEE_CFG_TX_LPI BIT(1)
10831+
#define EEE_CFG_ADV_SPEED_1G BIT(2)
10832+
#define EEE_CFG_ADV_SPEED_10G BIT(3)
10833+
#define EEE_TX_TIMER_USEC_MASK (0xfffffff0)
10834+
#define EEE_TX_TIMER_USEC_OFFSET 4
10835+
#define EEE_TX_TIMER_USEC_BALANCED_TIME (0xa00)
10836+
#define EEE_TX_TIMER_USEC_AGGRESSIVE_TIME (0x100)
10837+
#define EEE_TX_TIMER_USEC_LATENCY_TIME (0x6000)
10838+
1082810839
u32 feature_config_flags;
1082910840
#define ETH_EEE_MODE_ADV_LPI (1 << 0)
1083010841
};
@@ -11242,6 +11253,25 @@ struct public_port {
1124211253
u32 wol_pkt_len;
1124311254
u32 wol_pkt_details;
1124411255
struct dcb_dscp_map dcb_dscp_map;
11256+
11257+
u32 eee_status;
11258+
#define EEE_ACTIVE_BIT BIT(0)
11259+
#define EEE_LD_ADV_STATUS_MASK 0x000000f0
11260+
#define EEE_LD_ADV_STATUS_OFFSET 4
11261+
#define EEE_1G_ADV BIT(1)
11262+
#define EEE_10G_ADV BIT(2)
11263+
#define EEE_LP_ADV_STATUS_MASK 0x00000f00
11264+
#define EEE_LP_ADV_STATUS_OFFSET 8
11265+
#define EEE_SUPPORTED_SPEED_MASK 0x0000f000
11266+
#define EEE_SUPPORTED_SPEED_OFFSET 12
11267+
#define EEE_1G_SUPPORTED BIT(1)
11268+
#define EEE_10G_SUPPORTED BIT(2)
11269+
11270+
u32 eee_remote;
11271+
#define EEE_REMOTE_TW_TX_MASK 0x0000ffff
11272+
#define EEE_REMOTE_TW_TX_OFFSET 0
11273+
#define EEE_REMOTE_TW_RX_MASK 0xffff0000
11274+
#define EEE_REMOTE_TW_RX_OFFSET 16
1124511275
};
1124611276

1124711277
struct public_func {
@@ -11570,6 +11600,9 @@ struct public_drv_mb {
1157011600
#define DRV_MSG_CODE_GET_PF_RDMA_PROTOCOL 0x002b0000
1157111601
#define DRV_MSG_CODE_OS_WOL 0x002e0000
1157211602

11603+
#define DRV_MSG_CODE_FEATURE_SUPPORT 0x00300000
11604+
#define DRV_MSG_CODE_GET_MFW_FEATURE_SUPPORT 0x00310000
11605+
1157311606
#define DRV_MSG_SEQ_NUMBER_MASK 0x0000ffff
1157411607

1157511608
u32 drv_mb_param;
@@ -11653,6 +11686,10 @@ struct public_drv_mb {
1165311686
#define DRV_MB_PARAM_BIST_TEST_IMAGE_INDEX_SHIFT 8
1165411687
#define DRV_MB_PARAM_BIST_TEST_IMAGE_INDEX_MASK 0x0000FF00
1165511688

11689+
#define DRV_MB_PARAM_FEATURE_SUPPORT_PORT_MASK 0x0000FFFF
11690+
#define DRV_MB_PARAM_FEATURE_SUPPORT_PORT_OFFSET 0
11691+
#define DRV_MB_PARAM_FEATURE_SUPPORT_PORT_EEE 0x00000002
11692+
1165611693
u32 fw_mb_header;
1165711694
#define FW_MSG_CODE_MASK 0xffff0000
1165811695
#define FW_MSG_CODE_UNSUPPORTED 0x00000000
@@ -11696,6 +11733,9 @@ struct public_drv_mb {
1169611733
#define FW_MB_PARAM_GET_PF_RDMA_IWARP 0x2
1169711734
#define FW_MB_PARAM_GET_PF_RDMA_BOTH 0x3
1169811735

11736+
/* get MFW feature support response */
11737+
#define FW_MB_PARAM_FEATURE_SUPPORT_EEE 0x00000002
11738+
1169911739
#define FW_MB_PARAM_LOAD_DONE_DID_EFUSE_ERROR (1 << 0)
1170011740

1170111741
u32 drv_pulse_mb;
@@ -11891,7 +11931,16 @@ struct nvm_cfg1_port {
1189111931
#define NVM_CFG1_PORT_DRV_FLOW_CONTROL_TX 0x4
1189211932
u32 phy_cfg;
1189311933
u32 mgmt_traffic;
11934+
1189411935
u32 ext_phy;
11936+
/* EEE power saving mode */
11937+
#define NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_MASK 0x00FF0000
11938+
#define NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_OFFSET 16
11939+
#define NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_DISABLED 0x0
11940+
#define NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_BALANCED 0x1
11941+
#define NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_AGGRESSIVE 0x2
11942+
#define NVM_CFG1_PORT_EEE_POWER_SAVING_MODE_LOW_LATENCY 0x3
11943+
1189511944
u32 mba_cfg1;
1189611945
u32 mba_cfg2;
1189711946
u32 vf_cfg;

0 commit comments

Comments
 (0)