Deleted Added
full compact
bxe.c (283269) bxe.c (283274)
1/*-
2 * Copyright (c) 2007-2014 QLogic Corporation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007-2014 QLogic Corporation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/bxe/bxe.c 283269 2015-05-21 20:47:19Z davidcs $");
28__FBSDID("$FreeBSD: head/sys/dev/bxe/bxe.c 283274 2015-05-22 01:44:07Z davidcs $");
29
29
30#define BXE_DRIVER_VERSION "1.78.78"
30#define BXE_DRIVER_VERSION "1.78.79"
31
32#include "bxe.h"
33#include "ecore_sp.h"
34#include "ecore_init.h"
35#include "ecore_init_ops.h"
36
37#include "57710_int_offsets.h"
38#include "57711_int_offsets.h"

--- 428 unchanged lines hidden (view full) ---

467 { STATS_OFFSET32(eee_tx_lpi),
468 4, STATS_FLAGS_PORT, "eee_tx_lpi"},
469 { STATS_OFFSET32(rx_calls),
470 4, STATS_FLAGS_FUNC, "rx_calls"},
471 { STATS_OFFSET32(rx_pkts),
472 4, STATS_FLAGS_FUNC, "rx_pkts"},
473 { STATS_OFFSET32(rx_tpa_pkts),
474 4, STATS_FLAGS_FUNC, "rx_tpa_pkts"},
31
32#include "bxe.h"
33#include "ecore_sp.h"
34#include "ecore_init.h"
35#include "ecore_init_ops.h"
36
37#include "57710_int_offsets.h"
38#include "57711_int_offsets.h"

--- 428 unchanged lines hidden (view full) ---

467 { STATS_OFFSET32(eee_tx_lpi),
468 4, STATS_FLAGS_PORT, "eee_tx_lpi"},
469 { STATS_OFFSET32(rx_calls),
470 4, STATS_FLAGS_FUNC, "rx_calls"},
471 { STATS_OFFSET32(rx_pkts),
472 4, STATS_FLAGS_FUNC, "rx_pkts"},
473 { STATS_OFFSET32(rx_tpa_pkts),
474 4, STATS_FLAGS_FUNC, "rx_tpa_pkts"},
475 { STATS_OFFSET32(rx_jumbo_sge_pkts),
476 4, STATS_FLAGS_FUNC, "rx_jumbo_sge_pkts"},
475 { STATS_OFFSET32(rx_soft_errors),
476 4, STATS_FLAGS_FUNC, "rx_soft_errors"},
477 { STATS_OFFSET32(rx_hw_csum_errors),
478 4, STATS_FLAGS_FUNC, "rx_hw_csum_errors"},
479 { STATS_OFFSET32(rx_ofld_frames_csum_ip),
480 4, STATS_FLAGS_FUNC, "rx_ofld_frames_csum_ip"},
481 { STATS_OFFSET32(rx_ofld_frames_csum_tcp_udp),
482 4, STATS_FLAGS_FUNC, "rx_ofld_frames_csum_tcp_udp"},

--- 95 unchanged lines hidden (view full) ---

578 { Q_STATS_OFFSET32(total_tpa_bytes_hi),
579 8, "tpa_bytes"},
580 { Q_STATS_OFFSET32(rx_calls),
581 4, "rx_calls"},
582 { Q_STATS_OFFSET32(rx_pkts),
583 4, "rx_pkts"},
584 { Q_STATS_OFFSET32(rx_tpa_pkts),
585 4, "rx_tpa_pkts"},
477 { STATS_OFFSET32(rx_soft_errors),
478 4, STATS_FLAGS_FUNC, "rx_soft_errors"},
479 { STATS_OFFSET32(rx_hw_csum_errors),
480 4, STATS_FLAGS_FUNC, "rx_hw_csum_errors"},
481 { STATS_OFFSET32(rx_ofld_frames_csum_ip),
482 4, STATS_FLAGS_FUNC, "rx_ofld_frames_csum_ip"},
483 { STATS_OFFSET32(rx_ofld_frames_csum_tcp_udp),
484 4, STATS_FLAGS_FUNC, "rx_ofld_frames_csum_tcp_udp"},

--- 95 unchanged lines hidden (view full) ---

580 { Q_STATS_OFFSET32(total_tpa_bytes_hi),
581 8, "tpa_bytes"},
582 { Q_STATS_OFFSET32(rx_calls),
583 4, "rx_calls"},
584 { Q_STATS_OFFSET32(rx_pkts),
585 4, "rx_pkts"},
586 { Q_STATS_OFFSET32(rx_tpa_pkts),
587 4, "rx_tpa_pkts"},
588 { Q_STATS_OFFSET32(rx_jumbo_sge_pkts),
589 4, "rx_jumbo_sge_pkts"},
586 { Q_STATS_OFFSET32(rx_soft_errors),
587 4, "rx_soft_errors"},
588 { Q_STATS_OFFSET32(rx_hw_csum_errors),
589 4, "rx_hw_csum_errors"},
590 { Q_STATS_OFFSET32(rx_ofld_frames_csum_ip),
591 4, "rx_ofld_frames_csum_ip"},
592 { Q_STATS_OFFSET32(rx_ofld_frames_csum_tcp_udp),
593 4, "rx_ofld_frames_csum_tcp_udp"},

--- 2867 unchanged lines hidden (view full) ---

3461 /* we allocated a replacement mbuf, fixup the current one */
3462 m_adj(m, pad);
3463 m->m_pkthdr.len = m->m_len = len;
3464
3465 if (len != lenonbd){
3466 rc = bxe_service_rxsgl(fp, len, lenonbd, m, cqe_fp);
3467 if (rc)
3468 break;
590 { Q_STATS_OFFSET32(rx_soft_errors),
591 4, "rx_soft_errors"},
592 { Q_STATS_OFFSET32(rx_hw_csum_errors),
593 4, "rx_hw_csum_errors"},
594 { Q_STATS_OFFSET32(rx_ofld_frames_csum_ip),
595 4, "rx_ofld_frames_csum_ip"},
596 { Q_STATS_OFFSET32(rx_ofld_frames_csum_tcp_udp),
597 4, "rx_ofld_frames_csum_tcp_udp"},

--- 2867 unchanged lines hidden (view full) ---

3465 /* we allocated a replacement mbuf, fixup the current one */
3466 m_adj(m, pad);
3467 m->m_pkthdr.len = m->m_len = len;
3468
3469 if (len != lenonbd){
3470 rc = bxe_service_rxsgl(fp, len, lenonbd, m, cqe_fp);
3471 if (rc)
3472 break;
3473 fp->eth_q_stats.rx_jumbo_sge_pkts++;
3469 }
3470
3471 /* assign packet to this interface interface */
3472 if_setrcvif(m, ifp);
3473
3474 /* assume no hardware checksum has complated */
3475 m->m_pkthdr.csum_flags = 0;
3476

--- 3362 unchanged lines hidden (view full) ---

6839 ring_prod = RX_BD_NEXT(ring_prod);
6840 cqe_ring_prod = RCQ_NEXT(cqe_ring_prod);
6841 }
6842
6843 fp->rx_bd_prod = ring_prod;
6844 fp->rx_cq_prod = cqe_ring_prod;
6845 fp->eth_q_stats.rx_calls = fp->eth_q_stats.rx_pkts = 0;
6846
3474 }
3475
3476 /* assign packet to this interface interface */
3477 if_setrcvif(m, ifp);
3478
3479 /* assume no hardware checksum has complated */
3480 m->m_pkthdr.csum_flags = 0;
3481

