From f25b03a7bd260b939b1a6aa69ca518d9848bb63a Mon Sep 17 00:00:00 2001 From: Sathya Perla Date: Sun, 30 May 2010 23:34:14 +0000 Subject: be2net: replace udelay() with schedule_timeout() in mbox polling As mbox polling is done only in process context, it is better to use schedule_timeout() instead of udelay(). Signed-off-by: Sathya Perla Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 9e305d7fb4b..ce437b639cf 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -186,7 +186,7 @@ static int be_mcc_notify_wait(struct be_adapter *adapter) static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) { - int cnt = 0, wait = 5; + int msecs = 0; u32 ready; do { @@ -201,15 +201,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) if (ready) break; - if (cnt > 4000000) { + if (msecs > 4000) { dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); return -1; } - if (cnt > 50) - wait = 200; - cnt += wait; - udelay(wait); + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(msecs_to_jiffies(1)); + msecs++; } while (true); return 0; -- cgit v1.2.3-18-g5258 From f3eb62d2cc7da7bea4b394dd06f6bc738aa284e7 Mon Sep 17 00:00:00 2001 From: Sathya Perla Date: Tue, 29 Jun 2010 00:11:17 +0000 Subject: be2net: memory barrier fixes on IBM p7 platform The ibm p7 architecure seems to reorder memory accesses more aggressively than previous ppc64 architectures. This requires memory barriers to ensure that rx/tx doorbells are pressed only after memory to be DMAed is written. Signed-off-by: Sathya Perla Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index ee1ad9693c8..65e3260d0f0 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -25,6 +25,8 @@ static void be_mcc_notify(struct be_adapter *adapter) val |= mccq->id & DB_MCCQ_RING_ID_MASK; val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT; + + wmb(); iowrite32(val, adapter->db + DB_MCCQ_OFFSET); } -- cgit v1.2.3-18-g5258 From ee3cb6295144b0adfa75ccaca307643a6998b1e2 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Thu, 1 Jul 2010 03:51:00 +0000 Subject: be2net: changes to properly provide phy details be2net driver is currently not showing correct phy details in certain cases. This patch fixes it. Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 65e3260d0f0..344e062b7f2 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -1695,3 +1695,38 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, spin_unlock_bh(&adapter->mcc_lock); return status; } + +int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) +{ + struct be_mcc_wrb *wrb; + struct be_cmd_req_get_phy_info *req; + struct be_sge *sge; + int status; + + spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { + status = -EBUSY; + goto err; + } + + req = cmd->va; + sge = nonembedded_sgl(wrb); + + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, + OPCODE_COMMON_GET_PHY_DETAILS); + + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, + OPCODE_COMMON_GET_PHY_DETAILS, + sizeof(*req)); + + sge->pa_hi = cpu_to_le32(upper_32_bits(cmd->dma)); + sge->pa_lo = cpu_to_le32(cmd->dma & 0xFFFFFFFF); + sge->len = cpu_to_le32(cmd->size); + + status = be_mcc_notify_wait(adapter); +err: + spin_unlock_bh(&adapter->mcc_lock); + return status; +} -- cgit v1.2.3-18-g5258 From e1d187353fc0597d24cf3169b1bbc1776058e883 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Fri, 23 Jul 2010 01:52:13 +0000 Subject: be2net: code to support tx rate configuration on virtual functions Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 344e062b7f2..408e1f2dd8e 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -1730,3 +1730,36 @@ err: spin_unlock_bh(&adapter->mcc_lock); return status; } + +int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain) +{ + struct be_mcc_wrb *wrb; + struct be_cmd_req_set_qos *req; + int status; + + spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { + status = -EBUSY; + goto err; + } + + req = embedded_payload(wrb); + + be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, + OPCODE_COMMON_SET_QOS); + + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, + OPCODE_COMMON_SET_QOS, sizeof(*req)); + + req->hdr.domain = domain; + req->valid_bits = BE_QOS_BITS_NIC; + req->max_bps_nic = bps; + + status = be_mcc_notify_wait(adapter); + +err: + spin_unlock_bh(&adapter->mcc_lock); + return status; +} -- cgit v1.2.3-18-g5258 From 8943807c214535c079bd30469562d1126b70bc2a Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Fri, 23 Jul 2010 12:42:40 -0700 Subject: be2net: supress printing error when mac query fails for VF When a virtual function driver in initialized, the network mac query command can fail. Skip display of error message in that case. Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 408e1f2dd8e..45b6f905034 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -76,7 +76,8 @@ static int be_mcc_compl_process(struct be_adapter *adapter, sizeof(resp->hw_stats)); netdev_stats_update(adapter); } - } else if (compl_status != MCC_STATUS_NOT_SUPPORTED) { + } else if ((compl_status != MCC_STATUS_NOT_SUPPORTED) && + (compl->tag0 != OPCODE_COMMON_NTWK_MAC_QUERY)) { extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & CQE_STATUS_EXTD_MASK; dev_warn(&adapter->pdev->dev, -- cgit v1.2.3-18-g5258 From 3486be29e63a9e8b0b013a9581879d8a48790d20 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Fri, 23 Jul 2010 02:04:54 +0000 Subject: be2net: variable name changes This patch changes names of some variables. Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 45b6f905034..6eaf8a3fa5e 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -1258,7 +1258,7 @@ err: } /* Uses mbox */ -int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *cap) +int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *mode) { struct be_mcc_wrb *wrb; struct be_cmd_req_query_fw_cfg *req; @@ -1279,7 +1279,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *cap) if (!status) { struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb); *port_num = le32_to_cpu(resp->phys_port); - *cap = le32_to_cpu(resp->function_cap); + *mode = le32_to_cpu(resp->function_mode); } spin_unlock(&adapter->mbox_lock); -- cgit v1.2.3-18-g5258 From 7c185276e8d820fa50a678c61abd611ee599920e Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Thu, 29 Jul 2010 06:16:33 +0000 Subject: be2net: add code to dump registers for debug when the BE device becomes unresponsive, dump the registers to help debugging Signed-off-by: Somnath K Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 6eaf8a3fa5e..7fd860dcbc8 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -206,6 +206,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) if (msecs > 4000) { dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); + be_dump_ue(adapter); return -1; } -- cgit v1.2.3-18-g5258 From 0fc48c37ff3969dde71a43fa7c8f176d4bd90a3e Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Thu, 29 Jul 2010 06:18:58 +0000 Subject: be2net: fix to avoid sending get_stats request if one is already being processed. GET_STATS request uses the same memory region as the response. If a new request for get stats is fired before the response for the previous get_stats request is received, the response will corrupt the new request, causing the f/w to misbehave. Signed-off-by: Somnath K Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- drivers/net/benet/be_cmds.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/net/benet/be_cmds.c') diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 7fd860dcbc8..3d305494a60 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -75,6 +75,7 @@ static int be_mcc_compl_process(struct be_adapter *adapter, be_dws_le_to_cpu(&resp->hw_stats, sizeof(resp->hw_stats)); netdev_stats_update(adapter); + adapter->stats_ioctl_sent = false; } } else if ((compl_status != MCC_STATUS_NOT_SUPPORTED) && (compl->tag0 != OPCODE_COMMON_NTWK_MAC_QUERY)) { @@ -951,6 +952,7 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) sge->len = cpu_to_le32(nonemb_cmd->size); be_mcc_notify(adapter); + adapter->stats_ioctl_sent = true; err: spin_unlock_bh(&adapter->mcc_lock); -- cgit v1.2.3-18-g5258