FreeBSD/sys/dev/cxgbe/t4_main.c
/*
 * Come up with reasonable defaults for some of the tunables, provided they're
 * not set by the user (in which case we'll use the values as is).
 */
Come up with reasonable defaults for some of the tunables, provided they're
not set by the user (in which case we'll use the values as is).
Come up with reasonable defaults for some of the tunables provided they ' re not set by the user ( in which case we ' ll use the values as is ) .
static void
tweak_tunables(void)
{
	int nc = mp_ncpus;	
	if (t4_ntxq10g < 1) {
#ifdef RSS
		t4_ntxq10g = rss_getnumbuckets();
#else
		t4_ntxq10g = min(nc, NTXQ_10G);
#endif
	}
	if (t4_ntxq1g < 1) {
#ifdef RSS
		t4_ntxq1g = rss_getnumbuckets();
#else
		t4_ntxq1g = min(nc, NTXQ_1G);
#endif
	}
	if (t4_ntxq_vi < 1)
		t4_ntxq_vi = min(nc, NTXQ_VI);
	if (t4_nrxq10g < 1) {
#ifdef RSS
		t4_nrxq10g = rss_getnumbuckets();
#else
		t4_nrxq10g = min(nc, NRXQ_10G);
#endif
	}
	if (t4_nrxq1g < 1) {
#ifdef RSS
		t4_nrxq1g = rss_getnumbuckets();
#else
		t4_nrxq1g = min(nc, NRXQ_1G);
#endif
	}
	if (t4_nrxq_vi < 1)
		t4_nrxq_vi = min(nc, NRXQ_VI);
#ifdef TCP_OFFLOAD
	if (t4_nofldtxq10g < 1)
		t4_nofldtxq10g = min(nc, NOFLDTXQ_10G);
	if (t4_nofldtxq1g < 1)
		t4_nofldtxq1g = min(nc, NOFLDTXQ_1G);
	if (t4_nofldtxq_vi < 1)
		t4_nofldtxq_vi = min(nc, NOFLDTXQ_VI);
	if (t4_nofldrxq10g < 1)
		t4_nofldrxq10g = min(nc, NOFLDRXQ_10G);
	if (t4_nofldrxq1g < 1)
		t4_nofldrxq1g = min(nc, NOFLDRXQ_1G);
	if (t4_nofldrxq_vi < 1)
		t4_nofldrxq_vi = min(nc, NOFLDRXQ_VI);
	if (t4_toecaps_allowed == -1)
		t4_toecaps_allowed = FW_CAPS_CONFIG_TOE;
	if (t4_rdmacaps_allowed == -1) {
		t4_rdmacaps_allowed = FW_CAPS_CONFIG_RDMA_RDDP |
		    FW_CAPS_CONFIG_RDMA_RDMAC;
	}
	if (t4_iscsicaps_allowed == -1) {
		t4_iscsicaps_allowed = FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU |
		    FW_CAPS_CONFIG_ISCSI_TARGET_PDU |
		    FW_CAPS_CONFIG_ISCSI_T10DIF;
	}
#else
	if (t4_toecaps_allowed == -1)
		t4_toecaps_allowed = 0;
	if (t4_rdmacaps_allowed == -1)
		t4_rdmacaps_allowed = 0;
	if (t4_iscsicaps_allowed == -1)
		t4_iscsicaps_allowed = 0;
#endif
#ifdef DEV_NETMAP
	if (t4_nnmtxq_vi < 1)
		t4_nnmtxq_vi = min(nc, NNMTXQ_VI);
	if (t4_nnmrxq_vi < 1)
		t4_nnmrxq_vi = min(nc, NNMRXQ_VI);
#endif
	if (t4_tmr_idx_10g < 0 || t4_tmr_idx_10g >= SGE_NTIMERS)
		t4_tmr_idx_10g = TMR_IDX_10G;
	if (t4_pktc_idx_10g < -1 || t4_pktc_idx_10g >= SGE_NCOUNTERS)
		t4_pktc_idx_10g = PKTC_IDX_10G;
	if (t4_tmr_idx_1g < 0 || t4_tmr_idx_1g >= SGE_NTIMERS)
		t4_tmr_idx_1g = TMR_IDX_1G;
	if (t4_pktc_idx_1g < -1 || t4_pktc_idx_1g >= SGE_NCOUNTERS)
		t4_pktc_idx_1g = PKTC_IDX_1G;
	if (t4_qsize_txq < 128)
		t4_qsize_txq = 128;
	if (t4_qsize_rxq < 128)
		t4_qsize_rxq = 128;
	while (t4_qsize_rxq & 7)
		t4_qsize_rxq++;
	t4_intr_types &= INTR_MSIX | INTR_MSI | INTR_INTX;
}
static void tweak_tunables ( void ) { int nc = mp_ncpus ; if ( t4_ntxq10g < 1 ) { #ifdef RSS t4_ntxq10g = rss_getnumbuckets ( ) ; #else t4_ntxq10g = min ( nc , NTXQ_10G ) ; #endif } if ( t4_ntxq1g < 1 ) { #ifdef RSS t4_ntxq1g = rss_getnumbuckets ( ) ; #else t4_ntxq1g = min ( nc , NTXQ_1G ) ; #endif } if ( t4_ntxq_vi < 1 ) t4_ntxq_vi = min ( nc , NTXQ_VI ) ; if ( t4_nrxq10g < 1 ) { #ifdef RSS t4_nrxq10g = rss_getnumbuckets ( ) ; #else t4_nrxq10g = min ( nc , NRXQ_10G ) ; #endif } if ( t4_nrxq1g < 1 ) { #ifdef RSS t4_nrxq1g = rss_getnumbuckets ( ) ; #else t4_nrxq1g = min ( nc , NRXQ_1G ) ; #endif } if ( t4_nrxq_vi < 1 ) t4_nrxq_vi = min ( nc , NRXQ_VI ) ; #ifdef TCP_OFFLOAD if ( t4_nofldtxq10g < 1 ) t4_nofldtxq10g = min ( nc , NOFLDTXQ_10G ) ; if ( t4_nofldtxq1g < 1 ) t4_nofldtxq1g = min ( nc , NOFLDTXQ_1G ) ; if ( t4_nofldtxq_vi < 1 ) t4_nofldtxq_vi = min ( nc , NOFLDTXQ_VI ) ; if ( t4_nofldrxq10g < 1 ) t4_nofldrxq10g = min ( nc , NOFLDRXQ_10G ) ; if ( t4_nofldrxq1g < 1 ) t4_nofldrxq1g = min ( nc , NOFLDRXQ_1G ) ; if ( t4_nofldrxq_vi < 1 ) t4_nofldrxq_vi = min ( nc , NOFLDRXQ_VI ) ; if ( t4_toecaps_allowed == -1 ) t4_toecaps_allowed = FW_CAPS_CONFIG_TOE ; if ( t4_rdmacaps_allowed == -1 ) { t4_rdmacaps_allowed = FW_CAPS_CONFIG_RDMA_RDDP | FW_CAPS_CONFIG_RDMA_RDMAC ; } if ( t4_iscsicaps_allowed == -1 ) { t4_iscsicaps_allowed = FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU | FW_CAPS_CONFIG_ISCSI_TARGET_PDU | FW_CAPS_CONFIG_ISCSI_T10DIF ; } #else if ( t4_toecaps_allowed == -1 ) t4_toecaps_allowed = 0 ; if ( t4_rdmacaps_allowed == -1 ) t4_rdmacaps_allowed = 0 ; if ( t4_iscsicaps_allowed == -1 ) t4_iscsicaps_allowed = 0 ; #endif #ifdef DEV_NETMAP if ( t4_nnmtxq_vi < 1 ) t4_nnmtxq_vi = min ( nc , NNMTXQ_VI ) ; if ( t4_nnmrxq_vi < 1 ) t4_nnmrxq_vi = min ( nc , NNMRXQ_VI ) ; #endif if ( t4_tmr_idx_10g < 0 || t4_tmr_idx_10g >= SGE_NTIMERS ) t4_tmr_idx_10g = TMR_IDX_10G ; if ( t4_pktc_idx_10g < -1 || t4_pktc_idx_10g >= SGE_NCOUNTERS ) t4_pktc_idx_10g = PKTC_IDX_10G ; if ( t4_tmr_idx_1g < 0 || t4_tmr_idx_1g >= SGE_NTIMERS ) t4_tmr_idx_1g = TMR_IDX_1G ; if ( t4_pktc_idx_1g < -1 || t4_pktc_idx_1g >= SGE_NCOUNTERS ) t4_pktc_idx_1g = PKTC_IDX_1G ; if ( t4_qsize_txq < 128 ) t4_qsize_txq = 128 ; if ( t4_qsize_rxq < 128 ) t4_qsize_rxq = 128 ; while ( t4_qsize_rxq & 7 ) t4_qsize_rxq ++ ; t4_intr_types &= INTR_MSIX | INTR_MSI | INTR_INTX ; }
Come up with reasonable defaults for some of the tunables, provided they're
 not set by the user (in which case we'll use the values as is).
Come up with reasonable defaults for some of the tunables provided they ' re not set by the user ( in which case we ' ll use the values as is ) .
/* our snapshot of the number of CPUs */ /* XXX: way too many for 1GbE? */ /* XXX: way too many for 1GbE? */