aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSomnath Kotur <somnath.kotur@emulex.com>2013-03-13 22:42:07 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-15 08:56:58 -0400
commit68c45a2da34cb44962c6a48f8e474ec6b7853641 (patch)
treee98dcd8cc1df30d79a3fd9af0159513f600e6985
parent8cef7a7892e7820a825aab28a1bff42ca216e9f0 (diff)
be2net: Use new F/W mailbox cmd to manipulate interrupts.
This is needed as the earlier method of manipulating this register via PCI Config space is disallowed by certain Hypervisors. Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c25
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h8
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c25
3 files changed, 50 insertions, 8 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 6ed46396bb36..99163646113f 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -3202,6 +3202,31 @@ err:
3202 return status; 3202 return status;
3203} 3203}
3204 3204
3205int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable)
3206{
3207 struct be_mcc_wrb *wrb;
3208 struct be_cmd_req_intr_set *req;
3209 int status;
3210
3211 if (mutex_lock_interruptible(&adapter->mbox_lock))
3212 return -1;
3213
3214 wrb = wrb_from_mbox(adapter);
3215
3216 req = embedded_payload(wrb);
3217
3218 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
3219 OPCODE_COMMON_SET_INTERRUPT_ENABLE, sizeof(*req),
3220 wrb, NULL);
3221
3222 req->intr_enabled = intr_enable;
3223
3224 status = be_mbox_notify_wait(adapter);
3225
3226 mutex_unlock(&adapter->mbox_lock);
3227 return status;
3228}
3229
3205int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload, 3230int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
3206 int wrb_payload_size, u16 *cmd_status, u16 *ext_status) 3231 int wrb_payload_size, u16 *cmd_status, u16 *ext_status)
3207{ 3232{
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 6ef4575ce1c8..f2af85517218 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -188,6 +188,7 @@ struct be_mcc_mailbox {
188#define OPCODE_COMMON_GET_BEACON_STATE 70 188#define OPCODE_COMMON_GET_BEACON_STATE 70
189#define OPCODE_COMMON_READ_TRANSRECV_DATA 73 189#define OPCODE_COMMON_READ_TRANSRECV_DATA 73
190#define OPCODE_COMMON_GET_PORT_NAME 77 190#define OPCODE_COMMON_GET_PORT_NAME 77
191#define OPCODE_COMMON_SET_INTERRUPT_ENABLE 89
191#define OPCODE_COMMON_GET_PHY_DETAILS 102 192#define OPCODE_COMMON_GET_PHY_DETAILS 102
192#define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103 193#define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
193#define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121 194#define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
@@ -1791,6 +1792,12 @@ struct be_cmd_enable_disable_vf {
1791 u8 rsvd[3]; 1792 u8 rsvd[3];
1792}; 1793};
1793 1794
1795struct be_cmd_req_intr_set {
1796 struct be_cmd_req_hdr hdr;
1797 u8 intr_enabled;
1798 u8 rsvd[3];
1799};
1800
1794static inline bool check_privilege(struct be_adapter *adapter, u32 flags) 1801static inline bool check_privilege(struct be_adapter *adapter, u32 flags)
1795{ 1802{
1796 return flags & adapter->cmd_privileges ? true : false; 1803 return flags & adapter->cmd_privileges ? true : false;
@@ -1938,3 +1945,4 @@ extern int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps,
1938extern int be_cmd_get_if_id(struct be_adapter *adapter, 1945extern int be_cmd_get_if_id(struct be_adapter *adapter,
1939 struct be_vf_cfg *vf_cfg, int vf_num); 1946 struct be_vf_cfg *vf_cfg, int vf_num);
1940extern int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain); 1947extern int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
1948extern int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index dae7172c2404..c71b180f4678 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -153,17 +153,10 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
153 return 0; 153 return 0;
154} 154}
155 155
156static void be_intr_set(struct be_adapter *adapter, bool enable) 156static void be_reg_intr_set(struct be_adapter *adapter, bool enable)
157{ 157{
158 u32 reg, enabled; 158 u32 reg, enabled;
159 159
160 /* On lancer interrupts can't be controlled via this register */
161 if (lancer_chip(adapter))
162 return;
163
164 if (adapter->eeh_error)
165 return;
166
167 pci_read_config_dword(adapter->pdev, PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET, 160 pci_read_config_dword(adapter->pdev, PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET,
168 &reg); 161 &reg);
169 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; 162 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
@@ -179,6 +172,22 @@ static void be_intr_set(struct be_adapter *adapter, bool enable)
179 PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET, reg); 172 PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET, reg);
180} 173}
181 174
175static void be_intr_set(struct be_adapter *adapter, bool enable)
176{
177 int status = 0;
178
179 /* On lancer interrupts can't be controlled via this register */
180 if (lancer_chip(adapter))
181 return;
182
183 if (adapter->eeh_error)
184 return;
185
186 status = be_cmd_intr_set(adapter, enable);
187 if (status)
188 be_reg_intr_set(adapter, enable);
189}
190
182static void be_rxq_notify(struct be_adapter *adapter, u16 qid, u16 posted) 191static void be_rxq_notify(struct be_adapter *adapter, u16 qid, u16 posted)
183{ 192{
184 u32 val = 0; 193 u32 val = 0;