svn commit: r339887 - stable/9/sys/dev/bxe
Author: davidcs Date: Mon Oct 29 21:46:12 2018 New Revision: 339887 URL: https://svnweb.freebsd.org/changeset/base/339887 Log: MFC r339366 Add support for Error Recovery Submitted by:vaishali.kulka...@cavium.com Modified: stable/9/sys/dev/bxe/bxe.c stable/9/sys/dev/bxe/bxe.h stable/9/sys/dev/bxe/bxe_stats.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c == --- stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:46:05 2018(r339886) +++ stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:46:12 2018(r339887) @@ -188,6 +188,7 @@ static int bxe_attach(device_t); static int bxe_detach(device_t); static int bxe_shutdown(device_t); + /* * FreeBSD KLD module/device interface event handler method. */ @@ -700,6 +701,9 @@ static voidbxe_interrupt_detach(struct bxe_softc * static voidbxe_set_rx_mode(struct bxe_softc *sc); static int bxe_init_locked(struct bxe_softc *sc); static int bxe_stop_locked(struct bxe_softc *sc); +static voidbxe_sp_err_timeout_task(void *arg, int pending); +void bxe_parity_recover(struct bxe_softc *sc); +void bxe_handle_error(struct bxe_softc *sc); static __noinline int bxe_nic_load(struct bxe_softc *sc, int load_mode); static __noinline int bxe_nic_unload(struct bxe_softc *sc, @@ -3488,16 +3492,12 @@ bxe_watchdog(struct bxe_softc*sc, } BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index); -if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); -} BXE_FP_TX_UNLOCK(fp); +BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK); +taskqueue_enqueue_timeout(taskqueue_thread, +>sp_err_timeout_task, hz/10); -atomic_store_rel_long(>chip_tq_flags, CHIP_TQ_REINIT); -taskqueue_enqueue(sc->chip_tq, >chip_tq_task); - return (-1); } @@ -4252,6 +4252,7 @@ bxe_nic_unload(struct bxe_softc *sc, struct bxe_fastpath *fp; fp = >fp[i]; + fp->watchdog_timer = 0; BXE_FP_TX_LOCK(fp); BXE_FP_TX_UNLOCK(fp); } @@ -4267,20 +4268,22 @@ bxe_nic_unload(struct bxe_softc *sc, if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE && (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) { -/* - * We can get here if the driver has been unloaded - * during parity error recovery and is either waiting for a - * leader to complete or for other functions to unload and - * then ifconfig down has been issued. In this case we want to - * unload and let other functions to complete a recovery - * process. - */ -sc->recovery_state = BXE_RECOVERY_DONE; -sc->is_leader = 0; -bxe_release_leader_lock(sc); -mb(); -BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) { +/* + * We can get here if the driver has been unloaded + * during parity error recovery and is either waiting for a + * leader to complete or for other functions to unload and + * then ifconfig down has been issued. In this case we want to + * unload and let other functions to complete a recovery + * process. + */ +sc->recovery_state = BXE_RECOVERY_DONE; +sc->is_leader = 0; +bxe_release_leader_lock(sc); +mb(); +BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + } BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x" " state = 0x%x\n", sc->recovery_state, sc->state); return (-1); @@ -7575,6 +7578,10 @@ bxe_parity_attn(struct bxe_softc *sc, if (print) BLOGI(sc, "\n"); + if( *global == TRUE ) { +BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); +} + return (TRUE); } @@ -7589,6 +7596,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc, struct attn_route attn = { {0} }; int port = SC_PORT(sc); +if(sc->state != BXE_STATE_OPEN) +return FALSE; + attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4); attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4); attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4); @@ -7615,10 +7625,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, uint32_t attn) { uint32_t val; +boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) { val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR); BLOGE(sc, "PGLUE hw attention 0x%08x\n", val); +err_flg = TRUE; if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR)
svn commit: r339885 - stable/9/sys/dev/bxe
Author: davidcs Date: Mon Oct 29 21:36:10 2018 New Revision: 339885 URL: https://svnweb.freebsd.org/changeset/base/339885 Log: MFC r338734 Fixed isses: State check before enqueuing transmit task in bxe_link_attn() routine. State check before invoking bxe_nic_unload in bxe_shutdown(). Submitted by:vaishali.kulka...@cavium.com Modified: stable/9/sys/dev/bxe/bxe.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c == --- stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:31:23 2018(r339884) +++ stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:36:10 2018(r339885) @@ -7081,13 +7081,13 @@ bxe_link_attn(struct bxe_softc *sc) if (sc->state == BXE_STATE_OPEN) { bxe_stats_handle(sc, STATS_EVENT_LINK_UP); + /* Restart tx when the link comes back. */ + FOR_EACH_ETH_QUEUE(sc, i) { + fp = >fp[i]; + taskqueue_enqueue(fp->tq, >tx_task); + } } - /* Restart tx when the link comes back. */ -FOR_EACH_ETH_QUEUE(sc, i) { -fp = >fp[i]; -taskqueue_enqueue(fp->tq, >tx_task); - } } if (sc->link_vars.link_up && sc->link_vars.line_speed) { @@ -16284,9 +16284,11 @@ bxe_shutdown(device_t dev) /* stop the periodic callout */ bxe_periodic_stop(sc); -BXE_CORE_LOCK(sc); -bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); -BXE_CORE_UNLOCK(sc); +if (sc->state != BXE_STATE_CLOSED) { + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); + BXE_CORE_UNLOCK(sc); +} return (0); } ___ svn-src-stable-9@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"
svn commit: r339854 - stable/9/sys/dev/usb/serial
Author: hselasky Date: Mon Oct 29 12:13:05 2018 New Revision: 339854 URL: https://svnweb.freebsd.org/changeset/base/339854 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon PR: 225932 Differential revision:https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Modified: stable/9/sys/dev/usb/serial/uplcom.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/usb/serial/uplcom.c == --- stable/9/sys/dev/usb/serial/uplcom.cMon Oct 29 12:11:27 2018 (r339853) +++ stable/9/sys/dev/usb/serial/uplcom.cMon Oct 29 12:13:05 2018 (r339854) @@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW #defineUPLCOM_SET_CRTSCTS 0x41 #defineUPLCOM_SET_CRTSCTS_PL2303X 0x61 #defineRSAQ_STATUS_CTS 0x80 +#defineRSAQ_STATUS_OVERRUN_ERROR 0x40 +#defineRSAQ_STATUS_PARITY_ERROR0x20 +#defineRSAQ_STATUS_FRAME_ERROR 0x10 +#defineRSAQ_STATUS_RING0x08 +#defineRSAQ_STATUS_BREAK_ERROR 0x04 #defineRSAQ_STATUS_DSR 0x02 #defineRSAQ_STATUS_DCD 0x01 #defineTYPE_PL2303 0 #defineTYPE_PL2303HX 1 +#defineTYPE_PL2303HXD 2 +#defineUPLCOM_STATE_INDEX 8 + enum { UPLCOM_BULK_DT_WR, UPLCOM_BULK_DT_RD, @@ -366,18 +374,49 @@ uplcom_attach(device_t dev) sc->sc_udev = uaa->device; - /* Determine the chip type. This algorithm is taken from Linux. */ dd = usbd_get_device_descriptor(sc->sc_udev); - if (dd->bDeviceClass == 0x02) - sc->sc_chiptype = TYPE_PL2303; - else if (dd->bMaxPacketSize == 0x40) + + switch (UGETW(dd->bcdDevice)) { + case 0x0300: sc->sc_chiptype = TYPE_PL2303HX; - else - sc->sc_chiptype = TYPE_PL2303; + /* or TA, that is HX with external crystal */ + break; + case 0x0400: + sc->sc_chiptype = TYPE_PL2303HXD; + /* or EA, that is HXD with ESD protection */ + /* or RA, that has internal voltage level converter that works only up to 1Mbaud (!) */ + break; + case 0x0500: + sc->sc_chiptype = TYPE_PL2303HXD; + /* in fact it's TB, that is HXD with external crystal */ + break; + default: + /* NOTE: I have no info about the bcdDevice for the base PL2303 (up to 1.2Mbaud, + only fixed rates) and for PL2303SA (8-pin chip, up to 115200 baud */ + /* Determine the chip type. This algorithm is taken from Linux. */ + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + break; + } - DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303HX) ? - "2303X" : "2303"); + switch (sc->sc_chiptype) { + case TYPE_PL2303: + DPRINTF("chiptype: 2303\n"); + break; + case TYPE_PL2303HX: + DPRINTF("chiptype: 2303HX/TA\n"); + break; + case TYPE_PL2303HXD: + DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); + break; + default: + DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype); + break; + } /* * USB-RSAQ1 has two interface @@ -426,13 +465,14 @@ uplcom_attach(device_t dev) goto detach; } - if (sc->sc_chiptype != TYPE_PL2303HX) { + if (sc->sc_chiptype == TYPE_PL2303) { /* HX variants seem to lock up after a clear stall request. */ mtx_lock(>sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(>sc_mtx); } else { + /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, @@ -551,7 +591,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0))