--- 3362 unchanged lines hidden (view full) ---

6844 ring_prod = RX_BD_NEXT(ring_prod);
6845 cqe_ring_prod = RCQ_NEXT(cqe_ring_prod);
6846 }
6847
6848 fp->rx_bd_prod = ring_prod;
6849 fp->rx_cq_prod = cqe_ring_prod;
6850 fp->eth_q_stats.rx_calls = fp->eth_q_stats.rx_pkts = 0;
6851
6847 if (if_getcapenable(sc->ifp) & IFCAP_LRO) {
6848 max_agg_queues = MAX_AGG_QS(sc);
6852 max_agg_queues = MAX_AGG_QS(sc);
6849
6853
6850 fp->tpa_enable = TRUE;
6854 fp->tpa_enable = TRUE;
6851
6855
6852 /* fill the TPA pool */
6853 for (j = 0; j < max_agg_queues; j++) {
6854 rc = bxe_alloc_rx_tpa_mbuf(fp, j);
6855 if (rc != 0) {
6856 BLOGE(sc, "mbuf alloc fail for fp[%02d] TPA queue %d\n",
6856 /* fill the TPA pool */
6857 for (j = 0; j < max_agg_queues; j++) {
6858 rc = bxe_alloc_rx_tpa_mbuf(fp, j);
6859 if (rc != 0) {
6860 BLOGE(sc, "mbuf alloc fail for fp[%02d] TPA queue %d\n",
6857 i, j);
6861 i, j);
6858 fp->tpa_enable = FALSE;
6859 goto bxe_alloc_fp_buffers_error;
6860 }
6861
6862 fp->rx_tpa_info[j].state = BXE_TPA_STATE_STOP;
6862 fp->tpa_enable = FALSE;
6863 goto bxe_alloc_fp_buffers_error;
6863 }
6864
6864 }
6865
6865 if (fp->tpa_enable) {
6866 /* fill the RX SGE chain */
6867 ring_prod = 0;
6868 for (j = 0; j < RX_SGE_USABLE; j++) {
6869 rc = bxe_alloc_rx_sge_mbuf(fp, ring_prod);
6870 if (rc != 0) {
6871 BLOGE(sc, "mbuf alloc fail for fp[%02d] SGE %d\n",
6872 i, ring_prod);
6873 fp->tpa_enable = FALSE;
6874 ring_prod = 0;
6875 goto bxe_alloc_fp_buffers_error;
6876 }
6866 fp->rx_tpa_info[j].state = BXE_TPA_STATE_STOP;
6867 }
6877
6868
6878 ring_prod = RX_SGE_NEXT(ring_prod);
6869 if (fp->tpa_enable) {
6870 /* fill the RX SGE chain */
6871 ring_prod = 0;
6872 for (j = 0; j < RX_SGE_USABLE; j++) {
6873 rc = bxe_alloc_rx_sge_mbuf(fp, ring_prod);
6874 if (rc != 0) {
6875 BLOGE(sc, "mbuf alloc fail for fp[%02d] SGE %d\n",
6876 i, ring_prod);
6877 fp->tpa_enable = FALSE;
6878 ring_prod = 0;
6879 goto bxe_alloc_fp_buffers_error;
6879 }
6880
6880 }
6881
6881 fp->rx_sge_prod = ring_prod;
6882 ring_prod = RX_SGE_NEXT(ring_prod);
6882 }
6883 }
6884
6885 fp->rx_sge_prod = ring_prod;
6883 }
6884 }
6885
6886 return (0);
6887
6888bxe_alloc_fp_buffers_error:
6889
6890 /* unwind what was already allocated */

