Commit 5529bad9 authored by Tomer Tayar's avatar Tomer Tayar Committed by David S. Miller

qed: Major changes to MB locking

Driver interaction with the managemnt firmware is done via mailbox
commands which the management firmware periodically sample, as well
as placing of additional data in set places in the shared memory.
Each PF has a single designated mailbox address, and all flows that
require messaging to the management should use it.

This patch does 2 things:
 1. It re-defines the critical section surrounding the mailbox sending -
that section should include the setting of the shared memory as well as
the sending of the command [otherwise a race might send a command with
the data of a different command].
 2. It moves the locking scheme from using mutices into using spinlocks.
This lays the groundwork for sending MFW commands from non-sleepable
contexts.
Signed-off-by: default avatarTomer Tayar <Tomer.Tayar@qlogic.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fc916ff2
This diff is collapsed.
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h>
#include "qed_hsi.h" #include "qed_hsi.h"
struct qed_mcp_link_speed_params { struct qed_mcp_link_speed_params {
...@@ -255,7 +255,8 @@ int qed_mcp_set_led(struct qed_hwfn *p_hwfn, ...@@ -255,7 +255,8 @@ int qed_mcp_set_led(struct qed_hwfn *p_hwfn,
#define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \ #define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
((_p_hwfn)->cdev->num_ports_in_engines * 2)) ((_p_hwfn)->cdev->num_ports_in_engines * 2))
struct qed_mcp_info { struct qed_mcp_info {
struct mutex mutex; /* MCP access lock */ spinlock_t lock;
bool block_mb_sending;
u32 public_base; u32 public_base;
u32 drv_mb_addr; u32 drv_mb_addr;
u32 mfw_mb_addr; u32 mfw_mb_addr;
...@@ -272,6 +273,15 @@ struct qed_mcp_info { ...@@ -272,6 +273,15 @@ struct qed_mcp_info {
u16 mcp_hist; u16 mcp_hist;
}; };
struct qed_mcp_mb_params {
u32 cmd;
u32 param;
union drv_union_data *p_data_src;
union drv_union_data *p_data_dst;
u32 mcp_resp;
u32 mcp_param;
};
/** /**
* @brief Initialize the interface with the MCP * @brief Initialize the interface with the MCP
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment