diff options
Diffstat (limited to 'drivers/net/ethernet/emulex')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.c | 20 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.h | 175 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_ethtool.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_hw.h | 228 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 315 |
6 files changed, 375 insertions, 383 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 712e7f8e1df7..9fa2569f56cb 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -243,7 +243,6 @@ struct be_tx_stats { | |||
243 | u64 tx_bytes; | 243 | u64 tx_bytes; |
244 | u64 tx_pkts; | 244 | u64 tx_pkts; |
245 | u64 tx_reqs; | 245 | u64 tx_reqs; |
246 | u64 tx_wrbs; | ||
247 | u64 tx_compl; | 246 | u64 tx_compl; |
248 | ulong tx_jiffies; | 247 | ulong tx_jiffies; |
249 | u32 tx_stops; | 248 | u32 tx_stops; |
@@ -266,6 +265,9 @@ struct be_tx_obj { | |||
266 | /* Remember the skbs that were transmitted */ | 265 | /* Remember the skbs that were transmitted */ |
267 | struct sk_buff *sent_skb_list[TX_Q_LEN]; | 266 | struct sk_buff *sent_skb_list[TX_Q_LEN]; |
268 | struct be_tx_stats stats; | 267 | struct be_tx_stats stats; |
268 | u16 pend_wrb_cnt; /* Number of WRBs yet to be given to HW */ | ||
269 | u16 last_req_wrb_cnt; /* wrb cnt of the last req in the Q */ | ||
270 | u16 last_req_hdr; /* index of the last req's hdr-wrb */ | ||
269 | } ____cacheline_aligned_in_smp; | 271 | } ____cacheline_aligned_in_smp; |
270 | 272 | ||
271 | /* Struct to remember the pages posted for rx frags */ | 273 | /* Struct to remember the pages posted for rx frags */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index fead5c65a4f0..4bd425ea3421 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -573,7 +573,7 @@ static int lancer_wait_ready(struct be_adapter *adapter) | |||
573 | { | 573 | { |
574 | #define SLIPORT_READY_TIMEOUT 30 | 574 | #define SLIPORT_READY_TIMEOUT 30 |
575 | u32 sliport_status; | 575 | u32 sliport_status; |
576 | int status = 0, i; | 576 | int i; |
577 | 577 | ||
578 | for (i = 0; i < SLIPORT_READY_TIMEOUT; i++) { | 578 | for (i = 0; i < SLIPORT_READY_TIMEOUT; i++) { |
579 | sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); | 579 | sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); |
@@ -584,9 +584,9 @@ static int lancer_wait_ready(struct be_adapter *adapter) | |||
584 | } | 584 | } |
585 | 585 | ||
586 | if (i == SLIPORT_READY_TIMEOUT) | 586 | if (i == SLIPORT_READY_TIMEOUT) |
587 | status = -1; | 587 | return sliport_status ? : -1; |
588 | 588 | ||
589 | return status; | 589 | return 0; |
590 | } | 590 | } |
591 | 591 | ||
592 | static bool lancer_provisioning_error(struct be_adapter *adapter) | 592 | static bool lancer_provisioning_error(struct be_adapter *adapter) |
@@ -624,7 +624,7 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter) | |||
624 | iowrite32(SLI_PORT_CONTROL_IP_MASK, | 624 | iowrite32(SLI_PORT_CONTROL_IP_MASK, |
625 | adapter->db + SLIPORT_CONTROL_OFFSET); | 625 | adapter->db + SLIPORT_CONTROL_OFFSET); |
626 | 626 | ||
627 | /* check adapter has corrected the error */ | 627 | /* check if adapter has corrected the error */ |
628 | status = lancer_wait_ready(adapter); | 628 | status = lancer_wait_ready(adapter); |
629 | sliport_status = ioread32(adapter->db + | 629 | sliport_status = ioread32(adapter->db + |
630 | SLIPORT_STATUS_OFFSET); | 630 | SLIPORT_STATUS_OFFSET); |
@@ -655,7 +655,11 @@ int be_fw_wait_ready(struct be_adapter *adapter) | |||
655 | 655 | ||
656 | if (lancer_chip(adapter)) { | 656 | if (lancer_chip(adapter)) { |
657 | status = lancer_wait_ready(adapter); | 657 | status = lancer_wait_ready(adapter); |
658 | return status; | 658 | if (status) { |
659 | stage = status; | ||
660 | goto err; | ||
661 | } | ||
662 | return 0; | ||
659 | } | 663 | } |
660 | 664 | ||
661 | do { | 665 | do { |
@@ -671,7 +675,8 @@ int be_fw_wait_ready(struct be_adapter *adapter) | |||
671 | timeout += 2; | 675 | timeout += 2; |
672 | } while (timeout < 60); | 676 | } while (timeout < 60); |
673 | 677 | ||
674 | dev_err(dev, "POST timeout; stage=0x%x\n", stage); | 678 | err: |
679 | dev_err(dev, "POST timeout; stage=%#x\n", stage); | ||
675 | return -1; | 680 | return -1; |
676 | } | 681 | } |
677 | 682 | ||
@@ -3751,6 +3756,7 @@ int be_cmd_config_qos(struct be_adapter *adapter, u32 max_rate, u16 link_speed, | |||
3751 | be_reset_nic_desc(&nic_desc); | 3756 | be_reset_nic_desc(&nic_desc); |
3752 | nic_desc.pf_num = adapter->pf_number; | 3757 | nic_desc.pf_num = adapter->pf_number; |
3753 | nic_desc.vf_num = domain; | 3758 | nic_desc.vf_num = domain; |
3759 | nic_desc.bw_min = 0; | ||
3754 | if (lancer_chip(adapter)) { | 3760 | if (lancer_chip(adapter)) { |
3755 | nic_desc.hdr.desc_type = NIC_RESOURCE_DESC_TYPE_V0; | 3761 | nic_desc.hdr.desc_type = NIC_RESOURCE_DESC_TYPE_V0; |
3756 | nic_desc.hdr.desc_len = RESOURCE_DESC_SIZE_V0; | 3762 | nic_desc.hdr.desc_len = RESOURCE_DESC_SIZE_V0; |
@@ -4092,7 +4098,7 @@ int be_cmd_set_logical_link_config(struct be_adapter *adapter, | |||
4092 | int status; | 4098 | int status; |
4093 | 4099 | ||
4094 | if (BEx_chip(adapter) || lancer_chip(adapter)) | 4100 | if (BEx_chip(adapter) || lancer_chip(adapter)) |
4095 | return 0; | 4101 | return -EOPNOTSUPP; |
4096 | 4102 | ||
4097 | spin_lock_bh(&adapter->mcc_lock); | 4103 | spin_lock_bh(&adapter->mcc_lock); |
4098 | 4104 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index eb5085d6794f..c2701ccd0a1d 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1161,7 +1161,167 @@ struct be_cmd_resp_get_beacon_state { | |||
1161 | u8 rsvd0[3]; | 1161 | u8 rsvd0[3]; |
1162 | } __packed; | 1162 | } __packed; |
1163 | 1163 | ||
1164 | /* Flashrom related descriptors */ | ||
1165 | #define MAX_FLASH_COMP 32 | ||
1166 | |||
1167 | #define OPTYPE_ISCSI_ACTIVE 0 | ||
1168 | #define OPTYPE_REDBOOT 1 | ||
1169 | #define OPTYPE_BIOS 2 | ||
1170 | #define OPTYPE_PXE_BIOS 3 | ||
1171 | #define OPTYPE_FCOE_BIOS 8 | ||
1172 | #define OPTYPE_ISCSI_BACKUP 9 | ||
1173 | #define OPTYPE_FCOE_FW_ACTIVE 10 | ||
1174 | #define OPTYPE_FCOE_FW_BACKUP 11 | ||
1175 | #define OPTYPE_NCSI_FW 13 | ||
1176 | #define OPTYPE_REDBOOT_DIR 18 | ||
1177 | #define OPTYPE_REDBOOT_CONFIG 19 | ||
1178 | #define OPTYPE_SH_PHY_FW 21 | ||
1179 | #define OPTYPE_FLASHISM_JUMPVECTOR 22 | ||
1180 | #define OPTYPE_UFI_DIR 23 | ||
1181 | #define OPTYPE_PHY_FW 99 | ||
1182 | |||
1183 | #define FLASH_BIOS_IMAGE_MAX_SIZE_g2 262144 /* Max OPTION ROM image sz */ | ||
1184 | #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 262144 /* Max Redboot image sz */ | ||
1185 | #define FLASH_IMAGE_MAX_SIZE_g2 1310720 /* Max firmware image size */ | ||
1186 | |||
1187 | #define FLASH_NCSI_IMAGE_MAX_SIZE_g3 262144 | ||
1188 | #define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144 | ||
1189 | #define FLASH_BIOS_IMAGE_MAX_SIZE_g3 524288 /* Max OPTION ROM image sz */ | ||
1190 | #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 1048576 /* Max Redboot image sz */ | ||
1191 | #define FLASH_IMAGE_MAX_SIZE_g3 2097152 /* Max firmware image size */ | ||
1192 | |||
1193 | /* Offsets for components on Flash. */ | ||
1194 | #define FLASH_REDBOOT_START_g2 0 | ||
1195 | #define FLASH_FCoE_BIOS_START_g2 524288 | ||
1196 | #define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 1048576 | ||
1197 | #define FLASH_iSCSI_BACKUP_IMAGE_START_g2 2359296 | ||
1198 | #define FLASH_FCoE_PRIMARY_IMAGE_START_g2 3670016 | ||
1199 | #define FLASH_FCoE_BACKUP_IMAGE_START_g2 4980736 | ||
1200 | #define FLASH_iSCSI_BIOS_START_g2 7340032 | ||
1201 | #define FLASH_PXE_BIOS_START_g2 7864320 | ||
1202 | |||
1203 | #define FLASH_REDBOOT_START_g3 262144 | ||
1204 | #define FLASH_PHY_FW_START_g3 1310720 | ||
1205 | #define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 2097152 | ||
1206 | #define FLASH_iSCSI_BACKUP_IMAGE_START_g3 4194304 | ||
1207 | #define FLASH_FCoE_PRIMARY_IMAGE_START_g3 6291456 | ||
1208 | #define FLASH_FCoE_BACKUP_IMAGE_START_g3 8388608 | ||
1209 | #define FLASH_iSCSI_BIOS_START_g3 12582912 | ||
1210 | #define FLASH_PXE_BIOS_START_g3 13107200 | ||
1211 | #define FLASH_FCoE_BIOS_START_g3 13631488 | ||
1212 | #define FLASH_NCSI_START_g3 15990784 | ||
1213 | |||
1214 | #define IMAGE_NCSI 16 | ||
1215 | #define IMAGE_OPTION_ROM_PXE 32 | ||
1216 | #define IMAGE_OPTION_ROM_FCoE 33 | ||
1217 | #define IMAGE_OPTION_ROM_ISCSI 34 | ||
1218 | #define IMAGE_FLASHISM_JUMPVECTOR 48 | ||
1219 | #define IMAGE_FIRMWARE_iSCSI 160 | ||
1220 | #define IMAGE_FIRMWARE_FCoE 162 | ||
1221 | #define IMAGE_FIRMWARE_BACKUP_iSCSI 176 | ||
1222 | #define IMAGE_FIRMWARE_BACKUP_FCoE 178 | ||
1223 | #define IMAGE_FIRMWARE_PHY 192 | ||
1224 | #define IMAGE_REDBOOT_DIR 208 | ||
1225 | #define IMAGE_REDBOOT_CONFIG 209 | ||
1226 | #define IMAGE_UFI_DIR 210 | ||
1227 | #define IMAGE_BOOT_CODE 224 | ||
1228 | |||
1229 | struct controller_id { | ||
1230 | u32 vendor; | ||
1231 | u32 device; | ||
1232 | u32 subvendor; | ||
1233 | u32 subdevice; | ||
1234 | }; | ||
1235 | |||
1236 | struct flash_comp { | ||
1237 | unsigned long offset; | ||
1238 | int optype; | ||
1239 | int size; | ||
1240 | int img_type; | ||
1241 | }; | ||
1242 | |||
1243 | struct image_hdr { | ||
1244 | u32 imageid; | ||
1245 | u32 imageoffset; | ||
1246 | u32 imagelength; | ||
1247 | u32 image_checksum; | ||
1248 | u8 image_version[32]; | ||
1249 | }; | ||
1250 | |||
1251 | struct flash_file_hdr_g2 { | ||
1252 | u8 sign[32]; | ||
1253 | u32 cksum; | ||
1254 | u32 antidote; | ||
1255 | struct controller_id cont_id; | ||
1256 | u32 file_len; | ||
1257 | u32 chunk_num; | ||
1258 | u32 total_chunks; | ||
1259 | u32 num_imgs; | ||
1260 | u8 build[24]; | ||
1261 | }; | ||
1262 | |||
1263 | struct flash_file_hdr_g3 { | ||
1264 | u8 sign[52]; | ||
1265 | u8 ufi_version[4]; | ||
1266 | u32 file_len; | ||
1267 | u32 cksum; | ||
1268 | u32 antidote; | ||
1269 | u32 num_imgs; | ||
1270 | u8 build[24]; | ||
1271 | u8 asic_type_rev; | ||
1272 | u8 rsvd[31]; | ||
1273 | }; | ||
1274 | |||
1275 | struct flash_section_hdr { | ||
1276 | u32 format_rev; | ||
1277 | u32 cksum; | ||
1278 | u32 antidote; | ||
1279 | u32 num_images; | ||
1280 | u8 id_string[128]; | ||
1281 | u32 rsvd[4]; | ||
1282 | } __packed; | ||
1283 | |||
1284 | struct flash_section_hdr_g2 { | ||
1285 | u32 format_rev; | ||
1286 | u32 cksum; | ||
1287 | u32 antidote; | ||
1288 | u32 build_num; | ||
1289 | u8 id_string[128]; | ||
1290 | u32 rsvd[8]; | ||
1291 | } __packed; | ||
1292 | |||
1293 | struct flash_section_entry { | ||
1294 | u32 type; | ||
1295 | u32 offset; | ||
1296 | u32 pad_size; | ||
1297 | u32 image_size; | ||
1298 | u32 cksum; | ||
1299 | u32 entry_point; | ||
1300 | u16 optype; | ||
1301 | u16 rsvd0; | ||
1302 | u32 rsvd1; | ||
1303 | u8 ver_data[32]; | ||
1304 | } __packed; | ||
1305 | |||
1306 | struct flash_section_info { | ||
1307 | u8 cookie[32]; | ||
1308 | struct flash_section_hdr fsec_hdr; | ||
1309 | struct flash_section_entry fsec_entry[32]; | ||
1310 | } __packed; | ||
1311 | |||
1312 | struct flash_section_info_g2 { | ||
1313 | u8 cookie[32]; | ||
1314 | struct flash_section_hdr_g2 fsec_hdr; | ||
1315 | struct flash_section_entry fsec_entry[32]; | ||
1316 | } __packed; | ||
1317 | |||
1164 | /****************** Firmware Flash ******************/ | 1318 | /****************** Firmware Flash ******************/ |
1319 | #define FLASHROM_OPER_FLASH 1 | ||
1320 | #define FLASHROM_OPER_SAVE 2 | ||
1321 | #define FLASHROM_OPER_REPORT 4 | ||
1322 | #define FLASHROM_OPER_PHY_FLASH 9 | ||
1323 | #define FLASHROM_OPER_PHY_SAVE 10 | ||
1324 | |||
1165 | struct flashrom_params { | 1325 | struct flashrom_params { |
1166 | u32 op_code; | 1326 | u32 op_code; |
1167 | u32 op_type; | 1327 | u32 op_type; |
@@ -1366,6 +1526,7 @@ enum { | |||
1366 | PHY_TYPE_QSFP, | 1526 | PHY_TYPE_QSFP, |
1367 | PHY_TYPE_KR4_40GB, | 1527 | PHY_TYPE_KR4_40GB, |
1368 | PHY_TYPE_KR2_20GB, | 1528 | PHY_TYPE_KR2_20GB, |
1529 | PHY_TYPE_TN_8022, | ||
1369 | PHY_TYPE_DISABLED = 255 | 1530 | PHY_TYPE_DISABLED = 255 |
1370 | }; | 1531 | }; |
1371 | 1532 | ||
@@ -1429,6 +1590,20 @@ struct be_cmd_req_set_qos { | |||
1429 | }; | 1590 | }; |
1430 | 1591 | ||
1431 | /*********************** Controller Attributes ***********************/ | 1592 | /*********************** Controller Attributes ***********************/ |
1593 | struct mgmt_hba_attribs { | ||
1594 | u32 rsvd0[24]; | ||
1595 | u8 controller_model_number[32]; | ||
1596 | u32 rsvd1[79]; | ||
1597 | u8 rsvd2[3]; | ||
1598 | u8 phy_port; | ||
1599 | u32 rsvd3[13]; | ||
1600 | } __packed; | ||
1601 | |||
1602 | struct mgmt_controller_attrib { | ||
1603 | struct mgmt_hba_attribs hba_attribs; | ||
1604 | u32 rsvd0[10]; | ||
1605 | } __packed; | ||
1606 | |||
1432 | struct be_cmd_req_cntl_attribs { | 1607 | struct be_cmd_req_cntl_attribs { |
1433 | struct be_cmd_req_hdr hdr; | 1608 | struct be_cmd_req_hdr hdr; |
1434 | }; | 1609 | }; |
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 73a500ccbf69..4d2de4700769 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -193,8 +193,6 @@ static const struct be_ethtool_stat et_tx_stats[] = { | |||
193 | {DRVSTAT_TX_INFO(tx_pkts)}, | 193 | {DRVSTAT_TX_INFO(tx_pkts)}, |
194 | /* Number of skbs queued for trasmission by the driver */ | 194 | /* Number of skbs queued for trasmission by the driver */ |
195 | {DRVSTAT_TX_INFO(tx_reqs)}, | 195 | {DRVSTAT_TX_INFO(tx_reqs)}, |
196 | /* Number of TX work request blocks DMAed to HW */ | ||
197 | {DRVSTAT_TX_INFO(tx_wrbs)}, | ||
198 | /* Number of times the TX queue was stopped due to lack | 196 | /* Number of times the TX queue was stopped due to lack |
199 | * of spaces in the TXQ. | 197 | * of spaces in the TXQ. |
200 | */ | 198 | */ |
@@ -707,15 +705,17 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) | |||
707 | 705 | ||
708 | if (ecmd->autoneg != adapter->phy.fc_autoneg) | 706 | if (ecmd->autoneg != adapter->phy.fc_autoneg) |
709 | return -EINVAL; | 707 | return -EINVAL; |
710 | adapter->tx_fc = ecmd->tx_pause; | ||
711 | adapter->rx_fc = ecmd->rx_pause; | ||
712 | 708 | ||
713 | status = be_cmd_set_flow_control(adapter, | 709 | status = be_cmd_set_flow_control(adapter, ecmd->tx_pause, |
714 | adapter->tx_fc, adapter->rx_fc); | 710 | ecmd->rx_pause); |
715 | if (status) | 711 | if (status) { |
716 | dev_warn(&adapter->pdev->dev, "Pause param set failed\n"); | 712 | dev_warn(&adapter->pdev->dev, "Pause param set failed\n"); |
713 | return be_cmd_status(status); | ||
714 | } | ||
717 | 715 | ||
718 | return be_cmd_status(status); | 716 | adapter->tx_fc = ecmd->tx_pause; |
717 | adapter->rx_fc = ecmd->rx_pause; | ||
718 | return 0; | ||
719 | } | 719 | } |
720 | 720 | ||
721 | static int be_set_phys_id(struct net_device *netdev, | 721 | static int be_set_phys_id(struct net_device *netdev, |
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h index 295ee0835ba0..8e91ae851a7c 100644 --- a/drivers/net/ethernet/emulex/benet/be_hw.h +++ b/drivers/net/ethernet/emulex/benet/be_hw.h | |||
@@ -171,94 +171,6 @@ | |||
171 | #define RETRIEVE_FAT 0 | 171 | #define RETRIEVE_FAT 0 |
172 | #define QUERY_FAT 1 | 172 | #define QUERY_FAT 1 |
173 | 173 | ||
174 | /* Flashrom related descriptors */ | ||
175 | #define MAX_FLASH_COMP 32 | ||
176 | #define IMAGE_TYPE_FIRMWARE 160 | ||
177 | #define IMAGE_TYPE_BOOTCODE 224 | ||
178 | #define IMAGE_TYPE_OPTIONROM 32 | ||
179 | |||
180 | #define NUM_FLASHDIR_ENTRIES 32 | ||
181 | |||
182 | #define OPTYPE_ISCSI_ACTIVE 0 | ||
183 | #define OPTYPE_REDBOOT 1 | ||
184 | #define OPTYPE_BIOS 2 | ||
185 | #define OPTYPE_PXE_BIOS 3 | ||
186 | #define OPTYPE_FCOE_BIOS 8 | ||
187 | #define OPTYPE_ISCSI_BACKUP 9 | ||
188 | #define OPTYPE_FCOE_FW_ACTIVE 10 | ||
189 | #define OPTYPE_FCOE_FW_BACKUP 11 | ||
190 | #define OPTYPE_NCSI_FW 13 | ||
191 | #define OPTYPE_REDBOOT_DIR 18 | ||
192 | #define OPTYPE_REDBOOT_CONFIG 19 | ||
193 | #define OPTYPE_SH_PHY_FW 21 | ||
194 | #define OPTYPE_FLASHISM_JUMPVECTOR 22 | ||
195 | #define OPTYPE_UFI_DIR 23 | ||
196 | #define OPTYPE_PHY_FW 99 | ||
197 | #define TN_8022 13 | ||
198 | |||
199 | #define FLASHROM_OPER_PHY_FLASH 9 | ||
200 | #define FLASHROM_OPER_PHY_SAVE 10 | ||
201 | #define FLASHROM_OPER_FLASH 1 | ||
202 | #define FLASHROM_OPER_SAVE 2 | ||
203 | #define FLASHROM_OPER_REPORT 4 | ||
204 | |||
205 | #define FLASH_IMAGE_MAX_SIZE_g2 (1310720) /* Max firmware image size */ | ||
206 | #define FLASH_BIOS_IMAGE_MAX_SIZE_g2 (262144) /* Max OPTION ROM image sz */ | ||
207 | #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 (262144) /* Max Redboot image sz */ | ||
208 | #define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max firmware image size */ | ||
209 | #define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM image sz */ | ||
210 | #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */ | ||
211 | #define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144) | ||
212 | #define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144 | ||
213 | |||
214 | #define FLASH_NCSI_MAGIC (0x16032009) | ||
215 | #define FLASH_NCSI_DISABLED (0) | ||
216 | #define FLASH_NCSI_ENABLED (1) | ||
217 | |||
218 | #define FLASH_NCSI_BITFILE_HDR_OFFSET (0x600000) | ||
219 | |||
220 | /* Offsets for components on Flash. */ | ||
221 | #define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 (1048576) | ||
222 | #define FLASH_iSCSI_BACKUP_IMAGE_START_g2 (2359296) | ||
223 | #define FLASH_FCoE_PRIMARY_IMAGE_START_g2 (3670016) | ||
224 | #define FLASH_FCoE_BACKUP_IMAGE_START_g2 (4980736) | ||
225 | #define FLASH_iSCSI_BIOS_START_g2 (7340032) | ||
226 | #define FLASH_PXE_BIOS_START_g2 (7864320) | ||
227 | #define FLASH_FCoE_BIOS_START_g2 (524288) | ||
228 | #define FLASH_REDBOOT_START_g2 (0) | ||
229 | |||
230 | #define FLASH_NCSI_START_g3 (15990784) | ||
231 | #define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152) | ||
232 | #define FLASH_iSCSI_BACKUP_IMAGE_START_g3 (4194304) | ||
233 | #define FLASH_FCoE_PRIMARY_IMAGE_START_g3 (6291456) | ||
234 | #define FLASH_FCoE_BACKUP_IMAGE_START_g3 (8388608) | ||
235 | #define FLASH_iSCSI_BIOS_START_g3 (12582912) | ||
236 | #define FLASH_PXE_BIOS_START_g3 (13107200) | ||
237 | #define FLASH_FCoE_BIOS_START_g3 (13631488) | ||
238 | #define FLASH_REDBOOT_START_g3 (262144) | ||
239 | #define FLASH_PHY_FW_START_g3 1310720 | ||
240 | |||
241 | #define IMAGE_NCSI 16 | ||
242 | #define IMAGE_OPTION_ROM_PXE 32 | ||
243 | #define IMAGE_OPTION_ROM_FCoE 33 | ||
244 | #define IMAGE_OPTION_ROM_ISCSI 34 | ||
245 | #define IMAGE_FLASHISM_JUMPVECTOR 48 | ||
246 | #define IMAGE_FLASH_ISM 49 | ||
247 | #define IMAGE_JUMP_VECTOR 50 | ||
248 | #define IMAGE_FIRMWARE_iSCSI 160 | ||
249 | #define IMAGE_FIRMWARE_COMP_iSCSI 161 | ||
250 | #define IMAGE_FIRMWARE_FCoE 162 | ||
251 | #define IMAGE_FIRMWARE_COMP_FCoE 163 | ||
252 | #define IMAGE_FIRMWARE_BACKUP_iSCSI 176 | ||
253 | #define IMAGE_FIRMWARE_BACKUP_COMP_iSCSI 177 | ||
254 | #define IMAGE_FIRMWARE_BACKUP_FCoE 178 | ||
255 | #define IMAGE_FIRMWARE_BACKUP_COMP_FCoE 179 | ||
256 | #define IMAGE_FIRMWARE_PHY 192 | ||
257 | #define IMAGE_REDBOOT_DIR 208 | ||
258 | #define IMAGE_REDBOOT_CONFIG 209 | ||
259 | #define IMAGE_UFI_DIR 210 | ||
260 | #define IMAGE_BOOT_CODE 224 | ||
261 | |||
262 | /************* Rx Packet Type Encoding **************/ | 174 | /************* Rx Packet Type Encoding **************/ |
263 | #define BE_UNICAST_PACKET 0 | 175 | #define BE_UNICAST_PACKET 0 |
264 | #define BE_MULTICAST_PACKET 1 | 176 | #define BE_MULTICAST_PACKET 1 |
@@ -311,6 +223,11 @@ struct amap_eth_hdr_wrb { | |||
311 | u8 vlan_tag[16]; | 223 | u8 vlan_tag[16]; |
312 | } __packed; | 224 | } __packed; |
313 | 225 | ||
226 | #define TX_HDR_WRB_COMPL 1 /* word 2 */ | ||
227 | #define TX_HDR_WRB_EVT (1 << 1) /* word 2 */ | ||
228 | #define TX_HDR_WRB_NUM_SHIFT 13 /* word 2: bits 13:17 */ | ||
229 | #define TX_HDR_WRB_NUM_MASK 0x1F /* word 2: bits 13:17 */ | ||
230 | |||
314 | struct be_eth_hdr_wrb { | 231 | struct be_eth_hdr_wrb { |
315 | u32 dw[4]; | 232 | u32 dw[4]; |
316 | }; | 233 | }; |
@@ -435,138 +352,3 @@ struct amap_eth_rx_compl_v1 { | |||
435 | struct be_eth_rx_compl { | 352 | struct be_eth_rx_compl { |
436 | u32 dw[4]; | 353 | u32 dw[4]; |
437 | }; | 354 | }; |
438 | |||
439 | struct mgmt_hba_attribs { | ||
440 | u8 flashrom_version_string[32]; | ||
441 | u8 manufacturer_name[32]; | ||
442 | u32 supported_modes; | ||
443 | u32 rsvd0[3]; | ||
444 | u8 ncsi_ver_string[12]; | ||
445 | u32 default_extended_timeout; | ||
446 | u8 controller_model_number[32]; | ||
447 | u8 controller_description[64]; | ||
448 | u8 controller_serial_number[32]; | ||
449 | u8 ip_version_string[32]; | ||
450 | u8 firmware_version_string[32]; | ||
451 | u8 bios_version_string[32]; | ||
452 | u8 redboot_version_string[32]; | ||
453 | u8 driver_version_string[32]; | ||
454 | u8 fw_on_flash_version_string[32]; | ||
455 | u32 functionalities_supported; | ||
456 | u16 max_cdblength; | ||
457 | u8 asic_revision; | ||
458 | u8 generational_guid[16]; | ||
459 | u8 hba_port_count; | ||
460 | u16 default_link_down_timeout; | ||
461 | u8 iscsi_ver_min_max; | ||
462 | u8 multifunction_device; | ||
463 | u8 cache_valid; | ||
464 | u8 hba_status; | ||
465 | u8 max_domains_supported; | ||
466 | u8 phy_port; | ||
467 | u32 firmware_post_status; | ||
468 | u32 hba_mtu[8]; | ||
469 | u32 rsvd1[4]; | ||
470 | }; | ||
471 | |||
472 | struct mgmt_controller_attrib { | ||
473 | struct mgmt_hba_attribs hba_attribs; | ||
474 | u16 pci_vendor_id; | ||
475 | u16 pci_device_id; | ||
476 | u16 pci_sub_vendor_id; | ||
477 | u16 pci_sub_system_id; | ||
478 | u8 pci_bus_number; | ||
479 | u8 pci_device_number; | ||
480 | u8 pci_function_number; | ||
481 | u8 interface_type; | ||
482 | u64 unique_identifier; | ||
483 | u32 rsvd0[5]; | ||
484 | }; | ||
485 | |||
486 | struct controller_id { | ||
487 | u32 vendor; | ||
488 | u32 device; | ||
489 | u32 subvendor; | ||
490 | u32 subdevice; | ||
491 | }; | ||
492 | |||
493 | struct flash_comp { | ||
494 | unsigned long offset; | ||
495 | int optype; | ||
496 | int size; | ||
497 | int img_type; | ||
498 | }; | ||
499 | |||
500 | struct image_hdr { | ||
501 | u32 imageid; | ||
502 | u32 imageoffset; | ||
503 | u32 imagelength; | ||
504 | u32 image_checksum; | ||
505 | u8 image_version[32]; | ||
506 | }; | ||
507 | struct flash_file_hdr_g2 { | ||
508 | u8 sign[32]; | ||
509 | u32 cksum; | ||
510 | u32 antidote; | ||
511 | struct controller_id cont_id; | ||
512 | u32 file_len; | ||
513 | u32 chunk_num; | ||
514 | u32 total_chunks; | ||
515 | u32 num_imgs; | ||
516 | u8 build[24]; | ||
517 | }; | ||
518 | |||
519 | struct flash_file_hdr_g3 { | ||
520 | u8 sign[52]; | ||
521 | u8 ufi_version[4]; | ||
522 | u32 file_len; | ||
523 | u32 cksum; | ||
524 | u32 antidote; | ||
525 | u32 num_imgs; | ||
526 | u8 build[24]; | ||
527 | u8 asic_type_rev; | ||
528 | u8 rsvd[31]; | ||
529 | }; | ||
530 | |||
531 | struct flash_section_hdr { | ||
532 | u32 format_rev; | ||
533 | u32 cksum; | ||
534 | u32 antidote; | ||
535 | u32 num_images; | ||
536 | u8 id_string[128]; | ||
537 | u32 rsvd[4]; | ||
538 | } __packed; | ||
539 | |||
540 | struct flash_section_hdr_g2 { | ||
541 | u32 format_rev; | ||
542 | u32 cksum; | ||
543 | u32 antidote; | ||
544 | u32 build_num; | ||
545 | u8 id_string[128]; | ||
546 | u32 rsvd[8]; | ||
547 | } __packed; | ||
548 | |||
549 | struct flash_section_entry { | ||
550 | u32 type; | ||
551 | u32 offset; | ||
552 | u32 pad_size; | ||
553 | u32 image_size; | ||
554 | u32 cksum; | ||
555 | u32 entry_point; | ||
556 | u16 optype; | ||
557 | u16 rsvd0; | ||
558 | u32 rsvd1; | ||
559 | u8 ver_data[32]; | ||
560 | } __packed; | ||
561 | |||
562 | struct flash_section_info { | ||
563 | u8 cookie[32]; | ||
564 | struct flash_section_hdr fsec_hdr; | ||
565 | struct flash_section_entry fsec_entry[32]; | ||
566 | } __packed; | ||
567 | |||
568 | struct flash_section_info_g2 { | ||
569 | u8 cookie[32]; | ||
570 | struct flash_section_hdr_g2 fsec_hdr; | ||
571 | struct flash_section_entry fsec_entry[32]; | ||
572 | } __packed; | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index d48806b5cd88..598c5070c629 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -662,41 +662,22 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status) | |||
662 | netif_carrier_off(netdev); | 662 | netif_carrier_off(netdev); |
663 | } | 663 | } |
664 | 664 | ||
665 | static void be_tx_stats_update(struct be_tx_obj *txo, | 665 | static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb) |
666 | u32 wrb_cnt, u32 copied, u32 gso_segs, | ||
667 | bool stopped) | ||
668 | { | 666 | { |
669 | struct be_tx_stats *stats = tx_stats(txo); | 667 | struct be_tx_stats *stats = tx_stats(txo); |
670 | 668 | ||
671 | u64_stats_update_begin(&stats->sync); | 669 | u64_stats_update_begin(&stats->sync); |
672 | stats->tx_reqs++; | 670 | stats->tx_reqs++; |
673 | stats->tx_wrbs += wrb_cnt; | 671 | stats->tx_bytes += skb->len; |
674 | stats->tx_bytes += copied; | 672 | stats->tx_pkts += (skb_shinfo(skb)->gso_segs ? : 1); |
675 | stats->tx_pkts += (gso_segs ? gso_segs : 1); | ||
676 | if (stopped) | ||
677 | stats->tx_stops++; | ||
678 | u64_stats_update_end(&stats->sync); | 673 | u64_stats_update_end(&stats->sync); |
679 | } | 674 | } |
680 | 675 | ||
681 | /* Determine number of WRB entries needed to xmit data in an skb */ | 676 | /* Returns number of WRBs needed for the skb */ |
682 | static u32 wrb_cnt_for_skb(struct be_adapter *adapter, struct sk_buff *skb, | 677 | static u32 skb_wrb_cnt(struct sk_buff *skb) |
683 | bool *dummy) | ||
684 | { | 678 | { |
685 | int cnt = (skb->len > skb->data_len); | 679 | /* +1 for the header wrb */ |
686 | 680 | return 1 + (skb_headlen(skb) ? 1 : 0) + skb_shinfo(skb)->nr_frags; | |
687 | cnt += skb_shinfo(skb)->nr_frags; | ||
688 | |||
689 | /* to account for hdr wrb */ | ||
690 | cnt++; | ||
691 | if (lancer_chip(adapter) || !(cnt & 1)) { | ||
692 | *dummy = false; | ||
693 | } else { | ||
694 | /* add a dummy to make it an even num */ | ||
695 | cnt++; | ||
696 | *dummy = true; | ||
697 | } | ||
698 | BUG_ON(cnt > BE_MAX_TX_FRAG_COUNT); | ||
699 | return cnt; | ||
700 | } | 681 | } |
701 | 682 | ||
702 | static inline void wrb_fill(struct be_eth_wrb *wrb, u64 addr, int len) | 683 | static inline void wrb_fill(struct be_eth_wrb *wrb, u64 addr, int len) |
@@ -713,7 +694,7 @@ static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter, | |||
713 | u8 vlan_prio; | 694 | u8 vlan_prio; |
714 | u16 vlan_tag; | 695 | u16 vlan_tag; |
715 | 696 | ||
716 | vlan_tag = vlan_tx_tag_get(skb); | 697 | vlan_tag = skb_vlan_tag_get(skb); |
717 | vlan_prio = (vlan_tag & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; | 698 | vlan_prio = (vlan_tag & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; |
718 | /* If vlan priority provided by OS is NOT in available bmap */ | 699 | /* If vlan priority provided by OS is NOT in available bmap */ |
719 | if (!(adapter->vlan_prio_bmap & (1 << vlan_prio))) | 700 | if (!(adapter->vlan_prio_bmap & (1 << vlan_prio))) |
@@ -764,17 +745,20 @@ static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr, | |||
764 | SET_TX_WRB_HDR_BITS(udpcs, hdr, 1); | 745 | SET_TX_WRB_HDR_BITS(udpcs, hdr, 1); |
765 | } | 746 | } |
766 | 747 | ||
767 | if (vlan_tx_tag_present(skb)) { | 748 | if (skb_vlan_tag_present(skb)) { |
768 | SET_TX_WRB_HDR_BITS(vlan, hdr, 1); | 749 | SET_TX_WRB_HDR_BITS(vlan, hdr, 1); |
769 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 750 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
770 | SET_TX_WRB_HDR_BITS(vlan_tag, hdr, vlan_tag); | 751 | SET_TX_WRB_HDR_BITS(vlan_tag, hdr, vlan_tag); |
771 | } | 752 | } |
772 | 753 | ||
773 | /* To skip HW VLAN tagging: evt = 1, compl = 0 */ | ||
774 | SET_TX_WRB_HDR_BITS(complete, hdr, !skip_hw_vlan); | ||
775 | SET_TX_WRB_HDR_BITS(event, hdr, 1); | ||
776 | SET_TX_WRB_HDR_BITS(num_wrb, hdr, wrb_cnt); | 754 | SET_TX_WRB_HDR_BITS(num_wrb, hdr, wrb_cnt); |
777 | SET_TX_WRB_HDR_BITS(len, hdr, len); | 755 | SET_TX_WRB_HDR_BITS(len, hdr, len); |
756 | |||
757 | /* Hack to skip HW VLAN tagging needs evt = 1, compl = 0 | ||
758 | * When this hack is not needed, the evt bit is set while ringing DB | ||
759 | */ | ||
760 | if (skip_hw_vlan) | ||
761 | SET_TX_WRB_HDR_BITS(event, hdr, 1); | ||
778 | } | 762 | } |
779 | 763 | ||
780 | static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb, | 764 | static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb, |
@@ -794,22 +778,24 @@ static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb, | |||
794 | } | 778 | } |
795 | } | 779 | } |
796 | 780 | ||
797 | static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, | 781 | /* Returns the number of WRBs used up by the skb */ |
798 | struct sk_buff *skb, u32 wrb_cnt, bool dummy_wrb, | 782 | static u32 be_xmit_enqueue(struct be_adapter *adapter, struct be_tx_obj *txo, |
799 | bool skip_hw_vlan) | 783 | struct sk_buff *skb, bool skip_hw_vlan) |
800 | { | 784 | { |
801 | dma_addr_t busaddr; | 785 | u32 i, copied = 0, wrb_cnt = skb_wrb_cnt(skb); |
802 | int i, copied = 0; | ||
803 | struct device *dev = &adapter->pdev->dev; | 786 | struct device *dev = &adapter->pdev->dev; |
804 | struct sk_buff *first_skb = skb; | 787 | struct be_queue_info *txq = &txo->q; |
805 | struct be_eth_wrb *wrb; | ||
806 | struct be_eth_hdr_wrb *hdr; | 788 | struct be_eth_hdr_wrb *hdr; |
807 | bool map_single = false; | 789 | bool map_single = false; |
808 | u16 map_head; | 790 | struct be_eth_wrb *wrb; |
791 | dma_addr_t busaddr; | ||
792 | u16 head = txq->head; | ||
809 | 793 | ||
810 | hdr = queue_head_node(txq); | 794 | hdr = queue_head_node(txq); |
795 | wrb_fill_hdr(adapter, hdr, skb, wrb_cnt, skb->len, skip_hw_vlan); | ||
796 | be_dws_cpu_to_le(hdr, sizeof(*hdr)); | ||
797 | |||
811 | queue_head_inc(txq); | 798 | queue_head_inc(txq); |
812 | map_head = txq->head; | ||
813 | 799 | ||
814 | if (skb->len > skb->data_len) { | 800 | if (skb->len > skb->data_len) { |
815 | int len = skb_headlen(skb); | 801 | int len = skb_headlen(skb); |
@@ -839,19 +825,23 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, | |||
839 | copied += skb_frag_size(frag); | 825 | copied += skb_frag_size(frag); |
840 | } | 826 | } |
841 | 827 | ||
842 | if (dummy_wrb) { | 828 | BUG_ON(txo->sent_skb_list[head]); |
843 | wrb = queue_head_node(txq); | 829 | txo->sent_skb_list[head] = skb; |
844 | wrb_fill(wrb, 0, 0); | 830 | txo->last_req_hdr = head; |
845 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); | 831 | atomic_add(wrb_cnt, &txq->used); |
846 | queue_head_inc(txq); | 832 | txo->last_req_wrb_cnt = wrb_cnt; |
847 | } | 833 | txo->pend_wrb_cnt += wrb_cnt; |
848 | 834 | ||
849 | wrb_fill_hdr(adapter, hdr, first_skb, wrb_cnt, copied, skip_hw_vlan); | 835 | be_tx_stats_update(txo, skb); |
850 | be_dws_cpu_to_le(hdr, sizeof(*hdr)); | 836 | return wrb_cnt; |
851 | 837 | ||
852 | return copied; | ||
853 | dma_err: | 838 | dma_err: |
854 | txq->head = map_head; | 839 | /* Bring the queue back to the state it was in before this |
840 | * routine was invoked. | ||
841 | */ | ||
842 | txq->head = head; | ||
843 | /* skip the first wrb (hdr); it's not mapped */ | ||
844 | queue_head_inc(txq); | ||
855 | while (copied) { | 845 | while (copied) { |
856 | wrb = queue_head_node(txq); | 846 | wrb = queue_head_node(txq); |
857 | unmap_tx_frag(dev, wrb, map_single); | 847 | unmap_tx_frag(dev, wrb, map_single); |
@@ -860,6 +850,7 @@ dma_err: | |||
860 | adapter->drv_stats.dma_map_errors++; | 850 | adapter->drv_stats.dma_map_errors++; |
861 | queue_head_inc(txq); | 851 | queue_head_inc(txq); |
862 | } | 852 | } |
853 | txq->head = head; | ||
863 | return 0; | 854 | return 0; |
864 | } | 855 | } |
865 | 856 | ||
@@ -873,7 +864,7 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, | |||
873 | if (unlikely(!skb)) | 864 | if (unlikely(!skb)) |
874 | return skb; | 865 | return skb; |
875 | 866 | ||
876 | if (vlan_tx_tag_present(skb)) | 867 | if (skb_vlan_tag_present(skb)) |
877 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 868 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
878 | 869 | ||
879 | if (qnq_async_evt_rcvd(adapter) && adapter->pvid) { | 870 | if (qnq_async_evt_rcvd(adapter) && adapter->pvid) { |
@@ -932,7 +923,7 @@ static bool be_ipv6_exthdr_check(struct sk_buff *skb) | |||
932 | 923 | ||
933 | static int be_vlan_tag_tx_chk(struct be_adapter *adapter, struct sk_buff *skb) | 924 | static int be_vlan_tag_tx_chk(struct be_adapter *adapter, struct sk_buff *skb) |
934 | { | 925 | { |
935 | return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid; | 926 | return skb_vlan_tag_present(skb) || adapter->pvid || adapter->qnq_vid; |
936 | } | 927 | } |
937 | 928 | ||
938 | static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, struct sk_buff *skb) | 929 | static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, struct sk_buff *skb) |
@@ -955,7 +946,7 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, | |||
955 | eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ? | 946 | eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ? |
956 | VLAN_ETH_HLEN : ETH_HLEN; | 947 | VLAN_ETH_HLEN : ETH_HLEN; |
957 | if (skb->len <= 60 && | 948 | if (skb->len <= 60 && |
958 | (lancer_chip(adapter) || vlan_tx_tag_present(skb)) && | 949 | (lancer_chip(adapter) || skb_vlan_tag_present(skb)) && |
959 | is_ipv4_pkt(skb)) { | 950 | is_ipv4_pkt(skb)) { |
960 | ip = (struct iphdr *)ip_hdr(skb); | 951 | ip = (struct iphdr *)ip_hdr(skb); |
961 | pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)); | 952 | pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)); |
@@ -973,7 +964,7 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, | |||
973 | * Manually insert VLAN in pkt. | 964 | * Manually insert VLAN in pkt. |
974 | */ | 965 | */ |
975 | if (skb->ip_summed != CHECKSUM_PARTIAL && | 966 | if (skb->ip_summed != CHECKSUM_PARTIAL && |
976 | vlan_tx_tag_present(skb)) { | 967 | skb_vlan_tag_present(skb)) { |
977 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); | 968 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); |
978 | if (unlikely(!skb)) | 969 | if (unlikely(!skb)) |
979 | goto err; | 970 | goto err; |
@@ -1030,52 +1021,64 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | |||
1030 | return skb; | 1021 | return skb; |
1031 | } | 1022 | } |
1032 | 1023 | ||
1024 | static void be_xmit_flush(struct be_adapter *adapter, struct be_tx_obj *txo) | ||
1025 | { | ||
1026 | struct be_queue_info *txq = &txo->q; | ||
1027 | struct be_eth_hdr_wrb *hdr = queue_index_node(txq, txo->last_req_hdr); | ||
1028 | |||
1029 | /* Mark the last request eventable if it hasn't been marked already */ | ||
1030 | if (!(hdr->dw[2] & cpu_to_le32(TX_HDR_WRB_EVT))) | ||
1031 | hdr->dw[2] |= cpu_to_le32(TX_HDR_WRB_EVT | TX_HDR_WRB_COMPL); | ||
1032 | |||
1033 | /* compose a dummy wrb if there are odd set of wrbs to notify */ | ||
1034 | if (!lancer_chip(adapter) && (txo->pend_wrb_cnt & 1)) { | ||
1035 | wrb_fill(queue_head_node(txq), 0, 0); | ||
1036 | queue_head_inc(txq); | ||
1037 | atomic_inc(&txq->used); | ||
1038 | txo->pend_wrb_cnt++; | ||
1039 | hdr->dw[2] &= ~cpu_to_le32(TX_HDR_WRB_NUM_MASK << | ||
1040 | TX_HDR_WRB_NUM_SHIFT); | ||
1041 | hdr->dw[2] |= cpu_to_le32((txo->last_req_wrb_cnt + 1) << | ||
1042 | TX_HDR_WRB_NUM_SHIFT); | ||
1043 | } | ||
1044 | be_txq_notify(adapter, txo, txo->pend_wrb_cnt); | ||
1045 | txo->pend_wrb_cnt = 0; | ||
1046 | } | ||
1047 | |||
1033 | static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) | 1048 | static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) |
1034 | { | 1049 | { |
1050 | bool skip_hw_vlan = false, flush = !skb->xmit_more; | ||
1035 | struct be_adapter *adapter = netdev_priv(netdev); | 1051 | struct be_adapter *adapter = netdev_priv(netdev); |
1036 | struct be_tx_obj *txo = &adapter->tx_obj[skb_get_queue_mapping(skb)]; | 1052 | u16 q_idx = skb_get_queue_mapping(skb); |
1053 | struct be_tx_obj *txo = &adapter->tx_obj[q_idx]; | ||
1037 | struct be_queue_info *txq = &txo->q; | 1054 | struct be_queue_info *txq = &txo->q; |
1038 | bool dummy_wrb, stopped = false; | 1055 | u16 wrb_cnt; |
1039 | u32 wrb_cnt = 0, copied = 0; | ||
1040 | bool skip_hw_vlan = false; | ||
1041 | u32 start = txq->head; | ||
1042 | 1056 | ||
1043 | skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan); | 1057 | skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan); |
1044 | if (!skb) { | 1058 | if (unlikely(!skb)) |
1045 | tx_stats(txo)->tx_drv_drops++; | 1059 | goto drop; |
1046 | return NETDEV_TX_OK; | ||
1047 | } | ||
1048 | 1060 | ||
1049 | wrb_cnt = wrb_cnt_for_skb(adapter, skb, &dummy_wrb); | 1061 | wrb_cnt = be_xmit_enqueue(adapter, txo, skb, skip_hw_vlan); |
1062 | if (unlikely(!wrb_cnt)) { | ||
1063 | dev_kfree_skb_any(skb); | ||
1064 | goto drop; | ||
1065 | } | ||
1050 | 1066 | ||
1051 | copied = make_tx_wrbs(adapter, txq, skb, wrb_cnt, dummy_wrb, | 1067 | if ((atomic_read(&txq->used) + BE_MAX_TX_FRAG_COUNT) >= txq->len) { |
1052 | skip_hw_vlan); | 1068 | netif_stop_subqueue(netdev, q_idx); |
1053 | if (copied) { | 1069 | tx_stats(txo)->tx_stops++; |
1054 | int gso_segs = skb_shinfo(skb)->gso_segs; | 1070 | } |
1055 | 1071 | ||
1056 | /* record the sent skb in the sent_skb table */ | 1072 | if (flush || __netif_subqueue_stopped(netdev, q_idx)) |
1057 | BUG_ON(txo->sent_skb_list[start]); | 1073 | be_xmit_flush(adapter, txo); |
1058 | txo->sent_skb_list[start] = skb; | ||
1059 | 1074 | ||
1060 | /* Ensure txq has space for the next skb; Else stop the queue | 1075 | return NETDEV_TX_OK; |
1061 | * *BEFORE* ringing the tx doorbell, so that we serialze the | 1076 | drop: |
1062 | * tx compls of the current transmit which'll wake up the queue | 1077 | tx_stats(txo)->tx_drv_drops++; |
1063 | */ | 1078 | /* Flush the already enqueued tx requests */ |
1064 | atomic_add(wrb_cnt, &txq->used); | 1079 | if (flush && txo->pend_wrb_cnt) |
1065 | if ((BE_MAX_TX_FRAG_COUNT + atomic_read(&txq->used)) >= | 1080 | be_xmit_flush(adapter, txo); |
1066 | txq->len) { | ||
1067 | netif_stop_subqueue(netdev, skb_get_queue_mapping(skb)); | ||
1068 | stopped = true; | ||
1069 | } | ||
1070 | |||
1071 | be_txq_notify(adapter, txo, wrb_cnt); | ||
1072 | 1081 | ||
1073 | be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped); | ||
1074 | } else { | ||
1075 | txq->head = start; | ||
1076 | tx_stats(txo)->tx_drv_drops++; | ||
1077 | dev_kfree_skb_any(skb); | ||
1078 | } | ||
1079 | return NETDEV_TX_OK; | 1082 | return NETDEV_TX_OK; |
1080 | } | 1083 | } |
1081 | 1084 | ||
@@ -1959,32 +1962,34 @@ static struct be_eth_tx_compl *be_tx_compl_get(struct be_queue_info *tx_cq) | |||
1959 | static u16 be_tx_compl_process(struct be_adapter *adapter, | 1962 | static u16 be_tx_compl_process(struct be_adapter *adapter, |
1960 | struct be_tx_obj *txo, u16 last_index) | 1963 | struct be_tx_obj *txo, u16 last_index) |
1961 | { | 1964 | { |
1965 | struct sk_buff **sent_skbs = txo->sent_skb_list; | ||
1962 | struct be_queue_info *txq = &txo->q; | 1966 | struct be_queue_info *txq = &txo->q; |
1967 | u16 frag_index, num_wrbs = 0; | ||
1968 | struct sk_buff *skb = NULL; | ||
1969 | bool unmap_skb_hdr = false; | ||
1963 | struct be_eth_wrb *wrb; | 1970 | struct be_eth_wrb *wrb; |
1964 | struct sk_buff **sent_skbs = txo->sent_skb_list; | ||
1965 | struct sk_buff *sent_skb; | ||
1966 | u16 cur_index, num_wrbs = 1; /* account for hdr wrb */ | ||
1967 | bool unmap_skb_hdr = true; | ||
1968 | |||
1969 | sent_skb = sent_skbs[txq->tail]; | ||
1970 | BUG_ON(!sent_skb); | ||
1971 | sent_skbs[txq->tail] = NULL; | ||
1972 | |||
1973 | /* skip header wrb */ | ||
1974 | queue_tail_inc(txq); | ||
1975 | 1971 | ||
1976 | do { | 1972 | do { |
1977 | cur_index = txq->tail; | 1973 | if (sent_skbs[txq->tail]) { |
1974 | /* Free skb from prev req */ | ||
1975 | if (skb) | ||
1976 | dev_consume_skb_any(skb); | ||
1977 | skb = sent_skbs[txq->tail]; | ||
1978 | sent_skbs[txq->tail] = NULL; | ||
1979 | queue_tail_inc(txq); /* skip hdr wrb */ | ||
1980 | num_wrbs++; | ||
1981 | unmap_skb_hdr = true; | ||
1982 | } | ||
1978 | wrb = queue_tail_node(txq); | 1983 | wrb = queue_tail_node(txq); |
1984 | frag_index = txq->tail; | ||
1979 | unmap_tx_frag(&adapter->pdev->dev, wrb, | 1985 | unmap_tx_frag(&adapter->pdev->dev, wrb, |
1980 | (unmap_skb_hdr && skb_headlen(sent_skb))); | 1986 | (unmap_skb_hdr && skb_headlen(skb))); |
1981 | unmap_skb_hdr = false; | 1987 | unmap_skb_hdr = false; |
1982 | |||
1983 | num_wrbs++; | ||
1984 | queue_tail_inc(txq); | 1988 | queue_tail_inc(txq); |
1985 | } while (cur_index != last_index); | 1989 | num_wrbs++; |
1990 | } while (frag_index != last_index); | ||
1991 | dev_consume_skb_any(skb); | ||
1986 | 1992 | ||
1987 | dev_consume_skb_any(sent_skb); | ||
1988 | return num_wrbs; | 1993 | return num_wrbs; |
1989 | } | 1994 | } |
1990 | 1995 | ||
@@ -2068,12 +2073,11 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo) | |||
2068 | 2073 | ||
2069 | static void be_tx_compl_clean(struct be_adapter *adapter) | 2074 | static void be_tx_compl_clean(struct be_adapter *adapter) |
2070 | { | 2075 | { |
2076 | u16 end_idx, notified_idx, cmpl = 0, timeo = 0, num_wrbs = 0; | ||
2077 | struct device *dev = &adapter->pdev->dev; | ||
2071 | struct be_tx_obj *txo; | 2078 | struct be_tx_obj *txo; |
2072 | struct be_queue_info *txq; | 2079 | struct be_queue_info *txq; |
2073 | struct be_eth_tx_compl *txcp; | 2080 | struct be_eth_tx_compl *txcp; |
2074 | u16 end_idx, cmpl = 0, timeo = 0, num_wrbs = 0; | ||
2075 | struct sk_buff *sent_skb; | ||
2076 | bool dummy_wrb; | ||
2077 | int i, pending_txqs; | 2081 | int i, pending_txqs; |
2078 | 2082 | ||
2079 | /* Stop polling for compls when HW has been silent for 10ms */ | 2083 | /* Stop polling for compls when HW has been silent for 10ms */ |
@@ -2095,7 +2099,7 @@ static void be_tx_compl_clean(struct be_adapter *adapter) | |||
2095 | atomic_sub(num_wrbs, &txq->used); | 2099 | atomic_sub(num_wrbs, &txq->used); |
2096 | timeo = 0; | 2100 | timeo = 0; |
2097 | } | 2101 | } |
2098 | if (atomic_read(&txq->used) == 0) | 2102 | if (atomic_read(&txq->used) == txo->pend_wrb_cnt) |
2099 | pending_txqs--; | 2103 | pending_txqs--; |
2100 | } | 2104 | } |
2101 | 2105 | ||
@@ -2105,21 +2109,29 @@ static void be_tx_compl_clean(struct be_adapter *adapter) | |||
2105 | mdelay(1); | 2109 | mdelay(1); |
2106 | } while (true); | 2110 | } while (true); |
2107 | 2111 | ||
2112 | /* Free enqueued TX that was never notified to HW */ | ||
2108 | for_all_tx_queues(adapter, txo, i) { | 2113 | for_all_tx_queues(adapter, txo, i) { |
2109 | txq = &txo->q; | 2114 | txq = &txo->q; |
2110 | if (atomic_read(&txq->used)) | ||
2111 | dev_err(&adapter->pdev->dev, "%d pending tx-compls\n", | ||
2112 | atomic_read(&txq->used)); | ||
2113 | 2115 | ||
2114 | /* free posted tx for which compls will never arrive */ | 2116 | if (atomic_read(&txq->used)) { |
2115 | while (atomic_read(&txq->used)) { | 2117 | dev_info(dev, "txq%d: cleaning %d pending tx-wrbs\n", |
2116 | sent_skb = txo->sent_skb_list[txq->tail]; | 2118 | i, atomic_read(&txq->used)); |
2119 | notified_idx = txq->tail; | ||
2117 | end_idx = txq->tail; | 2120 | end_idx = txq->tail; |
2118 | num_wrbs = wrb_cnt_for_skb(adapter, sent_skb, | 2121 | index_adv(&end_idx, atomic_read(&txq->used) - 1, |
2119 | &dummy_wrb); | 2122 | txq->len); |
2120 | index_adv(&end_idx, num_wrbs - 1, txq->len); | 2123 | /* Use the tx-compl process logic to handle requests |
2124 | * that were not sent to the HW. | ||
2125 | */ | ||
2121 | num_wrbs = be_tx_compl_process(adapter, txo, end_idx); | 2126 | num_wrbs = be_tx_compl_process(adapter, txo, end_idx); |
2122 | atomic_sub(num_wrbs, &txq->used); | 2127 | atomic_sub(num_wrbs, &txq->used); |
2128 | BUG_ON(atomic_read(&txq->used)); | ||
2129 | txo->pend_wrb_cnt = 0; | ||
2130 | /* Since hw was never notified of these requests, | ||
2131 | * reset TXQ indices | ||
2132 | */ | ||
2133 | txq->head = notified_idx; | ||
2134 | txq->tail = notified_idx; | ||
2123 | } | 2135 | } |
2124 | } | 2136 | } |
2125 | } | 2137 | } |
@@ -3171,13 +3183,32 @@ static int be_clear(struct be_adapter *adapter) | |||
3171 | return 0; | 3183 | return 0; |
3172 | } | 3184 | } |
3173 | 3185 | ||
3186 | static int be_if_create(struct be_adapter *adapter, u32 *if_handle, | ||
3187 | u32 cap_flags, u32 vf) | ||
3188 | { | ||
3189 | u32 en_flags; | ||
3190 | int status; | ||
3191 | |||
3192 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | ||
3193 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS | | ||
3194 | BE_IF_FLAGS_RSS; | ||
3195 | |||
3196 | en_flags &= cap_flags; | ||
3197 | |||
3198 | status = be_cmd_if_create(adapter, cap_flags, en_flags, | ||
3199 | if_handle, vf); | ||
3200 | |||
3201 | return status; | ||
3202 | } | ||
3203 | |||
3174 | static int be_vfs_if_create(struct be_adapter *adapter) | 3204 | static int be_vfs_if_create(struct be_adapter *adapter) |
3175 | { | 3205 | { |
3176 | struct be_resources res = {0}; | 3206 | struct be_resources res = {0}; |
3177 | struct be_vf_cfg *vf_cfg; | 3207 | struct be_vf_cfg *vf_cfg; |
3178 | u32 cap_flags, en_flags, vf; | 3208 | u32 cap_flags, vf; |
3179 | int status = 0; | 3209 | int status; |
3180 | 3210 | ||
3211 | /* If a FW profile exists, then cap_flags are updated */ | ||
3181 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | 3212 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | |
3182 | BE_IF_FLAGS_MULTICAST; | 3213 | BE_IF_FLAGS_MULTICAST; |
3183 | 3214 | ||
@@ -3189,18 +3220,13 @@ static int be_vfs_if_create(struct be_adapter *adapter) | |||
3189 | cap_flags = res.if_cap_flags; | 3220 | cap_flags = res.if_cap_flags; |
3190 | } | 3221 | } |
3191 | 3222 | ||
3192 | /* If a FW profile exists, then cap_flags are updated */ | 3223 | status = be_if_create(adapter, &vf_cfg->if_handle, |
3193 | en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | | 3224 | cap_flags, vf + 1); |
3194 | BE_IF_FLAGS_BROADCAST | | ||
3195 | BE_IF_FLAGS_MULTICAST); | ||
3196 | status = | ||
3197 | be_cmd_if_create(adapter, cap_flags, en_flags, | ||
3198 | &vf_cfg->if_handle, vf + 1); | ||
3199 | if (status) | 3225 | if (status) |
3200 | goto err; | 3226 | return status; |
3201 | } | 3227 | } |
3202 | err: | 3228 | |
3203 | return status; | 3229 | return 0; |
3204 | } | 3230 | } |
3205 | 3231 | ||
3206 | static int be_vf_setup_init(struct be_adapter *adapter) | 3232 | static int be_vf_setup_init(struct be_adapter *adapter) |
@@ -3641,7 +3667,6 @@ int be_update_queues(struct be_adapter *adapter) | |||
3641 | static int be_setup(struct be_adapter *adapter) | 3667 | static int be_setup(struct be_adapter *adapter) |
3642 | { | 3668 | { |
3643 | struct device *dev = &adapter->pdev->dev; | 3669 | struct device *dev = &adapter->pdev->dev; |
3644 | u32 tx_fc, rx_fc, en_flags; | ||
3645 | int status; | 3670 | int status; |
3646 | 3671 | ||
3647 | be_setup_init(adapter); | 3672 | be_setup_init(adapter); |
@@ -3657,13 +3682,8 @@ static int be_setup(struct be_adapter *adapter) | |||
3657 | if (status) | 3682 | if (status) |
3658 | goto err; | 3683 | goto err; |
3659 | 3684 | ||
3660 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | 3685 | status = be_if_create(adapter, &adapter->if_handle, |
3661 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS; | 3686 | be_if_cap_flags(adapter), 0); |
3662 | if (adapter->function_caps & BE_FUNCTION_CAPS_RSS) | ||
3663 | en_flags |= BE_IF_FLAGS_RSS; | ||
3664 | en_flags = en_flags & be_if_cap_flags(adapter); | ||
3665 | status = be_cmd_if_create(adapter, be_if_cap_flags(adapter), en_flags, | ||
3666 | &adapter->if_handle, 0); | ||
3667 | if (status) | 3687 | if (status) |
3668 | goto err; | 3688 | goto err; |
3669 | 3689 | ||
@@ -3696,11 +3716,14 @@ static int be_setup(struct be_adapter *adapter) | |||
3696 | 3716 | ||
3697 | be_cmd_get_acpi_wol_cap(adapter); | 3717 | be_cmd_get_acpi_wol_cap(adapter); |
3698 | 3718 | ||
3699 | be_cmd_get_flow_control(adapter, &tx_fc, &rx_fc); | 3719 | status = be_cmd_set_flow_control(adapter, adapter->tx_fc, |
3720 | adapter->rx_fc); | ||
3721 | if (status) | ||
3722 | be_cmd_get_flow_control(adapter, &adapter->tx_fc, | ||
3723 | &adapter->rx_fc); | ||
3700 | 3724 | ||
3701 | if (rx_fc != adapter->rx_fc || tx_fc != adapter->tx_fc) | 3725 | dev_info(&adapter->pdev->dev, "HW Flow control - TX:%d RX:%d\n", |
3702 | be_cmd_set_flow_control(adapter, adapter->tx_fc, | 3726 | adapter->tx_fc, adapter->rx_fc); |
3703 | adapter->rx_fc); | ||
3704 | 3727 | ||
3705 | if (be_physfn(adapter)) | 3728 | if (be_physfn(adapter)) |
3706 | be_cmd_set_logical_link_config(adapter, | 3729 | be_cmd_set_logical_link_config(adapter, |
@@ -3739,7 +3762,7 @@ static char flash_cookie[2][16] = {"*** SE FLAS", "H DIRECTORY *** "}; | |||
3739 | 3762 | ||
3740 | static bool phy_flashing_required(struct be_adapter *adapter) | 3763 | static bool phy_flashing_required(struct be_adapter *adapter) |
3741 | { | 3764 | { |
3742 | return (adapter->phy.phy_type == TN_8022 && | 3765 | return (adapter->phy.phy_type == PHY_TYPE_TN_8022 && |
3743 | adapter->phy.interface_type == PHY_TYPE_BASET_10GB); | 3766 | adapter->phy.interface_type == PHY_TYPE_BASET_10GB); |
3744 | } | 3767 | } |
3745 | 3768 | ||
@@ -5083,6 +5106,10 @@ static int be_resume(struct pci_dev *pdev) | |||
5083 | if (status) | 5106 | if (status) |
5084 | return status; | 5107 | return status; |
5085 | 5108 | ||
5109 | status = be_cmd_reset_function(adapter); | ||
5110 | if (status) | ||
5111 | return status; | ||
5112 | |||
5086 | be_intr_set(adapter, true); | 5113 | be_intr_set(adapter, true); |
5087 | /* tell fw we're ready to fire cmds */ | 5114 | /* tell fw we're ready to fire cmds */ |
5088 | status = be_cmd_fw_init(adapter); | 5115 | status = be_cmd_fw_init(adapter); |