--- 4867 unchanged lines hidden (view full) ---

11758 struct bxe_fastpath *fp,
11759 struct rxq_pause_params *pause,
11760 struct ecore_rxq_setup_params *rxq_init)
11761{
11762 uint8_t max_sge = 0;
11763 uint16_t sge_sz = 0;
11764 uint16_t tpa_agg_size = 0;
11765
6886 }
6887 }
6888
6889 return (0);
6890
6891bxe_alloc_fp_buffers_error:
6892
6893 /* unwind what was already allocated */

--- 4867 unchanged lines hidden (view full) ---

11761 struct bxe_fastpath *fp,
11762 struct rxq_pause_params *pause,
11763 struct ecore_rxq_setup_params *rxq_init)
11764{
11765 uint8_t max_sge = 0;
11766 uint16_t sge_sz = 0;
11767 uint16_t tpa_agg_size = 0;
11768
11766 if (if_getcapenable(sc->ifp) & IFCAP_LRO) {
11767 pause->sge_th_lo = SGE_TH_LO(sc);
11768 pause->sge_th_hi = SGE_TH_HI(sc);
11769 pause->sge_th_lo = SGE_TH_LO(sc);
11770 pause->sge_th_hi = SGE_TH_HI(sc);
11769
11771
11770 /* validate SGE ring has enough to cross high threshold */
11771 if (sc->dropless_fc &&
11772 /* validate SGE ring has enough to cross high threshold */
11773 if (sc->dropless_fc &&
11772 (pause->sge_th_hi + FW_PREFETCH_CNT) >
11773 (RX_SGE_USABLE_PER_PAGE * RX_SGE_NUM_PAGES)) {
11774 (pause->sge_th_hi + FW_PREFETCH_CNT) >
11775 (RX_SGE_USABLE_PER_PAGE * RX_SGE_NUM_PAGES)) {
11774 BLOGW(sc, "sge ring threshold limit\n");
11775 }
11776 BLOGW(sc, "sge ring threshold limit\n");
11777 }
11776
11778
11777 /* minimum max_aggregation_size is 2*MTU (two full buffers) */
11778 tpa_agg_size = (2 * sc->mtu);
11779 if (tpa_agg_size < sc->max_aggregation_size) {
11780 tpa_agg_size = sc->max_aggregation_size;
11781 }
11779 /* minimum max_aggregation_size is 2*MTU (two full buffers) */
11780 tpa_agg_size = (2 * sc->mtu);
11781 if (tpa_agg_size < sc->max_aggregation_size) {
11782 tpa_agg_size = sc->max_aggregation_size;
11783 }
11782
11784
11783 max_sge = SGE_PAGE_ALIGN(sc->mtu) >> SGE_PAGE_SHIFT;
11784 max_sge = ((max_sge + PAGES_PER_SGE - 1) &
11785 max_sge = SGE_PAGE_ALIGN(sc->mtu) >> SGE_PAGE_SHIFT;
11786 max_sge = ((max_sge + PAGES_PER_SGE - 1) &
11785 (~(PAGES_PER_SGE - 1))) >> PAGES_PER_SGE_SHIFT;
11787 (~(PAGES_PER_SGE - 1))) >> PAGES_PER_SGE_SHIFT;
11786 sge_sz = (uint16_t)min(SGE_PAGES, 0xffff);
11787 }
11788 sge_sz = (uint16_t)min(SGE_PAGES, 0xffff);
11788
11789 /* pause - not for e1 */
11790 if (!CHIP_IS_E1(sc)) {
11791 pause->bd_th_lo = BD_TH_LO(sc);
11792 pause->bd_th_hi = BD_TH_HI(sc);
11793
11794 pause->rcq_th_lo = RCQ_TH_LO(sc);
11795 pause->rcq_th_hi = RCQ_TH_HI(sc);

--- 7074 unchanged lines hidden ---
11789
11790 /* pause - not for e1 */
11791 if (!CHIP_IS_E1(sc)) {
11792 pause->bd_th_lo = BD_TH_LO(sc);
11793 pause->bd_th_hi = BD_TH_HI(sc);
11794
11795 pause->rcq_th_lo = RCQ_TH_LO(sc);
11796 pause->rcq_th_hi = RCQ_TH_HI(sc);

--- 7074 unchanged lines hidden ---