| .. | .. |
|---|
| 74 | 74 | __stringify(BCM_5710_FW_MINOR_VERSION) "." \ |
|---|
| 75 | 75 | __stringify(BCM_5710_FW_REVISION_VERSION) "." \ |
|---|
| 76 | 76 | __stringify(BCM_5710_FW_ENGINEERING_VERSION) |
|---|
| 77 | + |
|---|
| 78 | +#define FW_FILE_VERSION_V15 \ |
|---|
| 79 | + __stringify(BCM_5710_FW_MAJOR_VERSION) "." \ |
|---|
| 80 | + __stringify(BCM_5710_FW_MINOR_VERSION) "." \ |
|---|
| 81 | + __stringify(BCM_5710_FW_REVISION_VERSION_V15) "." \ |
|---|
| 82 | + __stringify(BCM_5710_FW_ENGINEERING_VERSION) |
|---|
| 83 | + |
|---|
| 77 | 84 | #define FW_FILE_NAME_E1 "bnx2x/bnx2x-e1-" FW_FILE_VERSION ".fw" |
|---|
| 78 | 85 | #define FW_FILE_NAME_E1H "bnx2x/bnx2x-e1h-" FW_FILE_VERSION ".fw" |
|---|
| 79 | 86 | #define FW_FILE_NAME_E2 "bnx2x/bnx2x-e2-" FW_FILE_VERSION ".fw" |
|---|
| 87 | +#define FW_FILE_NAME_E1_V15 "bnx2x/bnx2x-e1-" FW_FILE_VERSION_V15 ".fw" |
|---|
| 88 | +#define FW_FILE_NAME_E1H_V15 "bnx2x/bnx2x-e1h-" FW_FILE_VERSION_V15 ".fw" |
|---|
| 89 | +#define FW_FILE_NAME_E2_V15 "bnx2x/bnx2x-e2-" FW_FILE_VERSION_V15 ".fw" |
|---|
| 80 | 90 | |
|---|
| 81 | 91 | /* Time in jiffies before concluding the transmitter is hung */ |
|---|
| 82 | 92 | #define TX_TIMEOUT (5*HZ) |
|---|
| 83 | | - |
|---|
| 84 | | -static char version[] = |
|---|
| 85 | | - "QLogic 5771x/578xx 10/20-Gigabit Ethernet Driver " |
|---|
| 86 | | - DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
|---|
| 87 | 93 | |
|---|
| 88 | 94 | MODULE_AUTHOR("Eliezer Tamir"); |
|---|
| 89 | 95 | MODULE_DESCRIPTION("QLogic " |
|---|
| .. | .. |
|---|
| 91 | 97 | "57712/57712_MF/57800/57800_MF/57810/57810_MF/" |
|---|
| 92 | 98 | "57840/57840_MF Driver"); |
|---|
| 93 | 99 | MODULE_LICENSE("GPL"); |
|---|
| 94 | | -MODULE_VERSION(DRV_MODULE_VERSION); |
|---|
| 95 | 100 | MODULE_FIRMWARE(FW_FILE_NAME_E1); |
|---|
| 96 | 101 | MODULE_FIRMWARE(FW_FILE_NAME_E1H); |
|---|
| 97 | 102 | MODULE_FIRMWARE(FW_FILE_NAME_E2); |
|---|
| 103 | +MODULE_FIRMWARE(FW_FILE_NAME_E1_V15); |
|---|
| 104 | +MODULE_FIRMWARE(FW_FILE_NAME_E1H_V15); |
|---|
| 105 | +MODULE_FIRMWARE(FW_FILE_NAME_E2_V15); |
|---|
| 98 | 106 | |
|---|
| 99 | 107 | int bnx2x_num_queues; |
|---|
| 100 | 108 | module_param_named(num_queues, bnx2x_num_queues, int, 0444); |
|---|
| .. | .. |
|---|
| 280 | 288 | }; |
|---|
| 281 | 289 | |
|---|
| 282 | 290 | MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); |
|---|
| 291 | + |
|---|
| 292 | +const u32 dmae_reg_go_c[] = { |
|---|
| 293 | + DMAE_REG_GO_C0, DMAE_REG_GO_C1, DMAE_REG_GO_C2, DMAE_REG_GO_C3, |
|---|
| 294 | + DMAE_REG_GO_C4, DMAE_REG_GO_C5, DMAE_REG_GO_C6, DMAE_REG_GO_C7, |
|---|
| 295 | + DMAE_REG_GO_C8, DMAE_REG_GO_C9, DMAE_REG_GO_C10, DMAE_REG_GO_C11, |
|---|
| 296 | + DMAE_REG_GO_C12, DMAE_REG_GO_C13, DMAE_REG_GO_C14, DMAE_REG_GO_C15 |
|---|
| 297 | +}; |
|---|
| 283 | 298 | |
|---|
| 284 | 299 | /* Global resources for unloading a previously loaded device */ |
|---|
| 285 | 300 | #define BNX2X_PREV_WAIT_NEEDED 1 |
|---|
| .. | .. |
|---|
| 745 | 760 | CHIP_IS_E1(bp) ? "everest1" : |
|---|
| 746 | 761 | CHIP_IS_E1H(bp) ? "everest1h" : |
|---|
| 747 | 762 | CHIP_IS_E2(bp) ? "everest2" : "everest3", |
|---|
| 748 | | - BCM_5710_FW_MAJOR_VERSION, |
|---|
| 749 | | - BCM_5710_FW_MINOR_VERSION, |
|---|
| 750 | | - BCM_5710_FW_REVISION_VERSION); |
|---|
| 763 | + bp->fw_major, bp->fw_minor, bp->fw_rev); |
|---|
| 751 | 764 | |
|---|
| 752 | 765 | return rc; |
|---|
| 753 | 766 | } |
|---|
| .. | .. |
|---|
| 869 | 882 | "write %x to HC %d (addr 0x%x)\n", |
|---|
| 870 | 883 | val, port, addr); |
|---|
| 871 | 884 | |
|---|
| 872 | | - /* flush all outstanding writes */ |
|---|
| 873 | | - mmiowb(); |
|---|
| 874 | | - |
|---|
| 875 | 885 | REG_WR(bp, addr, val); |
|---|
| 876 | 886 | if (REG_RD(bp, addr) != val) |
|---|
| 877 | 887 | BNX2X_ERR("BUG! Proper val not read from IGU!\n"); |
|---|
| .. | .. |
|---|
| 886 | 896 | IGU_PF_CONF_ATTN_BIT_EN); |
|---|
| 887 | 897 | |
|---|
| 888 | 898 | DP(NETIF_MSG_IFDOWN, "write %x to IGU\n", val); |
|---|
| 889 | | - |
|---|
| 890 | | - /* flush all outstanding writes */ |
|---|
| 891 | | - mmiowb(); |
|---|
| 892 | 899 | |
|---|
| 893 | 900 | REG_WR(bp, IGU_REG_PF_CONFIGURATION, val); |
|---|
| 894 | 901 | if (REG_RD(bp, IGU_REG_PF_CONFIGURATION) != val) |
|---|
| .. | .. |
|---|
| 1180 | 1187 | } |
|---|
| 1181 | 1188 | #endif |
|---|
| 1182 | 1189 | if (IS_PF(bp)) { |
|---|
| 1190 | + int tmp_msg_en = bp->msg_enable; |
|---|
| 1191 | + |
|---|
| 1183 | 1192 | bnx2x_fw_dump(bp); |
|---|
| 1193 | + bp->msg_enable |= NETIF_MSG_HW; |
|---|
| 1194 | + BNX2X_ERR("Idle check (1st round) ----------\n"); |
|---|
| 1195 | + bnx2x_idle_chk(bp); |
|---|
| 1196 | + BNX2X_ERR("Idle check (2nd round) ----------\n"); |
|---|
| 1197 | + bnx2x_idle_chk(bp); |
|---|
| 1198 | + bp->msg_enable = tmp_msg_en; |
|---|
| 1184 | 1199 | bnx2x_mc_assert(bp); |
|---|
| 1185 | 1200 | } |
|---|
| 1201 | + |
|---|
| 1186 | 1202 | BNX2X_ERR("end crash dump -----------------\n"); |
|---|
| 1187 | 1203 | } |
|---|
| 1188 | 1204 | |
|---|
| .. | .. |
|---|
| 1595 | 1611 | /* |
|---|
| 1596 | 1612 | * Ensure that HC_CONFIG is written before leading/trailing edge config |
|---|
| 1597 | 1613 | */ |
|---|
| 1598 | | - mmiowb(); |
|---|
| 1599 | 1614 | barrier(); |
|---|
| 1600 | 1615 | |
|---|
| 1601 | 1616 | if (!CHIP_IS_E1(bp)) { |
|---|
| .. | .. |
|---|
| 1611 | 1626 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, val); |
|---|
| 1612 | 1627 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, val); |
|---|
| 1613 | 1628 | } |
|---|
| 1614 | | - |
|---|
| 1615 | | - /* Make sure that interrupts are indeed enabled from here on */ |
|---|
| 1616 | | - mmiowb(); |
|---|
| 1617 | 1629 | } |
|---|
| 1618 | 1630 | |
|---|
| 1619 | 1631 | static void bnx2x_igu_int_enable(struct bnx2x *bp) |
|---|
| .. | .. |
|---|
| 1674 | 1686 | |
|---|
| 1675 | 1687 | REG_WR(bp, IGU_REG_TRAILING_EDGE_LATCH, val); |
|---|
| 1676 | 1688 | REG_WR(bp, IGU_REG_LEADING_EDGE_LATCH, val); |
|---|
| 1677 | | - |
|---|
| 1678 | | - /* Make sure that interrupts are indeed enabled from here on */ |
|---|
| 1679 | | - mmiowb(); |
|---|
| 1680 | 1689 | } |
|---|
| 1681 | 1690 | |
|---|
| 1682 | 1691 | void bnx2x_int_enable(struct bnx2x *bp) |
|---|
| .. | .. |
|---|
| 3088 | 3097 | /** |
|---|
| 3089 | 3098 | * bnx2x_get_common_flags - Return common flags |
|---|
| 3090 | 3099 | * |
|---|
| 3091 | | - * @bp device handle |
|---|
| 3092 | | - * @fp queue handle |
|---|
| 3093 | | - * @zero_stats TRUE if statistics zeroing is needed |
|---|
| 3100 | + * @bp: device handle |
|---|
| 3101 | + * @fp: queue handle |
|---|
| 3102 | + * @zero_stats: TRUE if statistics zeroing is needed |
|---|
| 3094 | 3103 | * |
|---|
| 3095 | 3104 | * Return the flags that are common for the Tx-only and not normal connections. |
|---|
| 3096 | 3105 | */ |
|---|
| .. | .. |
|---|
| 3833 | 3842 | |
|---|
| 3834 | 3843 | REG_WR16_RELAXED(bp, BAR_XSTRORM_INTMEM + XSTORM_SPQ_PROD_OFFSET(func), |
|---|
| 3835 | 3844 | bp->spq_prod_idx); |
|---|
| 3836 | | - mmiowb(); |
|---|
| 3837 | 3845 | } |
|---|
| 3838 | 3846 | |
|---|
| 3839 | 3847 | /** |
|---|
| .. | .. |
|---|
| 5244 | 5252 | { |
|---|
| 5245 | 5253 | /* No memory barriers */ |
|---|
| 5246 | 5254 | storm_memset_eq_prod(bp, prod, BP_FUNC(bp)); |
|---|
| 5247 | | - mmiowb(); /* keep prod updates ordered */ |
|---|
| 5248 | 5255 | } |
|---|
| 5249 | 5256 | |
|---|
| 5250 | 5257 | static int bnx2x_cnic_handle_cfc_del(struct bnx2x *bp, u32 cid, |
|---|
| .. | .. |
|---|
| 6317 | 6324 | case FW_MSG_CODE_DRV_LOAD_COMMON: |
|---|
| 6318 | 6325 | case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP: |
|---|
| 6319 | 6326 | bnx2x_init_internal_common(bp); |
|---|
| 6320 | | - /* no break */ |
|---|
| 6327 | + fallthrough; |
|---|
| 6321 | 6328 | |
|---|
| 6322 | 6329 | case FW_MSG_CODE_DRV_LOAD_PORT: |
|---|
| 6323 | 6330 | /* nothing to do */ |
|---|
| 6324 | | - /* no break */ |
|---|
| 6331 | + fallthrough; |
|---|
| 6325 | 6332 | |
|---|
| 6326 | 6333 | case FW_MSG_CODE_DRV_LOAD_FUNCTION: |
|---|
| 6327 | 6334 | /* internal memory per function is |
|---|
| .. | .. |
|---|
| 6513 | 6520 | |
|---|
| 6514 | 6521 | /* flush all */ |
|---|
| 6515 | 6522 | mb(); |
|---|
| 6516 | | - mmiowb(); |
|---|
| 6517 | 6523 | } |
|---|
| 6518 | 6524 | |
|---|
| 6519 | 6525 | void bnx2x_pre_irq_nic_init(struct bnx2x *bp) |
|---|
| .. | .. |
|---|
| 6553 | 6559 | |
|---|
| 6554 | 6560 | /* flush all before enabling interrupts */ |
|---|
| 6555 | 6561 | mb(); |
|---|
| 6556 | | - mmiowb(); |
|---|
| 6557 | 6562 | |
|---|
| 6558 | 6563 | bnx2x_int_enable(bp); |
|---|
| 6559 | 6564 | |
|---|
| .. | .. |
|---|
| 7728 | 7733 | REG_WR(bp, reg_addr, val); |
|---|
| 7729 | 7734 | } |
|---|
| 7730 | 7735 | |
|---|
| 7736 | + if (CHIP_IS_E3B0(bp)) |
|---|
| 7737 | + bp->flags |= PTP_SUPPORTED; |
|---|
| 7738 | + |
|---|
| 7731 | 7739 | return 0; |
|---|
| 7732 | 7740 | } |
|---|
| 7733 | 7741 | |
|---|
| .. | .. |
|---|
| 7772 | 7780 | DP(NETIF_MSG_HW, "write 0x%08x to IGU(via GRC) addr 0x%x\n", |
|---|
| 7773 | 7781 | data, igu_addr_data); |
|---|
| 7774 | 7782 | REG_WR(bp, igu_addr_data, data); |
|---|
| 7775 | | - mmiowb(); |
|---|
| 7776 | 7783 | barrier(); |
|---|
| 7777 | 7784 | DP(NETIF_MSG_HW, "write 0x%08x to IGU(via GRC) addr 0x%x\n", |
|---|
| 7778 | 7785 | ctl, igu_addr_ctl); |
|---|
| 7779 | 7786 | REG_WR(bp, igu_addr_ctl, ctl); |
|---|
| 7780 | | - mmiowb(); |
|---|
| 7781 | 7787 | barrier(); |
|---|
| 7782 | 7788 | |
|---|
| 7783 | 7789 | /* wait for clean up to finish */ |
|---|
| .. | .. |
|---|
| 8605 | 8611 | bp->num_queues, |
|---|
| 8606 | 8612 | 1 + bp->num_cnic_queues); |
|---|
| 8607 | 8613 | |
|---|
| 8608 | | - /* fall through */ |
|---|
| 8614 | + fallthrough; |
|---|
| 8609 | 8615 | case BNX2X_INT_MODE_MSI: |
|---|
| 8610 | 8616 | bnx2x_enable_msi(bp); |
|---|
| 8611 | 8617 | |
|---|
| 8612 | | - /* fall through */ |
|---|
| 8618 | + fallthrough; |
|---|
| 8613 | 8619 | case BNX2X_INT_MODE_INTX: |
|---|
| 8614 | 8620 | bp->num_ethernet_queues = 1; |
|---|
| 8615 | 8621 | bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; |
|---|
| .. | .. |
|---|
| 9462 | 9468 | * function stop ramrod is sent, since as part of this ramrod FW access |
|---|
| 9463 | 9469 | * PTP registers. |
|---|
| 9464 | 9470 | */ |
|---|
| 9465 | | - if (bp->flags & PTP_SUPPORTED) |
|---|
| 9471 | + if (bp->flags & PTP_SUPPORTED) { |
|---|
| 9466 | 9472 | bnx2x_stop_ptp(bp); |
|---|
| 9473 | + if (bp->ptp_clock) { |
|---|
| 9474 | + ptp_clock_unregister(bp->ptp_clock); |
|---|
| 9475 | + bp->ptp_clock = NULL; |
|---|
| 9476 | + } |
|---|
| 9477 | + } |
|---|
| 9467 | 9478 | |
|---|
| 9468 | 9479 | /* Disable HW interrupts, NAPI */ |
|---|
| 9469 | 9480 | bnx2x_netif_stop(bp, 1); |
|---|
| .. | .. |
|---|
| 9549 | 9560 | |
|---|
| 9550 | 9561 | DP(NETIF_MSG_HW | NETIF_MSG_IFUP, "%s gates #2, #3 and #4\n", |
|---|
| 9551 | 9562 | close ? "closing" : "opening"); |
|---|
| 9552 | | - mmiowb(); |
|---|
| 9553 | 9563 | } |
|---|
| 9554 | 9564 | |
|---|
| 9555 | 9565 | #define SHARED_MF_CLP_MAGIC 0x80000000 /* `magic' bit */ |
|---|
| .. | .. |
|---|
| 9673 | 9683 | if (!CHIP_IS_E1(bp)) { |
|---|
| 9674 | 9684 | REG_WR(bp, PXP2_REG_RD_START_INIT, 0); |
|---|
| 9675 | 9685 | REG_WR(bp, PXP2_REG_RQ_RBC_DONE, 0); |
|---|
| 9676 | | - mmiowb(); |
|---|
| 9677 | 9686 | } |
|---|
| 9678 | 9687 | } |
|---|
| 9679 | 9688 | |
|---|
| .. | .. |
|---|
| 9773 | 9782 | reset_mask1 & (~not_reset_mask1)); |
|---|
| 9774 | 9783 | |
|---|
| 9775 | 9784 | barrier(); |
|---|
| 9776 | | - mmiowb(); |
|---|
| 9777 | 9785 | |
|---|
| 9778 | 9786 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, |
|---|
| 9779 | 9787 | reset_mask2 & (~stay_reset2)); |
|---|
| 9780 | 9788 | |
|---|
| 9781 | 9789 | barrier(); |
|---|
| 9782 | | - mmiowb(); |
|---|
| 9783 | 9790 | |
|---|
| 9784 | 9791 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, reset_mask1); |
|---|
| 9785 | | - mmiowb(); |
|---|
| 9786 | 9792 | } |
|---|
| 9787 | 9793 | |
|---|
| 9788 | 9794 | /** |
|---|
| .. | .. |
|---|
| 9865 | 9871 | /* Clear "unprepared" bit */ |
|---|
| 9866 | 9872 | REG_WR(bp, MISC_REG_UNPREPARED, 0); |
|---|
| 9867 | 9873 | barrier(); |
|---|
| 9868 | | - |
|---|
| 9869 | | - /* Make sure all is written to the chip before the reset */ |
|---|
| 9870 | | - mmiowb(); |
|---|
| 9871 | 9874 | |
|---|
| 9872 | 9875 | /* Wait for 1ms to empty GLUE and PCI-E core queues, |
|---|
| 9873 | 9876 | * PSWHST, GRC and PSWRD Tetris buffer. |
|---|
| .. | .. |
|---|
| 10160 | 10163 | { |
|---|
| 10161 | 10164 | struct bnx2x_func_switch_update_params *switch_update_params; |
|---|
| 10162 | 10165 | struct bnx2x_func_state_params func_params = {NULL}; |
|---|
| 10163 | | - struct bnx2x_udp_tunnel *udp_tunnel; |
|---|
| 10164 | 10166 | u16 vxlan_port = 0, geneve_port = 0; |
|---|
| 10165 | 10167 | int rc; |
|---|
| 10166 | 10168 | |
|---|
| .. | .. |
|---|
| 10177 | 10179 | __set_bit(BNX2X_F_UPDATE_TUNNEL_CFG_CHNG, |
|---|
| 10178 | 10180 | &switch_update_params->changes); |
|---|
| 10179 | 10181 | |
|---|
| 10180 | | - if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count) { |
|---|
| 10181 | | - udp_tunnel = &bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE]; |
|---|
| 10182 | | - geneve_port = udp_tunnel->dst_port; |
|---|
| 10182 | + if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE]) { |
|---|
| 10183 | + geneve_port = bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE]; |
|---|
| 10183 | 10184 | switch_update_params->geneve_dst_port = geneve_port; |
|---|
| 10184 | 10185 | } |
|---|
| 10185 | 10186 | |
|---|
| 10186 | | - if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count) { |
|---|
| 10187 | | - udp_tunnel = &bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN]; |
|---|
| 10188 | | - vxlan_port = udp_tunnel->dst_port; |
|---|
| 10187 | + if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN]) { |
|---|
| 10188 | + vxlan_port = bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN]; |
|---|
| 10189 | 10189 | switch_update_params->vxlan_dst_port = vxlan_port; |
|---|
| 10190 | 10190 | } |
|---|
| 10191 | 10191 | |
|---|
| .. | .. |
|---|
| 10205 | 10205 | return rc; |
|---|
| 10206 | 10206 | } |
|---|
| 10207 | 10207 | |
|---|
| 10208 | | -static void __bnx2x_add_udp_port(struct bnx2x *bp, u16 port, |
|---|
| 10209 | | - enum bnx2x_udp_port_type type) |
|---|
| 10210 | | -{ |
|---|
| 10211 | | - struct bnx2x_udp_tunnel *udp_port = &bp->udp_tunnel_ports[type]; |
|---|
| 10212 | | - |
|---|
| 10213 | | - if (!netif_running(bp->dev) || !IS_PF(bp) || CHIP_IS_E1x(bp)) |
|---|
| 10214 | | - return; |
|---|
| 10215 | | - |
|---|
| 10216 | | - if (udp_port->count && udp_port->dst_port == port) { |
|---|
| 10217 | | - udp_port->count++; |
|---|
| 10218 | | - return; |
|---|
| 10219 | | - } |
|---|
| 10220 | | - |
|---|
| 10221 | | - if (udp_port->count) { |
|---|
| 10222 | | - DP(BNX2X_MSG_SP, |
|---|
| 10223 | | - "UDP tunnel [%d] - destination port limit reached\n", |
|---|
| 10224 | | - type); |
|---|
| 10225 | | - return; |
|---|
| 10226 | | - } |
|---|
| 10227 | | - |
|---|
| 10228 | | - udp_port->dst_port = port; |
|---|
| 10229 | | - udp_port->count = 1; |
|---|
| 10230 | | - bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_CHANGE_UDP_PORT, 0); |
|---|
| 10231 | | -} |
|---|
| 10232 | | - |
|---|
| 10233 | | -static void __bnx2x_del_udp_port(struct bnx2x *bp, u16 port, |
|---|
| 10234 | | - enum bnx2x_udp_port_type type) |
|---|
| 10235 | | -{ |
|---|
| 10236 | | - struct bnx2x_udp_tunnel *udp_port = &bp->udp_tunnel_ports[type]; |
|---|
| 10237 | | - |
|---|
| 10238 | | - if (!IS_PF(bp) || CHIP_IS_E1x(bp)) |
|---|
| 10239 | | - return; |
|---|
| 10240 | | - |
|---|
| 10241 | | - if (!udp_port->count || udp_port->dst_port != port) { |
|---|
| 10242 | | - DP(BNX2X_MSG_SP, "Invalid UDP tunnel [%d] port\n", |
|---|
| 10243 | | - type); |
|---|
| 10244 | | - return; |
|---|
| 10245 | | - } |
|---|
| 10246 | | - |
|---|
| 10247 | | - /* Remove reference, and make certain it's no longer in use */ |
|---|
| 10248 | | - udp_port->count--; |
|---|
| 10249 | | - if (udp_port->count) |
|---|
| 10250 | | - return; |
|---|
| 10251 | | - udp_port->dst_port = 0; |
|---|
| 10252 | | - |
|---|
| 10253 | | - if (netif_running(bp->dev)) |
|---|
| 10254 | | - bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_CHANGE_UDP_PORT, 0); |
|---|
| 10255 | | - else |
|---|
| 10256 | | - DP(BNX2X_MSG_SP, "Deleted UDP tunnel [%d] port %d\n", |
|---|
| 10257 | | - type, port); |
|---|
| 10258 | | -} |
|---|
| 10259 | | - |
|---|
| 10260 | | -static void bnx2x_udp_tunnel_add(struct net_device *netdev, |
|---|
| 10261 | | - struct udp_tunnel_info *ti) |
|---|
| 10208 | +static int bnx2x_udp_tunnel_sync(struct net_device *netdev, unsigned int table) |
|---|
| 10262 | 10209 | { |
|---|
| 10263 | 10210 | struct bnx2x *bp = netdev_priv(netdev); |
|---|
| 10264 | | - u16 t_port = ntohs(ti->port); |
|---|
| 10211 | + struct udp_tunnel_info ti; |
|---|
| 10265 | 10212 | |
|---|
| 10266 | | - switch (ti->type) { |
|---|
| 10267 | | - case UDP_TUNNEL_TYPE_VXLAN: |
|---|
| 10268 | | - __bnx2x_add_udp_port(bp, t_port, BNX2X_UDP_PORT_VXLAN); |
|---|
| 10269 | | - break; |
|---|
| 10270 | | - case UDP_TUNNEL_TYPE_GENEVE: |
|---|
| 10271 | | - __bnx2x_add_udp_port(bp, t_port, BNX2X_UDP_PORT_GENEVE); |
|---|
| 10272 | | - break; |
|---|
| 10273 | | - default: |
|---|
| 10274 | | - break; |
|---|
| 10275 | | - } |
|---|
| 10213 | + udp_tunnel_nic_get_port(netdev, table, 0, &ti); |
|---|
| 10214 | + bp->udp_tunnel_ports[table] = be16_to_cpu(ti.port); |
|---|
| 10215 | + |
|---|
| 10216 | + return bnx2x_udp_port_update(bp); |
|---|
| 10276 | 10217 | } |
|---|
| 10277 | 10218 | |
|---|
| 10278 | | -static void bnx2x_udp_tunnel_del(struct net_device *netdev, |
|---|
| 10279 | | - struct udp_tunnel_info *ti) |
|---|
| 10280 | | -{ |
|---|
| 10281 | | - struct bnx2x *bp = netdev_priv(netdev); |
|---|
| 10282 | | - u16 t_port = ntohs(ti->port); |
|---|
| 10283 | | - |
|---|
| 10284 | | - switch (ti->type) { |
|---|
| 10285 | | - case UDP_TUNNEL_TYPE_VXLAN: |
|---|
| 10286 | | - __bnx2x_del_udp_port(bp, t_port, BNX2X_UDP_PORT_VXLAN); |
|---|
| 10287 | | - break; |
|---|
| 10288 | | - case UDP_TUNNEL_TYPE_GENEVE: |
|---|
| 10289 | | - __bnx2x_del_udp_port(bp, t_port, BNX2X_UDP_PORT_GENEVE); |
|---|
| 10290 | | - break; |
|---|
| 10291 | | - default: |
|---|
| 10292 | | - break; |
|---|
| 10293 | | - } |
|---|
| 10294 | | -} |
|---|
| 10219 | +static const struct udp_tunnel_nic_info bnx2x_udp_tunnels = { |
|---|
| 10220 | + .sync_table = bnx2x_udp_tunnel_sync, |
|---|
| 10221 | + .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP | |
|---|
| 10222 | + UDP_TUNNEL_NIC_INFO_OPEN_ONLY, |
|---|
| 10223 | + .tables = { |
|---|
| 10224 | + { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, }, |
|---|
| 10225 | + { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, }, |
|---|
| 10226 | + }, |
|---|
| 10227 | +}; |
|---|
| 10295 | 10228 | |
|---|
| 10296 | 10229 | static int bnx2x_close(struct net_device *dev); |
|---|
| 10297 | 10230 | |
|---|
| .. | .. |
|---|
| 10414 | 10347 | |
|---|
| 10415 | 10348 | if (test_and_clear_bit(BNX2X_SP_RTNL_UPDATE_SVID, &bp->sp_rtnl_state)) |
|---|
| 10416 | 10349 | bnx2x_handle_update_svid_cmd(bp); |
|---|
| 10417 | | - |
|---|
| 10418 | | - if (test_and_clear_bit(BNX2X_SP_RTNL_CHANGE_UDP_PORT, |
|---|
| 10419 | | - &bp->sp_rtnl_state)) { |
|---|
| 10420 | | - if (bnx2x_udp_port_update(bp)) { |
|---|
| 10421 | | - /* On error, forget configuration */ |
|---|
| 10422 | | - memset(bp->udp_tunnel_ports, 0, |
|---|
| 10423 | | - sizeof(struct bnx2x_udp_tunnel) * |
|---|
| 10424 | | - BNX2X_UDP_PORT_MAX); |
|---|
| 10425 | | - } else { |
|---|
| 10426 | | - /* Since we don't store additional port information, |
|---|
| 10427 | | - * if no ports are configured for any feature ask for |
|---|
| 10428 | | - * information about currently configured ports. |
|---|
| 10429 | | - */ |
|---|
| 10430 | | - if (!bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count && |
|---|
| 10431 | | - !bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count) |
|---|
| 10432 | | - udp_tunnel_get_rx_info(bp->dev); |
|---|
| 10433 | | - } |
|---|
| 10434 | | - } |
|---|
| 10435 | 10350 | |
|---|
| 10436 | 10351 | /* work which needs rtnl lock not-taken (as it takes the lock itself and |
|---|
| 10437 | 10352 | * can be called from other contexts as well) |
|---|
| .. | .. |
|---|
| 11305 | 11220 | dev_info.port_hw_config[port].external_phy_config), |
|---|
| 11306 | 11221 | SHMEM_RD(bp, |
|---|
| 11307 | 11222 | dev_info.port_hw_config[port].external_phy_config2)); |
|---|
| 11308 | | - return; |
|---|
| 11223 | + return; |
|---|
| 11309 | 11224 | } |
|---|
| 11310 | 11225 | |
|---|
| 11311 | 11226 | if (CHIP_IS_E3(bp)) |
|---|
| .. | .. |
|---|
| 12005 | 11920 | static int bnx2x_get_hwinfo(struct bnx2x *bp) |
|---|
| 12006 | 11921 | { |
|---|
| 12007 | 11922 | int /*abs*/func = BP_ABS_FUNC(bp); |
|---|
| 12008 | | - int vn, mfw_vn; |
|---|
| 11923 | + int vn; |
|---|
| 12009 | 11924 | u32 val = 0, val2 = 0; |
|---|
| 12010 | 11925 | int rc = 0; |
|---|
| 12011 | 11926 | |
|---|
| .. | .. |
|---|
| 12090 | 12005 | /* |
|---|
| 12091 | 12006 | * Initialize MF configuration |
|---|
| 12092 | 12007 | */ |
|---|
| 12093 | | - |
|---|
| 12094 | 12008 | bp->mf_ov = 0; |
|---|
| 12095 | 12009 | bp->mf_mode = 0; |
|---|
| 12096 | 12010 | bp->mf_sub_mode = 0; |
|---|
| 12097 | 12011 | vn = BP_VN(bp); |
|---|
| 12098 | | - mfw_vn = BP_FW_MB_IDX(bp); |
|---|
| 12099 | 12012 | |
|---|
| 12100 | 12013 | if (!CHIP_IS_E1(bp) && !BP_NOMCP(bp)) { |
|---|
| 12101 | 12014 | BNX2X_DEV_INFO("shmem2base 0x%x, size %d, mfcfg offset %d\n", |
|---|
| .. | .. |
|---|
| 12488 | 12401 | } |
|---|
| 12489 | 12402 | |
|---|
| 12490 | 12403 | if (CHIP_IS_E1(bp)) |
|---|
| 12491 | | - bp->dropless_fc = 0; |
|---|
| 12404 | + bp->dropless_fc = false; |
|---|
| 12492 | 12405 | else |
|---|
| 12493 | 12406 | bp->dropless_fc = dropless_fc | bnx2x_get_dropless_info(bp); |
|---|
| 12494 | 12407 | |
|---|
| .. | .. |
|---|
| 12551 | 12464 | BNX2X_DEV_INFO("bp->min_msix_vec_cnt %d", bp->min_msix_vec_cnt); |
|---|
| 12552 | 12465 | |
|---|
| 12553 | 12466 | bp->dump_preset_idx = 1; |
|---|
| 12554 | | - |
|---|
| 12555 | | - if (CHIP_IS_E3B0(bp)) |
|---|
| 12556 | | - bp->flags |= PTP_SUPPORTED; |
|---|
| 12557 | 12467 | |
|---|
| 12558 | 12468 | return rc; |
|---|
| 12559 | 12469 | } |
|---|
| .. | .. |
|---|
| 12632 | 12542 | rc = bnx2x_nic_load(bp, LOAD_OPEN); |
|---|
| 12633 | 12543 | if (rc) |
|---|
| 12634 | 12544 | return rc; |
|---|
| 12635 | | - |
|---|
| 12636 | | - if (IS_PF(bp)) |
|---|
| 12637 | | - udp_tunnel_get_rx_info(dev); |
|---|
| 12638 | 12545 | |
|---|
| 12639 | 12546 | return 0; |
|---|
| 12640 | 12547 | } |
|---|
| .. | .. |
|---|
| 13166 | 13073 | .ndo_set_vf_mac = bnx2x_set_vf_mac, |
|---|
| 13167 | 13074 | .ndo_set_vf_vlan = bnx2x_set_vf_vlan, |
|---|
| 13168 | 13075 | .ndo_get_vf_config = bnx2x_get_vf_config, |
|---|
| 13076 | + .ndo_set_vf_spoofchk = bnx2x_set_vf_spoofchk, |
|---|
| 13169 | 13077 | #endif |
|---|
| 13170 | 13078 | #ifdef NETDEV_FCOE_WWNN |
|---|
| 13171 | 13079 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, |
|---|
| .. | .. |
|---|
| 13174 | 13082 | .ndo_get_phys_port_id = bnx2x_get_phys_port_id, |
|---|
| 13175 | 13083 | .ndo_set_vf_link_state = bnx2x_set_vf_link_state, |
|---|
| 13176 | 13084 | .ndo_features_check = bnx2x_features_check, |
|---|
| 13177 | | - .ndo_udp_tunnel_add = bnx2x_udp_tunnel_add, |
|---|
| 13178 | | - .ndo_udp_tunnel_del = bnx2x_udp_tunnel_del, |
|---|
| 13085 | + .ndo_udp_tunnel_add = udp_tunnel_nic_add_port, |
|---|
| 13086 | + .ndo_udp_tunnel_del = udp_tunnel_nic_del_port, |
|---|
| 13179 | 13087 | }; |
|---|
| 13180 | 13088 | |
|---|
| 13181 | 13089 | static int bnx2x_set_coherency_mask(struct bnx2x *bp) |
|---|
| .. | .. |
|---|
| 13370 | 13278 | |
|---|
| 13371 | 13279 | dev->gso_partial_features = NETIF_F_GSO_GRE_CSUM | |
|---|
| 13372 | 13280 | NETIF_F_GSO_UDP_TUNNEL_CSUM; |
|---|
| 13281 | + |
|---|
| 13282 | + if (IS_PF(bp)) |
|---|
| 13283 | + dev->udp_tunnel_nic_info = &bnx2x_udp_tunnels; |
|---|
| 13373 | 13284 | } |
|---|
| 13374 | 13285 | |
|---|
| 13375 | 13286 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
|---|
| .. | .. |
|---|
| 13466 | 13377 | /* Check FW version */ |
|---|
| 13467 | 13378 | offset = be32_to_cpu(fw_hdr->fw_version.offset); |
|---|
| 13468 | 13379 | fw_ver = firmware->data + offset; |
|---|
| 13469 | | - if ((fw_ver[0] != BCM_5710_FW_MAJOR_VERSION) || |
|---|
| 13470 | | - (fw_ver[1] != BCM_5710_FW_MINOR_VERSION) || |
|---|
| 13471 | | - (fw_ver[2] != BCM_5710_FW_REVISION_VERSION) || |
|---|
| 13472 | | - (fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) { |
|---|
| 13380 | + if (fw_ver[0] != bp->fw_major || fw_ver[1] != bp->fw_minor || |
|---|
| 13381 | + fw_ver[2] != bp->fw_rev || fw_ver[3] != bp->fw_eng) { |
|---|
| 13473 | 13382 | BNX2X_ERR("Bad FW version:%d.%d.%d.%d. Should be %d.%d.%d.%d\n", |
|---|
| 13474 | | - fw_ver[0], fw_ver[1], fw_ver[2], fw_ver[3], |
|---|
| 13475 | | - BCM_5710_FW_MAJOR_VERSION, |
|---|
| 13476 | | - BCM_5710_FW_MINOR_VERSION, |
|---|
| 13477 | | - BCM_5710_FW_REVISION_VERSION, |
|---|
| 13478 | | - BCM_5710_FW_ENGINEERING_VERSION); |
|---|
| 13383 | + fw_ver[0], fw_ver[1], fw_ver[2], fw_ver[3], |
|---|
| 13384 | + bp->fw_major, bp->fw_minor, bp->fw_rev, bp->fw_eng); |
|---|
| 13479 | 13385 | return -EINVAL; |
|---|
| 13480 | 13386 | } |
|---|
| 13481 | 13387 | |
|---|
| .. | .. |
|---|
| 13555 | 13461 | |
|---|
| 13556 | 13462 | static int bnx2x_init_firmware(struct bnx2x *bp) |
|---|
| 13557 | 13463 | { |
|---|
| 13558 | | - const char *fw_file_name; |
|---|
| 13464 | + const char *fw_file_name, *fw_file_name_v15; |
|---|
| 13559 | 13465 | struct bnx2x_fw_file_hdr *fw_hdr; |
|---|
| 13560 | 13466 | int rc; |
|---|
| 13561 | 13467 | |
|---|
| 13562 | 13468 | if (bp->firmware) |
|---|
| 13563 | 13469 | return 0; |
|---|
| 13564 | 13470 | |
|---|
| 13565 | | - if (CHIP_IS_E1(bp)) |
|---|
| 13471 | + if (CHIP_IS_E1(bp)) { |
|---|
| 13566 | 13472 | fw_file_name = FW_FILE_NAME_E1; |
|---|
| 13567 | | - else if (CHIP_IS_E1H(bp)) |
|---|
| 13473 | + fw_file_name_v15 = FW_FILE_NAME_E1_V15; |
|---|
| 13474 | + } else if (CHIP_IS_E1H(bp)) { |
|---|
| 13568 | 13475 | fw_file_name = FW_FILE_NAME_E1H; |
|---|
| 13569 | | - else if (!CHIP_IS_E1x(bp)) |
|---|
| 13476 | + fw_file_name_v15 = FW_FILE_NAME_E1H_V15; |
|---|
| 13477 | + } else if (!CHIP_IS_E1x(bp)) { |
|---|
| 13570 | 13478 | fw_file_name = FW_FILE_NAME_E2; |
|---|
| 13571 | | - else { |
|---|
| 13479 | + fw_file_name_v15 = FW_FILE_NAME_E2_V15; |
|---|
| 13480 | + } else { |
|---|
| 13572 | 13481 | BNX2X_ERR("Unsupported chip revision\n"); |
|---|
| 13573 | 13482 | return -EINVAL; |
|---|
| 13574 | 13483 | } |
|---|
| 13484 | + |
|---|
| 13575 | 13485 | BNX2X_DEV_INFO("Loading %s\n", fw_file_name); |
|---|
| 13576 | 13486 | |
|---|
| 13577 | 13487 | rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev); |
|---|
| 13578 | 13488 | if (rc) { |
|---|
| 13579 | | - BNX2X_ERR("Can't load firmware file %s\n", |
|---|
| 13580 | | - fw_file_name); |
|---|
| 13581 | | - goto request_firmware_exit; |
|---|
| 13489 | + BNX2X_DEV_INFO("Trying to load older fw %s\n", fw_file_name_v15); |
|---|
| 13490 | + |
|---|
| 13491 | + /* try to load prev version */ |
|---|
| 13492 | + rc = request_firmware(&bp->firmware, fw_file_name_v15, &bp->pdev->dev); |
|---|
| 13493 | + |
|---|
| 13494 | + if (rc) |
|---|
| 13495 | + goto request_firmware_exit; |
|---|
| 13496 | + |
|---|
| 13497 | + bp->fw_rev = BCM_5710_FW_REVISION_VERSION_V15; |
|---|
| 13498 | + } else { |
|---|
| 13499 | + bp->fw_cap |= FW_CAP_INVALIDATE_VF_FP_HSI; |
|---|
| 13500 | + bp->fw_rev = BCM_5710_FW_REVISION_VERSION; |
|---|
| 13582 | 13501 | } |
|---|
| 13502 | + |
|---|
| 13503 | + bp->fw_major = BCM_5710_FW_MAJOR_VERSION; |
|---|
| 13504 | + bp->fw_minor = BCM_5710_FW_MINOR_VERSION; |
|---|
| 13505 | + bp->fw_eng = BCM_5710_FW_ENGINEERING_VERSION; |
|---|
| 13583 | 13506 | |
|---|
| 13584 | 13507 | rc = bnx2x_check_firmware(bp); |
|---|
| 13585 | 13508 | if (rc) { |
|---|
| .. | .. |
|---|
| 13691 | 13614 | |
|---|
| 13692 | 13615 | /** |
|---|
| 13693 | 13616 | * bnx2x_get_num_none_def_sbs - return the number of none default SBs |
|---|
| 13694 | | - * |
|---|
| 13695 | | - * @dev: pci device |
|---|
| 13617 | + * @pdev: pci device |
|---|
| 13618 | + * @cnic_cnt: count |
|---|
| 13696 | 13619 | * |
|---|
| 13697 | 13620 | */ |
|---|
| 13698 | 13621 | static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev, int cnic_cnt) |
|---|
| .. | .. |
|---|
| 13945 | 13868 | return -ENOTSUPP; |
|---|
| 13946 | 13869 | } |
|---|
| 13947 | 13870 | |
|---|
| 13948 | | -static void bnx2x_register_phc(struct bnx2x *bp) |
|---|
| 13871 | +void bnx2x_register_phc(struct bnx2x *bp) |
|---|
| 13949 | 13872 | { |
|---|
| 13950 | 13873 | /* Fill the ptp_clock_info struct and register PTP clock*/ |
|---|
| 13951 | 13874 | bp->ptp_clock_info.owner = THIS_MODULE; |
|---|
| .. | .. |
|---|
| 14076 | 13999 | rc = -ENOMEM; |
|---|
| 14077 | 14000 | goto init_one_freemem; |
|---|
| 14078 | 14001 | } |
|---|
| 14079 | | - bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2), |
|---|
| 14002 | + bp->doorbells = ioremap(pci_resource_start(pdev, 2), |
|---|
| 14080 | 14003 | doorbell_size); |
|---|
| 14081 | 14004 | } |
|---|
| 14082 | 14005 | if (!bp->doorbells) { |
|---|
| .. | .. |
|---|
| 14147 | 14070 | dev->base_addr, bp->pdev->irq, dev->dev_addr); |
|---|
| 14148 | 14071 | pcie_print_link_status(bp->pdev); |
|---|
| 14149 | 14072 | |
|---|
| 14150 | | - bnx2x_register_phc(bp); |
|---|
| 14151 | | - |
|---|
| 14152 | 14073 | if (!IS_MF_SD_STORAGE_PERSONALITY_ONLY(bp)) |
|---|
| 14153 | 14074 | bnx2x_set_os_driver_state(bp, OS_DRIVER_STATE_DISABLED); |
|---|
| 14154 | 14075 | |
|---|
| .. | .. |
|---|
| 14181 | 14102 | struct bnx2x *bp, |
|---|
| 14182 | 14103 | bool remove_netdev) |
|---|
| 14183 | 14104 | { |
|---|
| 14184 | | - if (bp->ptp_clock) { |
|---|
| 14185 | | - ptp_clock_unregister(bp->ptp_clock); |
|---|
| 14186 | | - bp->ptp_clock = NULL; |
|---|
| 14187 | | - } |
|---|
| 14188 | | - |
|---|
| 14189 | 14105 | /* Delete storage MAC address */ |
|---|
| 14190 | 14106 | if (!NO_FCOE(bp)) { |
|---|
| 14191 | 14107 | rtnl_lock(); |
|---|
| .. | .. |
|---|
| 14297 | 14213 | |
|---|
| 14298 | 14214 | /* Stop Tx */ |
|---|
| 14299 | 14215 | bnx2x_tx_disable(bp); |
|---|
| 14300 | | - /* Delete all NAPI objects */ |
|---|
| 14301 | | - bnx2x_del_all_napi(bp); |
|---|
| 14302 | | - if (CNIC_LOADED(bp)) |
|---|
| 14303 | | - bnx2x_del_all_napi_cnic(bp); |
|---|
| 14304 | 14216 | netdev_reset_tc(bp->dev); |
|---|
| 14305 | 14217 | |
|---|
| 14306 | 14218 | del_timer_sync(&bp->timer); |
|---|
| .. | .. |
|---|
| 14405 | 14317 | bnx2x_drain_tx_queues(bp); |
|---|
| 14406 | 14318 | bnx2x_send_unload_req(bp, UNLOAD_RECOVERY); |
|---|
| 14407 | 14319 | bnx2x_netif_stop(bp, 1); |
|---|
| 14320 | + bnx2x_del_all_napi(bp); |
|---|
| 14321 | + |
|---|
| 14322 | + if (CNIC_LOADED(bp)) |
|---|
| 14323 | + bnx2x_del_all_napi_cnic(bp); |
|---|
| 14324 | + |
|---|
| 14408 | 14325 | bnx2x_free_irq(bp); |
|---|
| 14409 | 14326 | |
|---|
| 14410 | 14327 | /* Report UNLOAD_DONE to MCP */ |
|---|
| .. | .. |
|---|
| 14429 | 14346 | } |
|---|
| 14430 | 14347 | |
|---|
| 14431 | 14348 | rtnl_unlock(); |
|---|
| 14432 | | - |
|---|
| 14433 | | - /* If AER, perform cleanup of the PCIe registers */ |
|---|
| 14434 | | - if (bp->flags & AER_ENABLED) { |
|---|
| 14435 | | - if (pci_cleanup_aer_uncorrect_error_status(pdev)) |
|---|
| 14436 | | - BNX2X_ERR("pci_cleanup_aer_uncorrect_error_status failed\n"); |
|---|
| 14437 | | - else |
|---|
| 14438 | | - DP(NETIF_MSG_HW, "pci_cleanup_aer_uncorrect_error_status succeeded\n"); |
|---|
| 14439 | | - } |
|---|
| 14440 | 14349 | |
|---|
| 14441 | 14350 | return PCI_ERS_RESULT_RECOVERED; |
|---|
| 14442 | 14351 | } |
|---|
| .. | .. |
|---|
| 14505 | 14414 | .id_table = bnx2x_pci_tbl, |
|---|
| 14506 | 14415 | .probe = bnx2x_init_one, |
|---|
| 14507 | 14416 | .remove = bnx2x_remove_one, |
|---|
| 14508 | | - .suspend = bnx2x_suspend, |
|---|
| 14509 | | - .resume = bnx2x_resume, |
|---|
| 14417 | + .driver.pm = &bnx2x_pm_ops, |
|---|
| 14510 | 14418 | .err_handler = &bnx2x_err_handler, |
|---|
| 14511 | 14419 | #ifdef CONFIG_BNX2X_SRIOV |
|---|
| 14512 | 14420 | .sriov_configure = bnx2x_sriov_configure, |
|---|
| .. | .. |
|---|
| 14517 | 14425 | static int __init bnx2x_init(void) |
|---|
| 14518 | 14426 | { |
|---|
| 14519 | 14427 | int ret; |
|---|
| 14520 | | - |
|---|
| 14521 | | - pr_info("%s", version); |
|---|
| 14522 | 14428 | |
|---|
| 14523 | 14429 | bnx2x_wq = create_singlethread_workqueue("bnx2x"); |
|---|
| 14524 | 14430 | if (bnx2x_wq == NULL) { |
|---|
| .. | .. |
|---|
| 14569 | 14475 | |
|---|
| 14570 | 14476 | /** |
|---|
| 14571 | 14477 | * bnx2x_set_iscsi_eth_mac_addr - set iSCSI MAC(s). |
|---|
| 14572 | | - * |
|---|
| 14573 | 14478 | * @bp: driver handle |
|---|
| 14574 | | - * @set: set or clear the CAM entry |
|---|
| 14575 | 14479 | * |
|---|
| 14576 | 14480 | * This function will wait until the ramrod completion returns. |
|---|
| 14577 | 14481 | * Return 0 if success, -ENODEV if ramrod doesn't return. |
|---|
| .. | .. |
|---|
| 14854 | 14758 | if (rc) |
|---|
| 14855 | 14759 | break; |
|---|
| 14856 | 14760 | |
|---|
| 14857 | | - mmiowb(); |
|---|
| 14858 | 14761 | barrier(); |
|---|
| 14859 | 14762 | |
|---|
| 14860 | 14763 | /* Start accepting on iSCSI L2 ring */ |
|---|
| .. | .. |
|---|
| 14889 | 14792 | if (!bnx2x_wait_sp_comp(bp, sp_bits)) |
|---|
| 14890 | 14793 | BNX2X_ERR("rx_mode completion timed out!\n"); |
|---|
| 14891 | 14794 | |
|---|
| 14892 | | - mmiowb(); |
|---|
| 14893 | 14795 | barrier(); |
|---|
| 14894 | 14796 | |
|---|
| 14895 | 14797 | /* Unset iSCSI L2 MAC */ |
|---|
| .. | .. |
|---|
| 15417 | 15319 | return 0; |
|---|
| 15418 | 15320 | } |
|---|
| 15419 | 15321 | |
|---|
| 15322 | +#define BNX2X_P2P_DETECT_PARAM_MASK 0x5F5 |
|---|
| 15323 | +#define BNX2X_P2P_DETECT_RULE_MASK 0x3DBB |
|---|
| 15324 | +#define BNX2X_PTP_TX_ON_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x6AA) |
|---|
| 15325 | +#define BNX2X_PTP_TX_ON_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3EEE) |
|---|
| 15326 | +#define BNX2X_PTP_V1_L4_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x7EE) |
|---|
| 15327 | +#define BNX2X_PTP_V1_L4_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3FFE) |
|---|
| 15328 | +#define BNX2X_PTP_V2_L4_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x7EA) |
|---|
| 15329 | +#define BNX2X_PTP_V2_L4_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3FEE) |
|---|
| 15330 | +#define BNX2X_PTP_V2_L2_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x6BF) |
|---|
| 15331 | +#define BNX2X_PTP_V2_L2_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3EFF) |
|---|
| 15332 | +#define BNX2X_PTP_V2_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x6AA) |
|---|
| 15333 | +#define BNX2X_PTP_V2_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3EEE) |
|---|
| 15334 | + |
|---|
| 15420 | 15335 | int bnx2x_configure_ptp_filters(struct bnx2x *bp) |
|---|
| 15421 | 15336 | { |
|---|
| 15422 | 15337 | int port = BP_PORT(bp); |
|---|
| 15338 | + u32 param, rule; |
|---|
| 15423 | 15339 | int rc; |
|---|
| 15424 | 15340 | |
|---|
| 15425 | 15341 | if (!bp->hwtstamp_ioctl_called) |
|---|
| 15426 | 15342 | return 0; |
|---|
| 15427 | 15343 | |
|---|
| 15344 | + param = port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK : |
|---|
| 15345 | + NIG_REG_P0_TLLH_PTP_PARAM_MASK; |
|---|
| 15346 | + rule = port ? NIG_REG_P1_TLLH_PTP_RULE_MASK : |
|---|
| 15347 | + NIG_REG_P0_TLLH_PTP_RULE_MASK; |
|---|
| 15428 | 15348 | switch (bp->tx_type) { |
|---|
| 15429 | 15349 | case HWTSTAMP_TX_ON: |
|---|
| 15430 | 15350 | bp->flags |= TX_TIMESTAMPING_EN; |
|---|
| 15431 | | - REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK : |
|---|
| 15432 | | - NIG_REG_P0_TLLH_PTP_PARAM_MASK, 0x6AA); |
|---|
| 15433 | | - REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_RULE_MASK : |
|---|
| 15434 | | - NIG_REG_P0_TLLH_PTP_RULE_MASK, 0x3EEE); |
|---|
| 15351 | + REG_WR(bp, param, BNX2X_PTP_TX_ON_PARAM_MASK); |
|---|
| 15352 | + REG_WR(bp, rule, BNX2X_PTP_TX_ON_RULE_MASK); |
|---|
| 15435 | 15353 | break; |
|---|
| 15436 | 15354 | case HWTSTAMP_TX_ONESTEP_SYNC: |
|---|
| 15355 | + case HWTSTAMP_TX_ONESTEP_P2P: |
|---|
| 15437 | 15356 | BNX2X_ERR("One-step timestamping is not supported\n"); |
|---|
| 15438 | 15357 | return -ERANGE; |
|---|
| 15439 | 15358 | } |
|---|
| 15440 | 15359 | |
|---|
| 15360 | + param = port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : |
|---|
| 15361 | + NIG_REG_P0_LLH_PTP_PARAM_MASK; |
|---|
| 15362 | + rule = port ? NIG_REG_P1_LLH_PTP_RULE_MASK : |
|---|
| 15363 | + NIG_REG_P0_LLH_PTP_RULE_MASK; |
|---|
| 15441 | 15364 | switch (bp->rx_filter) { |
|---|
| 15442 | 15365 | case HWTSTAMP_FILTER_NONE: |
|---|
| 15443 | 15366 | break; |
|---|
| .. | .. |
|---|
| 15451 | 15374 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: |
|---|
| 15452 | 15375 | bp->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; |
|---|
| 15453 | 15376 | /* Initialize PTP detection for UDP/IPv4 events */ |
|---|
| 15454 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : |
|---|
| 15455 | | - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7EE); |
|---|
| 15456 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : |
|---|
| 15457 | | - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FFE); |
|---|
| 15377 | + REG_WR(bp, param, BNX2X_PTP_V1_L4_PARAM_MASK); |
|---|
| 15378 | + REG_WR(bp, rule, BNX2X_PTP_V1_L4_RULE_MASK); |
|---|
| 15458 | 15379 | break; |
|---|
| 15459 | 15380 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: |
|---|
| 15460 | 15381 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: |
|---|
| 15461 | 15382 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: |
|---|
| 15462 | 15383 | bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; |
|---|
| 15463 | 15384 | /* Initialize PTP detection for UDP/IPv4 or UDP/IPv6 events */ |
|---|
| 15464 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : |
|---|
| 15465 | | - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7EA); |
|---|
| 15466 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : |
|---|
| 15467 | | - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FEE); |
|---|
| 15385 | + REG_WR(bp, param, BNX2X_PTP_V2_L4_PARAM_MASK); |
|---|
| 15386 | + REG_WR(bp, rule, BNX2X_PTP_V2_L4_RULE_MASK); |
|---|
| 15468 | 15387 | break; |
|---|
| 15469 | 15388 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: |
|---|
| 15470 | 15389 | case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: |
|---|
| 15471 | 15390 | case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: |
|---|
| 15472 | 15391 | bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; |
|---|
| 15473 | 15392 | /* Initialize PTP detection L2 events */ |
|---|
| 15474 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : |
|---|
| 15475 | | - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x6BF); |
|---|
| 15476 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : |
|---|
| 15477 | | - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3EFF); |
|---|
| 15393 | + REG_WR(bp, param, BNX2X_PTP_V2_L2_PARAM_MASK); |
|---|
| 15394 | + REG_WR(bp, rule, BNX2X_PTP_V2_L2_RULE_MASK); |
|---|
| 15478 | 15395 | |
|---|
| 15479 | 15396 | break; |
|---|
| 15480 | 15397 | case HWTSTAMP_FILTER_PTP_V2_EVENT: |
|---|
| .. | .. |
|---|
| 15482 | 15399 | case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: |
|---|
| 15483 | 15400 | bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
|---|
| 15484 | 15401 | /* Initialize PTP detection L2, UDP/IPv4 or UDP/IPv6 events */ |
|---|
| 15485 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : |
|---|
| 15486 | | - NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x6AA); |
|---|
| 15487 | | - REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK : |
|---|
| 15488 | | - NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3EEE); |
|---|
| 15402 | + REG_WR(bp, param, BNX2X_PTP_V2_PARAM_MASK); |
|---|
| 15403 | + REG_WR(bp, rule, BNX2X_PTP_V2_RULE_MASK); |
|---|
| 15489 | 15404 | break; |
|---|
| 15490 | 15405 | } |
|---|
| 15491 | 15406 | |
|---|
| .. | .. |
|---|
| 15519 | 15434 | return -EINVAL; |
|---|
| 15520 | 15435 | } |
|---|
| 15521 | 15436 | |
|---|
| 15522 | | - bp->hwtstamp_ioctl_called = 1; |
|---|
| 15437 | + bp->hwtstamp_ioctl_called = true; |
|---|
| 15523 | 15438 | bp->tx_type = config.tx_type; |
|---|
| 15524 | 15439 | bp->rx_filter = config.rx_filter; |
|---|
| 15525 | 15440 | |
|---|
| .. | .. |
|---|
| 15601 | 15516 | bnx2x_init_cyclecounter(bp); |
|---|
| 15602 | 15517 | timecounter_init(&bp->timecounter, &bp->cyclecounter, |
|---|
| 15603 | 15518 | ktime_to_ns(ktime_get_real())); |
|---|
| 15604 | | - bp->timecounter_init_done = 1; |
|---|
| 15519 | + bp->timecounter_init_done = true; |
|---|
| 15605 | 15520 | } |
|---|
| 15606 | 15521 | |
|---|
| 15607 | 15522 | DP(BNX2X_MSG_PTP, "PTP initialization ended successfully\n"); |
|---|