diff options
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.c | 40 |
2 files changed, 30 insertions, 15 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 894f1a91d9c9..644e8fed8364 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -137,6 +137,11 @@ static inline void *queue_tail_node(struct be_queue_info *q) | |||
137 | return q->dma_mem.va + q->tail * q->entry_size; | 137 | return q->dma_mem.va + q->tail * q->entry_size; |
138 | } | 138 | } |
139 | 139 | ||
140 | static inline void *queue_index_node(struct be_queue_info *q, u16 index) | ||
141 | { | ||
142 | return q->dma_mem.va + index * q->entry_size; | ||
143 | } | ||
144 | |||
140 | static inline void queue_head_inc(struct be_queue_info *q) | 145 | static inline void queue_head_inc(struct be_queue_info *q) |
141 | { | 146 | { |
142 | index_inc(&q->head, q->len); | 147 | index_inc(&q->head, q->len); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 1ac031e21699..6e7b5218c784 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -19,7 +19,12 @@ | |||
19 | #include "be_cmds.h" | 19 | #include "be_cmds.h" |
20 | 20 | ||
21 | /* Must be a power of 2 or else MODULO will BUG_ON */ | 21 | /* Must be a power of 2 or else MODULO will BUG_ON */ |
22 | static int be_get_temp_freq = 32; | 22 | static int be_get_temp_freq = 64; |
23 | |||
24 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) | ||
25 | { | ||
26 | return wrb->payload.embedded_payload; | ||
27 | } | ||
23 | 28 | ||
24 | static void be_mcc_notify(struct be_adapter *adapter) | 29 | static void be_mcc_notify(struct be_adapter *adapter) |
25 | { | 30 | { |
@@ -85,7 +90,20 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
85 | be_parse_stats(adapter); | 90 | be_parse_stats(adapter); |
86 | adapter->stats_cmd_sent = false; | 91 | adapter->stats_cmd_sent = false; |
87 | } | 92 | } |
93 | if (compl->tag0 == | ||
94 | OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES) { | ||
95 | struct be_mcc_wrb *mcc_wrb = | ||
96 | queue_index_node(&adapter->mcc_obj.q, | ||
97 | compl->tag1); | ||
98 | struct be_cmd_resp_get_cntl_addnl_attribs *resp = | ||
99 | embedded_payload(mcc_wrb); | ||
100 | adapter->drv_stats.be_on_die_temperature = | ||
101 | resp->on_die_temperature; | ||
102 | } | ||
88 | } else { | 103 | } else { |
104 | if (compl->tag0 == OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES) | ||
105 | be_get_temp_freq = 0; | ||
106 | |||
89 | if (compl_status == MCC_STATUS_NOT_SUPPORTED || | 107 | if (compl_status == MCC_STATUS_NOT_SUPPORTED || |
90 | compl_status == MCC_STATUS_ILLEGAL_REQUEST) | 108 | compl_status == MCC_STATUS_ILLEGAL_REQUEST) |
91 | goto done; | 109 | goto done; |
@@ -404,10 +422,6 @@ int be_cmd_POST(struct be_adapter *adapter) | |||
404 | return -1; | 422 | return -1; |
405 | } | 423 | } |
406 | 424 | ||
407 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) | ||
408 | { | ||
409 | return wrb->payload.embedded_payload; | ||
410 | } | ||
411 | 425 | ||
412 | static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) | 426 | static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) |
413 | { | 427 | { |
@@ -1301,10 +1315,13 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter) | |||
1301 | { | 1315 | { |
1302 | struct be_mcc_wrb *wrb; | 1316 | struct be_mcc_wrb *wrb; |
1303 | struct be_cmd_req_get_cntl_addnl_attribs *req; | 1317 | struct be_cmd_req_get_cntl_addnl_attribs *req; |
1318 | u16 mccq_index; | ||
1304 | int status; | 1319 | int status; |
1305 | 1320 | ||
1306 | spin_lock_bh(&adapter->mcc_lock); | 1321 | spin_lock_bh(&adapter->mcc_lock); |
1307 | 1322 | ||
1323 | mccq_index = adapter->mcc_obj.q.head; | ||
1324 | |||
1308 | wrb = wrb_from_mccq(adapter); | 1325 | wrb = wrb_from_mccq(adapter); |
1309 | if (!wrb) { | 1326 | if (!wrb) { |
1310 | status = -EBUSY; | 1327 | status = -EBUSY; |
@@ -1318,16 +1335,9 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter) | |||
1318 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, | 1335 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
1319 | OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES, sizeof(*req)); | 1336 | OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES, sizeof(*req)); |
1320 | 1337 | ||
1321 | status = be_mcc_notify_wait(adapter); | 1338 | wrb->tag1 = mccq_index; |
1322 | if (!status) { | 1339 | |
1323 | struct be_cmd_resp_get_cntl_addnl_attribs *resp = | 1340 | be_mcc_notify(adapter); |
1324 | embedded_payload(wrb); | ||
1325 | adapter->drv_stats.be_on_die_temperature = | ||
1326 | resp->on_die_temperature; | ||
1327 | } | ||
1328 | /* If IOCTL fails once, do not bother issuing it again */ | ||
1329 | else | ||
1330 | be_get_temp_freq = 0; | ||
1331 | 1341 | ||
1332 | err: | 1342 | err: |
1333 | spin_unlock_bh(&adapter->mcc_lock); | 1343 | spin_unlock_bh(&adapter->mcc_lock); |