diff options
author | Shahed Shaikh <shahed.shaikh@qlogic.com> | 2012-11-23 18:56:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-25 16:12:59 -0500 |
commit | 63507592e3524405ce8b4887b61ebb3b60c10de2 (patch) | |
tree | 1baa0c46b0e202a95a64077703efaa6e03207271 | |
parent | 82167cb8c6b2f8166d5c7532e5ef4b5e0cc46a72 (diff) |
qlcnic: fix sparse check endian warnings
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 224 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 46 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 52 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | 192 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 |
6 files changed, 300 insertions, 221 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 8b3d3b388735..ec29f7988d42 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -280,16 +280,16 @@ struct status_desc { | |||
280 | #define QLCNIC_UNI_FIRMWARE_IDX_OFF 29 | 280 | #define QLCNIC_UNI_FIRMWARE_IDX_OFF 29 |
281 | 281 | ||
282 | struct uni_table_desc{ | 282 | struct uni_table_desc{ |
283 | u32 findex; | 283 | __le32 findex; |
284 | u32 num_entries; | 284 | __le32 num_entries; |
285 | u32 entry_size; | 285 | __le32 entry_size; |
286 | u32 reserved[5]; | 286 | __le32 reserved[5]; |
287 | }; | 287 | }; |
288 | 288 | ||
289 | struct uni_data_desc{ | 289 | struct uni_data_desc{ |
290 | u32 findex; | 290 | __le32 findex; |
291 | u32 size; | 291 | __le32 size; |
292 | u32 reserved[5]; | 292 | __le32 reserved[5]; |
293 | }; | 293 | }; |
294 | 294 | ||
295 | /* Flash Defines and Structures */ | 295 | /* Flash Defines and Structures */ |
@@ -416,19 +416,19 @@ struct qlcnic_nic_intr_coalesce { | |||
416 | }; | 416 | }; |
417 | 417 | ||
418 | struct qlcnic_dump_template_hdr { | 418 | struct qlcnic_dump_template_hdr { |
419 | __le32 type; | 419 | u32 type; |
420 | __le32 offset; | 420 | u32 offset; |
421 | __le32 size; | 421 | u32 size; |
422 | __le32 cap_mask; | 422 | u32 cap_mask; |
423 | __le32 num_entries; | 423 | u32 num_entries; |
424 | __le32 version; | 424 | u32 version; |
425 | __le32 timestamp; | 425 | u32 timestamp; |
426 | __le32 checksum; | 426 | u32 checksum; |
427 | __le32 drv_cap_mask; | 427 | u32 drv_cap_mask; |
428 | __le32 sys_info[3]; | 428 | u32 sys_info[3]; |
429 | __le32 saved_state[16]; | 429 | u32 saved_state[16]; |
430 | __le32 cap_sizes[8]; | 430 | u32 cap_sizes[8]; |
431 | __le32 rsvd[0]; | 431 | u32 rsvd[0]; |
432 | }; | 432 | }; |
433 | 433 | ||
434 | struct qlcnic_fw_dump { | 434 | struct qlcnic_fw_dump { |
@@ -1065,16 +1065,16 @@ struct qlcnic_adapter { | |||
1065 | 1065 | ||
1066 | spinlock_t tx_clean_lock; | 1066 | spinlock_t tx_clean_lock; |
1067 | spinlock_t mac_learn_lock; | 1067 | spinlock_t mac_learn_lock; |
1068 | __le32 file_prd_off; /*File fw product offset*/ | 1068 | u32 file_prd_off; /*File fw product offset*/ |
1069 | u32 fw_version; | 1069 | u32 fw_version; |
1070 | const struct firmware *fw; | 1070 | const struct firmware *fw; |
1071 | }; | 1071 | }; |
1072 | 1072 | ||
1073 | struct qlcnic_info { | 1073 | struct qlcnic_info_le { |
1074 | __le16 pci_func; | 1074 | __le16 pci_func; |
1075 | __le16 op_mode; /* 1 = Priv, 2 = NP, 3 = NP passthru */ | 1075 | __le16 op_mode; /* 1 = Priv, 2 = NP, 3 = NP passthru */ |
1076 | __le16 phys_port; | 1076 | __le16 phys_port; |
1077 | __le16 switch_mode; /* 0 = disabled, 1 = int, 2 = ext */ | 1077 | __le16 switch_mode; /* 0 = disabled, 1 = int, 2 = ext */ |
1078 | 1078 | ||
1079 | __le32 capabilities; | 1079 | __le32 capabilities; |
1080 | u8 max_mac_filters; | 1080 | u8 max_mac_filters; |
@@ -1088,13 +1088,28 @@ struct qlcnic_info { | |||
1088 | u8 reserved2[104]; | 1088 | u8 reserved2[104]; |
1089 | } __packed; | 1089 | } __packed; |
1090 | 1090 | ||
1091 | struct qlcnic_pci_info { | 1091 | struct qlcnic_info { |
1092 | __le16 id; /* pci function id */ | 1092 | u16 pci_func; |
1093 | __le16 active; /* 1 = Enabled */ | 1093 | u16 op_mode; |
1094 | __le16 type; /* 1 = NIC, 2 = FCoE, 3 = iSCSI */ | 1094 | u16 phys_port; |
1095 | __le16 default_port; /* default port number */ | 1095 | u16 switch_mode; |
1096 | u32 capabilities; | ||
1097 | u8 max_mac_filters; | ||
1098 | u8 reserved1; | ||
1099 | u16 max_mtu; | ||
1100 | u16 max_tx_ques; | ||
1101 | u16 max_rx_ques; | ||
1102 | u16 min_tx_bw; | ||
1103 | u16 max_tx_bw; | ||
1104 | }; | ||
1096 | 1105 | ||
1097 | __le16 tx_min_bw; /* Multiple of 100mbpc */ | 1106 | struct qlcnic_pci_info_le { |
1107 | __le16 id; /* pci function id */ | ||
1108 | __le16 active; /* 1 = Enabled */ | ||
1109 | __le16 type; /* 1 = NIC, 2 = FCoE, 3 = iSCSI */ | ||
1110 | __le16 default_port; /* default port number */ | ||
1111 | |||
1112 | __le16 tx_min_bw; /* Multiple of 100mbpc */ | ||
1098 | __le16 tx_max_bw; | 1113 | __le16 tx_max_bw; |
1099 | __le16 reserved1[2]; | 1114 | __le16 reserved1[2]; |
1100 | 1115 | ||
@@ -1102,6 +1117,16 @@ struct qlcnic_pci_info { | |||
1102 | u8 reserved2[106]; | 1117 | u8 reserved2[106]; |
1103 | } __packed; | 1118 | } __packed; |
1104 | 1119 | ||
1120 | struct qlcnic_pci_info { | ||
1121 | u16 id; | ||
1122 | u16 active; | ||
1123 | u16 type; | ||
1124 | u16 default_port; | ||
1125 | u16 tx_min_bw; | ||
1126 | u16 tx_max_bw; | ||
1127 | u8 mac[ETH_ALEN]; | ||
1128 | }; | ||
1129 | |||
1105 | struct qlcnic_npar_info { | 1130 | struct qlcnic_npar_info { |
1106 | u16 pvid; | 1131 | u16 pvid; |
1107 | u16 min_bw; | 1132 | u16 min_bw; |
@@ -1208,7 +1233,7 @@ do { \ | |||
1208 | (VAL1) += (VAL2); \ | 1233 | (VAL1) += (VAL2); \ |
1209 | } while (0) | 1234 | } while (0) |
1210 | 1235 | ||
1211 | struct qlcnic_mac_statistics{ | 1236 | struct qlcnic_mac_statistics_le { |
1212 | __le64 mac_tx_frames; | 1237 | __le64 mac_tx_frames; |
1213 | __le64 mac_tx_bytes; | 1238 | __le64 mac_tx_bytes; |
1214 | __le64 mac_tx_mcast_pkts; | 1239 | __le64 mac_tx_mcast_pkts; |
@@ -1248,7 +1273,45 @@ struct qlcnic_mac_statistics{ | |||
1248 | __le64 mac_align_error; | 1273 | __le64 mac_align_error; |
1249 | } __packed; | 1274 | } __packed; |
1250 | 1275 | ||
1251 | struct __qlcnic_esw_statistics { | 1276 | struct qlcnic_mac_statistics { |
1277 | u64 mac_tx_frames; | ||
1278 | u64 mac_tx_bytes; | ||
1279 | u64 mac_tx_mcast_pkts; | ||
1280 | u64 mac_tx_bcast_pkts; | ||
1281 | u64 mac_tx_pause_cnt; | ||
1282 | u64 mac_tx_ctrl_pkt; | ||
1283 | u64 mac_tx_lt_64b_pkts; | ||
1284 | u64 mac_tx_lt_127b_pkts; | ||
1285 | u64 mac_tx_lt_255b_pkts; | ||
1286 | u64 mac_tx_lt_511b_pkts; | ||
1287 | u64 mac_tx_lt_1023b_pkts; | ||
1288 | u64 mac_tx_lt_1518b_pkts; | ||
1289 | u64 mac_tx_gt_1518b_pkts; | ||
1290 | u64 rsvd1[3]; | ||
1291 | u64 mac_rx_frames; | ||
1292 | u64 mac_rx_bytes; | ||
1293 | u64 mac_rx_mcast_pkts; | ||
1294 | u64 mac_rx_bcast_pkts; | ||
1295 | u64 mac_rx_pause_cnt; | ||
1296 | u64 mac_rx_ctrl_pkt; | ||
1297 | u64 mac_rx_lt_64b_pkts; | ||
1298 | u64 mac_rx_lt_127b_pkts; | ||
1299 | u64 mac_rx_lt_255b_pkts; | ||
1300 | u64 mac_rx_lt_511b_pkts; | ||
1301 | u64 mac_rx_lt_1023b_pkts; | ||
1302 | u64 mac_rx_lt_1518b_pkts; | ||
1303 | u64 mac_rx_gt_1518b_pkts; | ||
1304 | u64 rsvd2[3]; | ||
1305 | u64 mac_rx_length_error; | ||
1306 | u64 mac_rx_length_small; | ||
1307 | u64 mac_rx_length_large; | ||
1308 | u64 mac_rx_jabber; | ||
1309 | u64 mac_rx_dropped; | ||
1310 | u64 mac_rx_crc_error; | ||
1311 | u64 mac_align_error; | ||
1312 | }; | ||
1313 | |||
1314 | struct qlcnic_esw_stats_le { | ||
1252 | __le16 context_id; | 1315 | __le16 context_id; |
1253 | __le16 version; | 1316 | __le16 version; |
1254 | __le16 size; | 1317 | __le16 size; |
@@ -1263,54 +1326,69 @@ struct __qlcnic_esw_statistics { | |||
1263 | __le64 rsvd[3]; | 1326 | __le64 rsvd[3]; |
1264 | } __packed; | 1327 | } __packed; |
1265 | 1328 | ||
1329 | struct __qlcnic_esw_statistics { | ||
1330 | u16 context_id; | ||
1331 | u16 version; | ||
1332 | u16 size; | ||
1333 | u16 unused; | ||
1334 | u64 unicast_frames; | ||
1335 | u64 multicast_frames; | ||
1336 | u64 broadcast_frames; | ||
1337 | u64 dropped_frames; | ||
1338 | u64 errors; | ||
1339 | u64 local_frames; | ||
1340 | u64 numbytes; | ||
1341 | u64 rsvd[3]; | ||
1342 | }; | ||
1343 | |||
1266 | struct qlcnic_esw_statistics { | 1344 | struct qlcnic_esw_statistics { |
1267 | struct __qlcnic_esw_statistics rx; | 1345 | struct __qlcnic_esw_statistics rx; |
1268 | struct __qlcnic_esw_statistics tx; | 1346 | struct __qlcnic_esw_statistics tx; |
1269 | }; | 1347 | }; |
1270 | 1348 | ||
1271 | struct qlcnic_common_entry_hdr { | 1349 | struct qlcnic_common_entry_hdr { |
1272 | __le32 type; | 1350 | u32 type; |
1273 | __le32 offset; | 1351 | u32 offset; |
1274 | __le32 cap_size; | 1352 | u32 cap_size; |
1275 | u8 mask; | 1353 | u8 mask; |
1276 | u8 rsvd[2]; | 1354 | u8 rsvd[2]; |
1277 | u8 flags; | 1355 | u8 flags; |
1278 | } __packed; | 1356 | } __packed; |
1279 | 1357 | ||
1280 | struct __crb { | 1358 | struct __crb { |
1281 | __le32 addr; | 1359 | u32 addr; |
1282 | u8 stride; | 1360 | u8 stride; |
1283 | u8 rsvd1[3]; | 1361 | u8 rsvd1[3]; |
1284 | __le32 data_size; | 1362 | u32 data_size; |
1285 | __le32 no_ops; | 1363 | u32 no_ops; |
1286 | __le32 rsvd2[4]; | 1364 | u32 rsvd2[4]; |
1287 | } __packed; | 1365 | } __packed; |
1288 | 1366 | ||
1289 | struct __ctrl { | 1367 | struct __ctrl { |
1290 | __le32 addr; | 1368 | u32 addr; |
1291 | u8 stride; | 1369 | u8 stride; |
1292 | u8 index_a; | 1370 | u8 index_a; |
1293 | __le16 timeout; | 1371 | u16 timeout; |
1294 | __le32 data_size; | 1372 | u32 data_size; |
1295 | __le32 no_ops; | 1373 | u32 no_ops; |
1296 | u8 opcode; | 1374 | u8 opcode; |
1297 | u8 index_v; | 1375 | u8 index_v; |
1298 | u8 shl_val; | 1376 | u8 shl_val; |
1299 | u8 shr_val; | 1377 | u8 shr_val; |
1300 | __le32 val1; | 1378 | u32 val1; |
1301 | __le32 val2; | 1379 | u32 val2; |
1302 | __le32 val3; | 1380 | u32 val3; |
1303 | } __packed; | 1381 | } __packed; |
1304 | 1382 | ||
1305 | struct __cache { | 1383 | struct __cache { |
1306 | __le32 addr; | 1384 | u32 addr; |
1307 | __le16 stride; | 1385 | u16 stride; |
1308 | __le16 init_tag_val; | 1386 | u16 init_tag_val; |
1309 | __le32 size; | 1387 | u32 size; |
1310 | __le32 no_ops; | 1388 | u32 no_ops; |
1311 | __le32 ctrl_addr; | 1389 | u32 ctrl_addr; |
1312 | __le32 ctrl_val; | 1390 | u32 ctrl_val; |
1313 | __le32 read_addr; | 1391 | u32 read_addr; |
1314 | u8 read_addr_stride; | 1392 | u8 read_addr_stride; |
1315 | u8 read_addr_num; | 1393 | u8 read_addr_num; |
1316 | u8 rsvd1[2]; | 1394 | u8 rsvd1[2]; |
@@ -1318,38 +1396,38 @@ struct __cache { | |||
1318 | 1396 | ||
1319 | struct __ocm { | 1397 | struct __ocm { |
1320 | u8 rsvd[8]; | 1398 | u8 rsvd[8]; |
1321 | __le32 size; | 1399 | u32 size; |
1322 | __le32 no_ops; | 1400 | u32 no_ops; |
1323 | u8 rsvd1[8]; | 1401 | u8 rsvd1[8]; |
1324 | __le32 read_addr; | 1402 | u32 read_addr; |
1325 | __le32 read_addr_stride; | 1403 | u32 read_addr_stride; |
1326 | } __packed; | 1404 | } __packed; |
1327 | 1405 | ||
1328 | struct __mem { | 1406 | struct __mem { |
1329 | u8 rsvd[24]; | 1407 | u8 rsvd[24]; |
1330 | __le32 addr; | 1408 | u32 addr; |
1331 | __le32 size; | 1409 | u32 size; |
1332 | } __packed; | 1410 | } __packed; |
1333 | 1411 | ||
1334 | struct __mux { | 1412 | struct __mux { |
1335 | __le32 addr; | 1413 | u32 addr; |
1336 | u8 rsvd[4]; | 1414 | u8 rsvd[4]; |
1337 | __le32 size; | 1415 | u32 size; |
1338 | __le32 no_ops; | 1416 | u32 no_ops; |
1339 | __le32 val; | 1417 | u32 val; |
1340 | __le32 val_stride; | 1418 | u32 val_stride; |
1341 | __le32 read_addr; | 1419 | u32 read_addr; |
1342 | u8 rsvd2[4]; | 1420 | u8 rsvd2[4]; |
1343 | } __packed; | 1421 | } __packed; |
1344 | 1422 | ||
1345 | struct __queue { | 1423 | struct __queue { |
1346 | __le32 sel_addr; | 1424 | u32 sel_addr; |
1347 | __le16 stride; | 1425 | u16 stride; |
1348 | u8 rsvd[2]; | 1426 | u8 rsvd[2]; |
1349 | __le32 size; | 1427 | u32 size; |
1350 | __le32 no_ops; | 1428 | u32 no_ops; |
1351 | u8 rsvd2[8]; | 1429 | u8 rsvd2[8]; |
1352 | __le32 read_addr; | 1430 | u32 read_addr; |
1353 | u8 read_addr_stride; | 1431 | u8 read_addr_stride; |
1354 | u8 read_addr_cnt; | 1432 | u8 read_addr_cnt; |
1355 | u8 rsvd3[2]; | 1433 | u8 rsvd3[2]; |
@@ -1413,8 +1491,8 @@ enum op_codes { | |||
1413 | 1491 | ||
1414 | struct qlcnic_dump_operations { | 1492 | struct qlcnic_dump_operations { |
1415 | enum op_codes opcode; | 1493 | enum op_codes opcode; |
1416 | u32 (*handler)(struct qlcnic_adapter *, | 1494 | u32 (*handler)(struct qlcnic_adapter *, struct qlcnic_dump_entry *, |
1417 | struct qlcnic_dump_entry *, u32 *); | 1495 | __le32 *); |
1418 | }; | 1496 | }; |
1419 | 1497 | ||
1420 | struct _cdrp_cmd { | 1498 | struct _cdrp_cmd { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index bbd3b303360f..bd31104557b4 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -103,7 +103,7 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) | |||
103 | 103 | ||
104 | } | 104 | } |
105 | 105 | ||
106 | static uint32_t qlcnic_temp_checksum(uint32_t *temp_buffer, u16 temp_size) | 106 | static uint32_t qlcnic_temp_checksum(uint32_t *temp_buffer, u32 temp_size) |
107 | { | 107 | { |
108 | uint64_t sum = 0; | 108 | uint64_t sum = 0; |
109 | int count = temp_size / sizeof(uint32_t); | 109 | int count = temp_size / sizeof(uint32_t); |
@@ -117,9 +117,9 @@ static uint32_t qlcnic_temp_checksum(uint32_t *temp_buffer, u16 temp_size) | |||
117 | int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter) | 117 | int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter) |
118 | { | 118 | { |
119 | int err, i; | 119 | int err, i; |
120 | u16 temp_size; | ||
121 | void *tmp_addr; | 120 | void *tmp_addr; |
122 | u32 version, csum, *template, *tmp_buf; | 121 | u32 temp_size, version, csum, *template; |
122 | __le32 *tmp_buf; | ||
123 | struct qlcnic_cmd_args cmd; | 123 | struct qlcnic_cmd_args cmd; |
124 | struct qlcnic_hardware_context *ahw; | 124 | struct qlcnic_hardware_context *ahw; |
125 | struct qlcnic_dump_template_hdr *tmpl_hdr, *tmp_tmpl; | 125 | struct qlcnic_dump_template_hdr *tmpl_hdr, *tmp_tmpl; |
@@ -163,13 +163,6 @@ int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter) | |||
163 | goto error; | 163 | goto error; |
164 | } | 164 | } |
165 | tmp_tmpl = tmp_addr; | 165 | tmp_tmpl = tmp_addr; |
166 | csum = qlcnic_temp_checksum((uint32_t *) tmp_addr, temp_size); | ||
167 | if (csum) { | ||
168 | dev_err(&adapter->pdev->dev, | ||
169 | "Template header checksum validation failed\n"); | ||
170 | err = -EIO; | ||
171 | goto error; | ||
172 | } | ||
173 | ahw->fw_dump.tmpl_hdr = vzalloc(temp_size); | 166 | ahw->fw_dump.tmpl_hdr = vzalloc(temp_size); |
174 | if (!ahw->fw_dump.tmpl_hdr) { | 167 | if (!ahw->fw_dump.tmpl_hdr) { |
175 | err = -EIO; | 168 | err = -EIO; |
@@ -180,6 +173,14 @@ int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter) | |||
180 | for (i = 0; i < temp_size/sizeof(u32); i++) | 173 | for (i = 0; i < temp_size/sizeof(u32); i++) |
181 | *template++ = __le32_to_cpu(*tmp_buf++); | 174 | *template++ = __le32_to_cpu(*tmp_buf++); |
182 | 175 | ||
176 | csum = qlcnic_temp_checksum((u32 *)ahw->fw_dump.tmpl_hdr, temp_size); | ||
177 | if (csum) { | ||
178 | dev_err(&adapter->pdev->dev, | ||
179 | "Template header checksum validation failed\n"); | ||
180 | err = -EIO; | ||
181 | goto error; | ||
182 | } | ||
183 | |||
183 | tmpl_hdr = ahw->fw_dump.tmpl_hdr; | 184 | tmpl_hdr = ahw->fw_dump.tmpl_hdr; |
184 | tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; | 185 | tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; |
185 | ahw->fw_dump.enable = 1; | 186 | ahw->fw_dump.enable = 1; |
@@ -231,6 +232,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
231 | size_t rq_size, rsp_size; | 232 | size_t rq_size, rsp_size; |
232 | u32 cap, reg, val, reg2; | 233 | u32 cap, reg, val, reg2; |
233 | int err; | 234 | int err; |
235 | u16 temp; | ||
234 | 236 | ||
235 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 237 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
236 | 238 | ||
@@ -267,8 +269,8 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
267 | if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) | 269 | if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) |
268 | cap |= QLCNIC_CAP0_LRO_MSS; | 270 | cap |= QLCNIC_CAP0_LRO_MSS; |
269 | 271 | ||
270 | prq->valid_field_offset = offsetof(struct qlcnic_hostrq_rx_ctx, | 272 | temp = offsetof(struct qlcnic_hostrq_rx_ctx, msix_handler); |
271 | msix_handler); | 273 | prq->valid_field_offset = cpu_to_le16(temp); |
272 | prq->txrx_sds_binding = nsds_rings - 1; | 274 | prq->txrx_sds_binding = nsds_rings - 1; |
273 | 275 | ||
274 | prq->capabilities[0] = cpu_to_le32(cap); | 276 | prq->capabilities[0] = cpu_to_le32(cap); |
@@ -687,10 +689,10 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, | |||
687 | { | 689 | { |
688 | int err; | 690 | int err; |
689 | dma_addr_t nic_dma_t; | 691 | dma_addr_t nic_dma_t; |
690 | struct qlcnic_info *nic_info; | 692 | struct qlcnic_info_le *nic_info; |
691 | void *nic_info_addr; | 693 | void *nic_info_addr; |
692 | struct qlcnic_cmd_args cmd; | 694 | struct qlcnic_cmd_args cmd; |
693 | size_t nic_size = sizeof(struct qlcnic_info); | 695 | size_t nic_size = sizeof(struct qlcnic_info_le); |
694 | 696 | ||
695 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, | 697 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, |
696 | &nic_dma_t, GFP_KERNEL); | 698 | &nic_dma_t, GFP_KERNEL); |
@@ -745,8 +747,8 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) | |||
745 | dma_addr_t nic_dma_t; | 747 | dma_addr_t nic_dma_t; |
746 | void *nic_info_addr; | 748 | void *nic_info_addr; |
747 | struct qlcnic_cmd_args cmd; | 749 | struct qlcnic_cmd_args cmd; |
748 | struct qlcnic_info *nic_info; | 750 | struct qlcnic_info_le *nic_info; |
749 | size_t nic_size = sizeof(struct qlcnic_info); | 751 | size_t nic_size = sizeof(struct qlcnic_info_le); |
750 | 752 | ||
751 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) | 753 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) |
752 | return err; | 754 | return err; |
@@ -796,9 +798,9 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter, | |||
796 | int err = 0, i; | 798 | int err = 0, i; |
797 | struct qlcnic_cmd_args cmd; | 799 | struct qlcnic_cmd_args cmd; |
798 | dma_addr_t pci_info_dma_t; | 800 | dma_addr_t pci_info_dma_t; |
799 | struct qlcnic_pci_info *npar; | 801 | struct qlcnic_pci_info_le *npar; |
800 | void *pci_info_addr; | 802 | void *pci_info_addr; |
801 | size_t npar_size = sizeof(struct qlcnic_pci_info); | 803 | size_t npar_size = sizeof(struct qlcnic_pci_info_le); |
802 | size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; | 804 | size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; |
803 | 805 | ||
804 | pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size, | 806 | pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size, |
@@ -877,8 +879,8 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id, | |||
877 | int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | 879 | int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, |
878 | const u8 rx_tx, struct __qlcnic_esw_statistics *esw_stats) { | 880 | const u8 rx_tx, struct __qlcnic_esw_statistics *esw_stats) { |
879 | 881 | ||
880 | size_t stats_size = sizeof(struct __qlcnic_esw_statistics); | 882 | size_t stats_size = sizeof(struct qlcnic_esw_stats_le); |
881 | struct __qlcnic_esw_statistics *stats; | 883 | struct qlcnic_esw_stats_le *stats; |
882 | dma_addr_t stats_dma_t; | 884 | dma_addr_t stats_dma_t; |
883 | void *stats_addr; | 885 | void *stats_addr; |
884 | u32 arg1; | 886 | u32 arg1; |
@@ -939,9 +941,9 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
939 | int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter, | 941 | int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter, |
940 | struct qlcnic_mac_statistics *mac_stats) | 942 | struct qlcnic_mac_statistics *mac_stats) |
941 | { | 943 | { |
942 | struct qlcnic_mac_statistics *stats; | 944 | struct qlcnic_mac_statistics_le *stats; |
943 | struct qlcnic_cmd_args cmd; | 945 | struct qlcnic_cmd_args cmd; |
944 | size_t stats_size = sizeof(struct qlcnic_mac_statistics); | 946 | size_t stats_size = sizeof(struct qlcnic_mac_statistics_le); |
945 | dma_addr_t stats_dma_t; | 947 | dma_addr_t stats_dma_t; |
946 | void *stats_addr; | 948 | void *stats_addr; |
947 | int err; | 949 | int err; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 9e9e78a5c4d7..4a9425b56edc 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -1247,7 +1247,8 @@ qlcnic_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump, | |||
1247 | void *buffer) | 1247 | void *buffer) |
1248 | { | 1248 | { |
1249 | int i, copy_sz; | 1249 | int i, copy_sz; |
1250 | u32 *hdr_ptr, *data; | 1250 | u32 *hdr_ptr; |
1251 | __le32 *data; | ||
1251 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1252 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1252 | struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump; | 1253 | struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump; |
1253 | 1254 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index bd3e76643799..aeacf1deea47 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | |||
@@ -1349,9 +1349,8 @@ int qlcnic_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate) | |||
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | /* FW dump related functions */ | 1351 | /* FW dump related functions */ |
1352 | static u32 | 1352 | static u32 qlcnic_dump_crb(struct qlcnic_adapter *adapter, |
1353 | qlcnic_dump_crb(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | 1353 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1354 | u32 *buffer) | ||
1355 | { | 1354 | { |
1356 | int i; | 1355 | int i; |
1357 | u32 addr, data; | 1356 | u32 addr, data; |
@@ -1369,9 +1368,8 @@ qlcnic_dump_crb(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | |||
1369 | return crb->no_ops * 2 * sizeof(u32); | 1368 | return crb->no_ops * 2 * sizeof(u32); |
1370 | } | 1369 | } |
1371 | 1370 | ||
1372 | static u32 | 1371 | static u32 qlcnic_dump_ctrl(struct qlcnic_adapter *adapter, |
1373 | qlcnic_dump_ctrl(struct qlcnic_adapter *adapter, | 1372 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1374 | struct qlcnic_dump_entry *entry, u32 *buffer) | ||
1375 | { | 1373 | { |
1376 | int i, k, timeout = 0; | 1374 | int i, k, timeout = 0; |
1377 | void __iomem *base = adapter->ahw->pci_base0; | 1375 | void __iomem *base = adapter->ahw->pci_base0; |
@@ -1457,9 +1455,8 @@ qlcnic_dump_ctrl(struct qlcnic_adapter *adapter, | |||
1457 | return 0; | 1455 | return 0; |
1458 | } | 1456 | } |
1459 | 1457 | ||
1460 | static u32 | 1458 | static u32 qlcnic_dump_mux(struct qlcnic_adapter *adapter, |
1461 | qlcnic_dump_mux(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | 1459 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1462 | u32 *buffer) | ||
1463 | { | 1460 | { |
1464 | int loop; | 1461 | int loop; |
1465 | u32 val, data = 0; | 1462 | u32 val, data = 0; |
@@ -1477,9 +1474,8 @@ qlcnic_dump_mux(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | |||
1477 | return 2 * mux->no_ops * sizeof(u32); | 1474 | return 2 * mux->no_ops * sizeof(u32); |
1478 | } | 1475 | } |
1479 | 1476 | ||
1480 | static u32 | 1477 | static u32 qlcnic_dump_que(struct qlcnic_adapter *adapter, |
1481 | qlcnic_dump_que(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | 1478 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1482 | u32 *buffer) | ||
1483 | { | 1479 | { |
1484 | int i, loop; | 1480 | int i, loop; |
1485 | u32 cnt, addr, data, que_id = 0; | 1481 | u32 cnt, addr, data, que_id = 0; |
@@ -1502,9 +1498,8 @@ qlcnic_dump_que(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | |||
1502 | return que->no_ops * cnt * sizeof(u32); | 1498 | return que->no_ops * cnt * sizeof(u32); |
1503 | } | 1499 | } |
1504 | 1500 | ||
1505 | static u32 | 1501 | static u32 qlcnic_dump_ocm(struct qlcnic_adapter *adapter, |
1506 | qlcnic_dump_ocm(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | 1502 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1507 | u32 *buffer) | ||
1508 | { | 1503 | { |
1509 | int i; | 1504 | int i; |
1510 | u32 data; | 1505 | u32 data; |
@@ -1520,9 +1515,8 @@ qlcnic_dump_ocm(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | |||
1520 | return ocm->no_ops * sizeof(u32); | 1515 | return ocm->no_ops * sizeof(u32); |
1521 | } | 1516 | } |
1522 | 1517 | ||
1523 | static u32 | 1518 | static u32 qlcnic_read_rom(struct qlcnic_adapter *adapter, |
1524 | qlcnic_read_rom(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | 1519 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1525 | u32 *buffer) | ||
1526 | { | 1520 | { |
1527 | int i, count = 0; | 1521 | int i, count = 0; |
1528 | u32 fl_addr, size, val, lck_val, addr; | 1522 | u32 fl_addr, size, val, lck_val, addr; |
@@ -1551,9 +1545,8 @@ lock_try: | |||
1551 | return rom->size; | 1545 | return rom->size; |
1552 | } | 1546 | } |
1553 | 1547 | ||
1554 | static u32 | 1548 | static u32 qlcnic_dump_l1_cache(struct qlcnic_adapter *adapter, |
1555 | qlcnic_dump_l1_cache(struct qlcnic_adapter *adapter, | 1549 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1556 | struct qlcnic_dump_entry *entry, u32 *buffer) | ||
1557 | { | 1550 | { |
1558 | int i; | 1551 | int i; |
1559 | u32 cnt, val, data, addr; | 1552 | u32 cnt, val, data, addr; |
@@ -1578,9 +1571,8 @@ qlcnic_dump_l1_cache(struct qlcnic_adapter *adapter, | |||
1578 | return l1->no_ops * l1->read_addr_num * sizeof(u32); | 1571 | return l1->no_ops * l1->read_addr_num * sizeof(u32); |
1579 | } | 1572 | } |
1580 | 1573 | ||
1581 | static u32 | 1574 | static u32 qlcnic_dump_l2_cache(struct qlcnic_adapter *adapter, |
1582 | qlcnic_dump_l2_cache(struct qlcnic_adapter *adapter, | 1575 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1583 | struct qlcnic_dump_entry *entry, u32 *buffer) | ||
1584 | { | 1576 | { |
1585 | int i; | 1577 | int i; |
1586 | u32 cnt, val, data, addr; | 1578 | u32 cnt, val, data, addr; |
@@ -1627,9 +1619,8 @@ skip_poll: | |||
1627 | return l2->no_ops * l2->read_addr_num * sizeof(u32); | 1619 | return l2->no_ops * l2->read_addr_num * sizeof(u32); |
1628 | } | 1620 | } |
1629 | 1621 | ||
1630 | static u32 | 1622 | static u32 qlcnic_read_memory(struct qlcnic_adapter *adapter, |
1631 | qlcnic_read_memory(struct qlcnic_adapter *adapter, | 1623 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1632 | struct qlcnic_dump_entry *entry, u32 *buffer) | ||
1633 | { | 1624 | { |
1634 | u32 addr, data, test, ret = 0; | 1625 | u32 addr, data, test, ret = 0; |
1635 | int i, reg_read; | 1626 | int i, reg_read; |
@@ -1681,9 +1672,8 @@ out: | |||
1681 | return mem->size; | 1672 | return mem->size; |
1682 | } | 1673 | } |
1683 | 1674 | ||
1684 | static u32 | 1675 | static u32 qlcnic_dump_nop(struct qlcnic_adapter *adapter, |
1685 | qlcnic_dump_nop(struct qlcnic_adapter *adapter, | 1676 | struct qlcnic_dump_entry *entry, __le32 *buffer) |
1686 | struct qlcnic_dump_entry *entry, u32 *buffer) | ||
1687 | { | 1677 | { |
1688 | entry->hdr.flags |= QLCNIC_DUMP_SKIP; | 1678 | entry->hdr.flags |= QLCNIC_DUMP_SKIP; |
1689 | return 0; | 1679 | return 0; |
@@ -1730,7 +1720,7 @@ qlcnic_valid_dump_entry(struct device *dev, struct qlcnic_dump_entry *entry, | |||
1730 | 1720 | ||
1731 | int qlcnic_dump_fw(struct qlcnic_adapter *adapter) | 1721 | int qlcnic_dump_fw(struct qlcnic_adapter *adapter) |
1732 | { | 1722 | { |
1733 | u32 *buffer; | 1723 | __le32 *buffer; |
1734 | char mesg[64]; | 1724 | char mesg[64]; |
1735 | char *msg[] = {mesg, NULL}; | 1725 | char *msg[] = {mesg, NULL}; |
1736 | int i, k, ops_cnt, ops_index, dump_size = 0; | 1726 | int i, k, ops_cnt, ops_index, dump_size = 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index a7f5bbe24726..ccbef8491d2c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | |||
@@ -778,15 +778,15 @@ qlcnic_has_mn(struct qlcnic_adapter *adapter) | |||
778 | static | 778 | static |
779 | struct uni_table_desc *qlcnic_get_table_desc(const u8 *unirom, int section) | 779 | struct uni_table_desc *qlcnic_get_table_desc(const u8 *unirom, int section) |
780 | { | 780 | { |
781 | u32 i; | 781 | u32 i, entries; |
782 | struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0]; | 782 | struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0]; |
783 | __le32 entries = cpu_to_le32(directory->num_entries); | 783 | entries = le32_to_cpu(directory->num_entries); |
784 | 784 | ||
785 | for (i = 0; i < entries; i++) { | 785 | for (i = 0; i < entries; i++) { |
786 | 786 | ||
787 | __le32 offs = cpu_to_le32(directory->findex) + | 787 | u32 offs = le32_to_cpu(directory->findex) + |
788 | (i * cpu_to_le32(directory->entry_size)); | 788 | i * le32_to_cpu(directory->entry_size); |
789 | __le32 tab_type = cpu_to_le32(*((u32 *)&unirom[offs] + 8)); | 789 | u32 tab_type = le32_to_cpu(*((__le32 *)&unirom[offs] + 8)); |
790 | 790 | ||
791 | if (tab_type == section) | 791 | if (tab_type == section) |
792 | return (struct uni_table_desc *) &unirom[offs]; | 792 | return (struct uni_table_desc *) &unirom[offs]; |
@@ -802,17 +802,16 @@ qlcnic_validate_header(struct qlcnic_adapter *adapter) | |||
802 | { | 802 | { |
803 | const u8 *unirom = adapter->fw->data; | 803 | const u8 *unirom = adapter->fw->data; |
804 | struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0]; | 804 | struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0]; |
805 | __le32 fw_file_size = adapter->fw->size; | 805 | u32 entries, entry_size, tab_size, fw_file_size; |
806 | __le32 entries; | 806 | |
807 | __le32 entry_size; | 807 | fw_file_size = adapter->fw->size; |
808 | __le32 tab_size; | ||
809 | 808 | ||
810 | if (fw_file_size < FILEHEADER_SIZE) | 809 | if (fw_file_size < FILEHEADER_SIZE) |
811 | return -EINVAL; | 810 | return -EINVAL; |
812 | 811 | ||
813 | entries = cpu_to_le32(directory->num_entries); | 812 | entries = le32_to_cpu(directory->num_entries); |
814 | entry_size = cpu_to_le32(directory->entry_size); | 813 | entry_size = le32_to_cpu(directory->entry_size); |
815 | tab_size = cpu_to_le32(directory->findex) + (entries * entry_size); | 814 | tab_size = le32_to_cpu(directory->findex) + (entries * entry_size); |
816 | 815 | ||
817 | if (fw_file_size < tab_size) | 816 | if (fw_file_size < tab_size) |
818 | return -EINVAL; | 817 | return -EINVAL; |
@@ -825,29 +824,29 @@ qlcnic_validate_bootld(struct qlcnic_adapter *adapter) | |||
825 | { | 824 | { |
826 | struct uni_table_desc *tab_desc; | 825 | struct uni_table_desc *tab_desc; |
827 | struct uni_data_desc *descr; | 826 | struct uni_data_desc *descr; |
827 | u32 offs, tab_size, data_size, idx; | ||
828 | const u8 *unirom = adapter->fw->data; | 828 | const u8 *unirom = adapter->fw->data; |
829 | int idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] + | 829 | __le32 temp; |
830 | QLCNIC_UNI_BOOTLD_IDX_OFF)); | ||
831 | __le32 offs; | ||
832 | __le32 tab_size; | ||
833 | __le32 data_size; | ||
834 | 830 | ||
831 | temp = *((__le32 *)&unirom[adapter->file_prd_off] + | ||
832 | QLCNIC_UNI_BOOTLD_IDX_OFF); | ||
833 | idx = le32_to_cpu(temp); | ||
835 | tab_desc = qlcnic_get_table_desc(unirom, QLCNIC_UNI_DIR_SECT_BOOTLD); | 834 | tab_desc = qlcnic_get_table_desc(unirom, QLCNIC_UNI_DIR_SECT_BOOTLD); |
836 | 835 | ||
837 | if (!tab_desc) | 836 | if (!tab_desc) |
838 | return -EINVAL; | 837 | return -EINVAL; |
839 | 838 | ||
840 | tab_size = cpu_to_le32(tab_desc->findex) + | 839 | tab_size = le32_to_cpu(tab_desc->findex) + |
841 | (cpu_to_le32(tab_desc->entry_size) * (idx + 1)); | 840 | le32_to_cpu(tab_desc->entry_size) * (idx + 1); |
842 | 841 | ||
843 | if (adapter->fw->size < tab_size) | 842 | if (adapter->fw->size < tab_size) |
844 | return -EINVAL; | 843 | return -EINVAL; |
845 | 844 | ||
846 | offs = cpu_to_le32(tab_desc->findex) + | 845 | offs = le32_to_cpu(tab_desc->findex) + |
847 | (cpu_to_le32(tab_desc->entry_size) * (idx)); | 846 | le32_to_cpu(tab_desc->entry_size) * idx; |
848 | descr = (struct uni_data_desc *)&unirom[offs]; | 847 | descr = (struct uni_data_desc *)&unirom[offs]; |
849 | 848 | ||
850 | data_size = cpu_to_le32(descr->findex) + cpu_to_le32(descr->size); | 849 | data_size = le32_to_cpu(descr->findex) + le32_to_cpu(descr->size); |
851 | 850 | ||
852 | if (adapter->fw->size < data_size) | 851 | if (adapter->fw->size < data_size) |
853 | return -EINVAL; | 852 | return -EINVAL; |
@@ -861,27 +860,27 @@ qlcnic_validate_fw(struct qlcnic_adapter *adapter) | |||
861 | struct uni_table_desc *tab_desc; | 860 | struct uni_table_desc *tab_desc; |
862 | struct uni_data_desc *descr; | 861 | struct uni_data_desc *descr; |
863 | const u8 *unirom = adapter->fw->data; | 862 | const u8 *unirom = adapter->fw->data; |
864 | int idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] + | 863 | u32 offs, tab_size, data_size, idx; |
865 | QLCNIC_UNI_FIRMWARE_IDX_OFF)); | 864 | __le32 temp; |
866 | __le32 offs; | ||
867 | __le32 tab_size; | ||
868 | __le32 data_size; | ||
869 | 865 | ||
866 | temp = *((__le32 *)&unirom[adapter->file_prd_off] + | ||
867 | QLCNIC_UNI_FIRMWARE_IDX_OFF); | ||
868 | idx = le32_to_cpu(temp); | ||
870 | tab_desc = qlcnic_get_table_desc(unirom, QLCNIC_UNI_DIR_SECT_FW); | 869 | tab_desc = qlcnic_get_table_desc(unirom, QLCNIC_UNI_DIR_SECT_FW); |
871 | 870 | ||
872 | if (!tab_desc) | 871 | if (!tab_desc) |
873 | return -EINVAL; | 872 | return -EINVAL; |
874 | 873 | ||
875 | tab_size = cpu_to_le32(tab_desc->findex) + | 874 | tab_size = le32_to_cpu(tab_desc->findex) + |
876 | (cpu_to_le32(tab_desc->entry_size) * (idx + 1)); | 875 | le32_to_cpu(tab_desc->entry_size) * (idx + 1); |
877 | 876 | ||
878 | if (adapter->fw->size < tab_size) | 877 | if (adapter->fw->size < tab_size) |
879 | return -EINVAL; | 878 | return -EINVAL; |
880 | 879 | ||
881 | offs = cpu_to_le32(tab_desc->findex) + | 880 | offs = le32_to_cpu(tab_desc->findex) + |
882 | (cpu_to_le32(tab_desc->entry_size) * (idx)); | 881 | le32_to_cpu(tab_desc->entry_size) * idx; |
883 | descr = (struct uni_data_desc *)&unirom[offs]; | 882 | descr = (struct uni_data_desc *)&unirom[offs]; |
884 | data_size = cpu_to_le32(descr->findex) + cpu_to_le32(descr->size); | 883 | data_size = le32_to_cpu(descr->findex) + le32_to_cpu(descr->size); |
885 | 884 | ||
886 | if (adapter->fw->size < data_size) | 885 | if (adapter->fw->size < data_size) |
887 | return -EINVAL; | 886 | return -EINVAL; |
@@ -895,19 +894,17 @@ qlcnic_validate_product_offs(struct qlcnic_adapter *adapter) | |||
895 | struct uni_table_desc *ptab_descr; | 894 | struct uni_table_desc *ptab_descr; |
896 | const u8 *unirom = adapter->fw->data; | 895 | const u8 *unirom = adapter->fw->data; |
897 | int mn_present = qlcnic_has_mn(adapter); | 896 | int mn_present = qlcnic_has_mn(adapter); |
898 | __le32 entries; | 897 | u32 entries, entry_size, tab_size, i; |
899 | __le32 entry_size; | 898 | __le32 temp; |
900 | __le32 tab_size; | ||
901 | u32 i; | ||
902 | 899 | ||
903 | ptab_descr = qlcnic_get_table_desc(unirom, | 900 | ptab_descr = qlcnic_get_table_desc(unirom, |
904 | QLCNIC_UNI_DIR_SECT_PRODUCT_TBL); | 901 | QLCNIC_UNI_DIR_SECT_PRODUCT_TBL); |
905 | if (!ptab_descr) | 902 | if (!ptab_descr) |
906 | return -EINVAL; | 903 | return -EINVAL; |
907 | 904 | ||
908 | entries = cpu_to_le32(ptab_descr->num_entries); | 905 | entries = le32_to_cpu(ptab_descr->num_entries); |
909 | entry_size = cpu_to_le32(ptab_descr->entry_size); | 906 | entry_size = le32_to_cpu(ptab_descr->entry_size); |
910 | tab_size = cpu_to_le32(ptab_descr->findex) + (entries * entry_size); | 907 | tab_size = le32_to_cpu(ptab_descr->findex) + (entries * entry_size); |
911 | 908 | ||
912 | if (adapter->fw->size < tab_size) | 909 | if (adapter->fw->size < tab_size) |
913 | return -EINVAL; | 910 | return -EINVAL; |
@@ -915,16 +912,16 @@ qlcnic_validate_product_offs(struct qlcnic_adapter *adapter) | |||
915 | nomn: | 912 | nomn: |
916 | for (i = 0; i < entries; i++) { | 913 | for (i = 0; i < entries; i++) { |
917 | 914 | ||
918 | __le32 flags, file_chiprev, offs; | 915 | u32 flags, file_chiprev, offs; |
919 | u8 chiprev = adapter->ahw->revision_id; | 916 | u8 chiprev = adapter->ahw->revision_id; |
920 | u32 flagbit; | 917 | u32 flagbit; |
921 | 918 | ||
922 | offs = cpu_to_le32(ptab_descr->findex) + | 919 | offs = le32_to_cpu(ptab_descr->findex) + |
923 | (i * cpu_to_le32(ptab_descr->entry_size)); | 920 | i * le32_to_cpu(ptab_descr->entry_size); |
924 | flags = cpu_to_le32(*((int *)&unirom[offs] + | 921 | temp = *((__le32 *)&unirom[offs] + QLCNIC_UNI_FLAGS_OFF); |
925 | QLCNIC_UNI_FLAGS_OFF)); | 922 | flags = le32_to_cpu(temp); |
926 | file_chiprev = cpu_to_le32(*((int *)&unirom[offs] + | 923 | temp = *((__le32 *)&unirom[offs] + QLCNIC_UNI_CHIP_REV_OFF); |
927 | QLCNIC_UNI_CHIP_REV_OFF)); | 924 | file_chiprev = le32_to_cpu(temp); |
928 | 925 | ||
929 | flagbit = mn_present ? 1 : 2; | 926 | flagbit = mn_present ? 1 : 2; |
930 | 927 | ||
@@ -976,18 +973,20 @@ struct uni_data_desc *qlcnic_get_data_desc(struct qlcnic_adapter *adapter, | |||
976 | u32 section, u32 idx_offset) | 973 | u32 section, u32 idx_offset) |
977 | { | 974 | { |
978 | const u8 *unirom = adapter->fw->data; | 975 | const u8 *unirom = adapter->fw->data; |
979 | int idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] + | ||
980 | idx_offset)); | ||
981 | struct uni_table_desc *tab_desc; | 976 | struct uni_table_desc *tab_desc; |
982 | __le32 offs; | 977 | u32 offs, idx; |
978 | __le32 temp; | ||
979 | |||
980 | temp = *((__le32 *)&unirom[adapter->file_prd_off] + idx_offset); | ||
981 | idx = le32_to_cpu(temp); | ||
983 | 982 | ||
984 | tab_desc = qlcnic_get_table_desc(unirom, section); | 983 | tab_desc = qlcnic_get_table_desc(unirom, section); |
985 | 984 | ||
986 | if (tab_desc == NULL) | 985 | if (tab_desc == NULL) |
987 | return NULL; | 986 | return NULL; |
988 | 987 | ||
989 | offs = cpu_to_le32(tab_desc->findex) + | 988 | offs = le32_to_cpu(tab_desc->findex) + |
990 | (cpu_to_le32(tab_desc->entry_size) * idx); | 989 | le32_to_cpu(tab_desc->entry_size) * idx; |
991 | 990 | ||
992 | return (struct uni_data_desc *)&unirom[offs]; | 991 | return (struct uni_data_desc *)&unirom[offs]; |
993 | } | 992 | } |
@@ -996,11 +995,13 @@ static u8 * | |||
996 | qlcnic_get_bootld_offs(struct qlcnic_adapter *adapter) | 995 | qlcnic_get_bootld_offs(struct qlcnic_adapter *adapter) |
997 | { | 996 | { |
998 | u32 offs = QLCNIC_BOOTLD_START; | 997 | u32 offs = QLCNIC_BOOTLD_START; |
998 | struct uni_data_desc *data_desc; | ||
999 | |||
1000 | data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_BOOTLD, | ||
1001 | QLCNIC_UNI_BOOTLD_IDX_OFF); | ||
999 | 1002 | ||
1000 | if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) | 1003 | if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) |
1001 | offs = cpu_to_le32((qlcnic_get_data_desc(adapter, | 1004 | offs = le32_to_cpu(data_desc->findex); |
1002 | QLCNIC_UNI_DIR_SECT_BOOTLD, | ||
1003 | QLCNIC_UNI_BOOTLD_IDX_OFF))->findex); | ||
1004 | 1005 | ||
1005 | return (u8 *)&adapter->fw->data[offs]; | 1006 | return (u8 *)&adapter->fw->data[offs]; |
1006 | } | 1007 | } |
@@ -1009,43 +1010,48 @@ static u8 * | |||
1009 | qlcnic_get_fw_offs(struct qlcnic_adapter *adapter) | 1010 | qlcnic_get_fw_offs(struct qlcnic_adapter *adapter) |
1010 | { | 1011 | { |
1011 | u32 offs = QLCNIC_IMAGE_START; | 1012 | u32 offs = QLCNIC_IMAGE_START; |
1013 | struct uni_data_desc *data_desc; | ||
1012 | 1014 | ||
1015 | data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, | ||
1016 | QLCNIC_UNI_FIRMWARE_IDX_OFF); | ||
1013 | if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) | 1017 | if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) |
1014 | offs = cpu_to_le32((qlcnic_get_data_desc(adapter, | 1018 | offs = le32_to_cpu(data_desc->findex); |
1015 | QLCNIC_UNI_DIR_SECT_FW, | ||
1016 | QLCNIC_UNI_FIRMWARE_IDX_OFF))->findex); | ||
1017 | 1019 | ||
1018 | return (u8 *)&adapter->fw->data[offs]; | 1020 | return (u8 *)&adapter->fw->data[offs]; |
1019 | } | 1021 | } |
1020 | 1022 | ||
1021 | static __le32 | 1023 | static u32 qlcnic_get_fw_size(struct qlcnic_adapter *adapter) |
1022 | qlcnic_get_fw_size(struct qlcnic_adapter *adapter) | ||
1023 | { | 1024 | { |
1025 | struct uni_data_desc *data_desc; | ||
1026 | const u8 *unirom = adapter->fw->data; | ||
1027 | |||
1028 | data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, | ||
1029 | QLCNIC_UNI_FIRMWARE_IDX_OFF); | ||
1030 | |||
1024 | if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) | 1031 | if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) |
1025 | return cpu_to_le32((qlcnic_get_data_desc(adapter, | 1032 | return le32_to_cpu(data_desc->size); |
1026 | QLCNIC_UNI_DIR_SECT_FW, | ||
1027 | QLCNIC_UNI_FIRMWARE_IDX_OFF))->size); | ||
1028 | else | 1033 | else |
1029 | return cpu_to_le32( | 1034 | return le32_to_cpu(*(__le32 *)&unirom[QLCNIC_FW_SIZE_OFFSET]); |
1030 | *(u32 *)&adapter->fw->data[QLCNIC_FW_SIZE_OFFSET]); | ||
1031 | } | 1035 | } |
1032 | 1036 | ||
1033 | static __le32 | 1037 | static u32 qlcnic_get_fw_version(struct qlcnic_adapter *adapter) |
1034 | qlcnic_get_fw_version(struct qlcnic_adapter *adapter) | ||
1035 | { | 1038 | { |
1036 | struct uni_data_desc *fw_data_desc; | 1039 | struct uni_data_desc *fw_data_desc; |
1037 | const struct firmware *fw = adapter->fw; | 1040 | const struct firmware *fw = adapter->fw; |
1038 | __le32 major, minor, sub; | 1041 | u32 major, minor, sub; |
1042 | __le32 version_offset; | ||
1039 | const u8 *ver_str; | 1043 | const u8 *ver_str; |
1040 | int i, ret; | 1044 | int i, ret; |
1041 | 1045 | ||
1042 | if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) | 1046 | if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) { |
1043 | return cpu_to_le32(*(u32 *)&fw->data[QLCNIC_FW_VERSION_OFFSET]); | 1047 | version_offset = *(__le32 *)&fw->data[QLCNIC_FW_VERSION_OFFSET]; |
1048 | return le32_to_cpu(version_offset); | ||
1049 | } | ||
1044 | 1050 | ||
1045 | fw_data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, | 1051 | fw_data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, |
1046 | QLCNIC_UNI_FIRMWARE_IDX_OFF); | 1052 | QLCNIC_UNI_FIRMWARE_IDX_OFF); |
1047 | ver_str = fw->data + cpu_to_le32(fw_data_desc->findex) + | 1053 | ver_str = fw->data + le32_to_cpu(fw_data_desc->findex) + |
1048 | cpu_to_le32(fw_data_desc->size) - 17; | 1054 | le32_to_cpu(fw_data_desc->size) - 17; |
1049 | 1055 | ||
1050 | for (i = 0; i < 12; i++) { | 1056 | for (i = 0; i < 12; i++) { |
1051 | if (!strncmp(&ver_str[i], "REV=", 4)) { | 1057 | if (!strncmp(&ver_str[i], "REV=", 4)) { |
@@ -1061,18 +1067,20 @@ qlcnic_get_fw_version(struct qlcnic_adapter *adapter) | |||
1061 | return 0; | 1067 | return 0; |
1062 | } | 1068 | } |
1063 | 1069 | ||
1064 | static __le32 | 1070 | static u32 qlcnic_get_bios_version(struct qlcnic_adapter *adapter) |
1065 | qlcnic_get_bios_version(struct qlcnic_adapter *adapter) | ||
1066 | { | 1071 | { |
1067 | const struct firmware *fw = adapter->fw; | 1072 | const struct firmware *fw = adapter->fw; |
1068 | __le32 bios_ver, prd_off = adapter->file_prd_off; | 1073 | u32 bios_ver, prd_off = adapter->file_prd_off; |
1074 | u8 *version_offset; | ||
1075 | __le32 temp; | ||
1069 | 1076 | ||
1070 | if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) | 1077 | if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) { |
1071 | return cpu_to_le32( | 1078 | version_offset = (u8 *)&fw->data[QLCNIC_BIOS_VERSION_OFFSET]; |
1072 | *(u32 *)&fw->data[QLCNIC_BIOS_VERSION_OFFSET]); | 1079 | return le32_to_cpu(*(__le32 *)version_offset); |
1080 | } | ||
1073 | 1081 | ||
1074 | bios_ver = cpu_to_le32(*((u32 *) (&fw->data[prd_off]) | 1082 | temp = *((__le32 *)(&fw->data[prd_off]) + QLCNIC_UNI_BIOS_VERSION_OFF); |
1075 | + QLCNIC_UNI_BIOS_VERSION_OFF)); | 1083 | bios_ver = le32_to_cpu(temp); |
1076 | 1084 | ||
1077 | return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24); | 1085 | return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24); |
1078 | } | 1086 | } |
@@ -1131,7 +1139,7 @@ static const char *fw_name[] = { | |||
1131 | int | 1139 | int |
1132 | qlcnic_load_firmware(struct qlcnic_adapter *adapter) | 1140 | qlcnic_load_firmware(struct qlcnic_adapter *adapter) |
1133 | { | 1141 | { |
1134 | u64 *ptr64; | 1142 | __le64 *ptr64; |
1135 | u32 i, flashaddr, size; | 1143 | u32 i, flashaddr, size; |
1136 | const struct firmware *fw = adapter->fw; | 1144 | const struct firmware *fw = adapter->fw; |
1137 | struct pci_dev *pdev = adapter->pdev; | 1145 | struct pci_dev *pdev = adapter->pdev; |
@@ -1140,15 +1148,15 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter) | |||
1140 | fw_name[adapter->fw_type]); | 1148 | fw_name[adapter->fw_type]); |
1141 | 1149 | ||
1142 | if (fw) { | 1150 | if (fw) { |
1143 | __le64 data; | 1151 | u64 data; |
1144 | 1152 | ||
1145 | size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8; | 1153 | size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8; |
1146 | 1154 | ||
1147 | ptr64 = (u64 *)qlcnic_get_bootld_offs(adapter); | 1155 | ptr64 = (__le64 *)qlcnic_get_bootld_offs(adapter); |
1148 | flashaddr = QLCNIC_BOOTLD_START; | 1156 | flashaddr = QLCNIC_BOOTLD_START; |
1149 | 1157 | ||
1150 | for (i = 0; i < size; i++) { | 1158 | for (i = 0; i < size; i++) { |
1151 | data = cpu_to_le64(ptr64[i]); | 1159 | data = le64_to_cpu(ptr64[i]); |
1152 | 1160 | ||
1153 | if (qlcnic_pci_mem_write_2M(adapter, flashaddr, data)) | 1161 | if (qlcnic_pci_mem_write_2M(adapter, flashaddr, data)) |
1154 | return -EIO; | 1162 | return -EIO; |
@@ -1156,13 +1164,13 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter) | |||
1156 | flashaddr += 8; | 1164 | flashaddr += 8; |
1157 | } | 1165 | } |
1158 | 1166 | ||
1159 | size = (__force u32)qlcnic_get_fw_size(adapter) / 8; | 1167 | size = qlcnic_get_fw_size(adapter) / 8; |
1160 | 1168 | ||
1161 | ptr64 = (u64 *)qlcnic_get_fw_offs(adapter); | 1169 | ptr64 = (__le64 *)qlcnic_get_fw_offs(adapter); |
1162 | flashaddr = QLCNIC_IMAGE_START; | 1170 | flashaddr = QLCNIC_IMAGE_START; |
1163 | 1171 | ||
1164 | for (i = 0; i < size; i++) { | 1172 | for (i = 0; i < size; i++) { |
1165 | data = cpu_to_le64(ptr64[i]); | 1173 | data = le64_to_cpu(ptr64[i]); |
1166 | 1174 | ||
1167 | if (qlcnic_pci_mem_write_2M(adapter, | 1175 | if (qlcnic_pci_mem_write_2M(adapter, |
1168 | flashaddr, data)) | 1176 | flashaddr, data)) |
@@ -1171,9 +1179,9 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter) | |||
1171 | flashaddr += 8; | 1179 | flashaddr += 8; |
1172 | } | 1180 | } |
1173 | 1181 | ||
1174 | size = (__force u32)qlcnic_get_fw_size(adapter) % 8; | 1182 | size = qlcnic_get_fw_size(adapter) % 8; |
1175 | if (size) { | 1183 | if (size) { |
1176 | data = cpu_to_le64(ptr64[i]); | 1184 | data = le64_to_cpu(ptr64[i]); |
1177 | 1185 | ||
1178 | if (qlcnic_pci_mem_write_2M(adapter, | 1186 | if (qlcnic_pci_mem_write_2M(adapter, |
1179 | flashaddr, data)) | 1187 | flashaddr, data)) |
@@ -1225,7 +1233,7 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter) | |||
1225 | static int | 1233 | static int |
1226 | qlcnic_validate_firmware(struct qlcnic_adapter *adapter) | 1234 | qlcnic_validate_firmware(struct qlcnic_adapter *adapter) |
1227 | { | 1235 | { |
1228 | __le32 val; | 1236 | u32 val; |
1229 | u32 ver, bios, min_size; | 1237 | u32 ver, bios, min_size; |
1230 | struct pci_dev *pdev = adapter->pdev; | 1238 | struct pci_dev *pdev = adapter->pdev; |
1231 | const struct firmware *fw = adapter->fw; | 1239 | const struct firmware *fw = adapter->fw; |
@@ -1237,8 +1245,8 @@ qlcnic_validate_firmware(struct qlcnic_adapter *adapter) | |||
1237 | 1245 | ||
1238 | min_size = QLCNIC_UNI_FW_MIN_SIZE; | 1246 | min_size = QLCNIC_UNI_FW_MIN_SIZE; |
1239 | } else { | 1247 | } else { |
1240 | val = cpu_to_le32(*(u32 *)&fw->data[QLCNIC_FW_MAGIC_OFFSET]); | 1248 | val = le32_to_cpu(*(__le32 *)&fw->data[QLCNIC_FW_MAGIC_OFFSET]); |
1241 | if ((__force u32)val != QLCNIC_BDINFO_MAGIC) | 1249 | if (val != QLCNIC_BDINFO_MAGIC) |
1242 | return -EINVAL; | 1250 | return -EINVAL; |
1243 | 1251 | ||
1244 | min_size = QLCNIC_FW_MIN_SIZE; | 1252 | min_size = QLCNIC_FW_MIN_SIZE; |
@@ -1259,7 +1267,7 @@ qlcnic_validate_firmware(struct qlcnic_adapter *adapter) | |||
1259 | 1267 | ||
1260 | val = qlcnic_get_bios_version(adapter); | 1268 | val = qlcnic_get_bios_version(adapter); |
1261 | qlcnic_rom_fast_read(adapter, QLCNIC_BIOS_VERSION_OFFSET, (int *)&bios); | 1269 | qlcnic_rom_fast_read(adapter, QLCNIC_BIOS_VERSION_OFFSET, (int *)&bios); |
1262 | if ((__force u32)val != bios) { | 1270 | if (val != bios) { |
1263 | dev_err(&pdev->dev, "%s: firmware bios is incompatible\n", | 1271 | dev_err(&pdev->dev, "%s: firmware bios is incompatible\n", |
1264 | fw_name[fw_type]); | 1272 | fw_name[fw_type]); |
1265 | return -EINVAL; | 1273 | return -EINVAL; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 4109a4100552..67159d6e9a35 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -2030,7 +2030,7 @@ qlcnic_tx_pkt(struct qlcnic_adapter *adapter, | |||
2030 | if (protocol == ETH_P_8021Q) { | 2030 | if (protocol == ETH_P_8021Q) { |
2031 | vh = (struct vlan_ethhdr *)skb->data; | 2031 | vh = (struct vlan_ethhdr *)skb->data; |
2032 | flags = FLAGS_VLAN_TAGGED; | 2032 | flags = FLAGS_VLAN_TAGGED; |
2033 | vlan_tci = vh->h_vlan_TCI; | 2033 | vlan_tci = ntohs(vh->h_vlan_TCI); |
2034 | protocol = ntohs(vh->h_vlan_encapsulated_proto); | 2034 | protocol = ntohs(vh->h_vlan_encapsulated_proto); |
2035 | } else if (vlan_tx_tag_present(skb)) { | 2035 | } else if (vlan_tx_tag_present(skb)) { |
2036 | flags = FLAGS_VLAN_OOB; | 2036 | flags = FLAGS_VLAN_OOB; |
@@ -4520,7 +4520,7 @@ static void | |||
4520 | qlcnic_restore_indev_addr(struct net_device *dev, unsigned long event) | 4520 | qlcnic_restore_indev_addr(struct net_device *dev, unsigned long event) |
4521 | { } | 4521 | { } |
4522 | #endif | 4522 | #endif |
4523 | static const struct pci_error_handlers qlcnic_err_handler = { | 4523 | static struct pci_error_handlers qlcnic_err_handler = { |
4524 | .error_detected = qlcnic_io_error_detected, | 4524 | .error_detected = qlcnic_io_error_detected, |
4525 | .slot_reset = qlcnic_io_slot_reset, | 4525 | .slot_reset = qlcnic_io_slot_reset, |
4526 | .resume = qlcnic_io_resume, | 4526 | .resume = qlcnic_io_resume, |