15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * tavor_cfg.c
29 * Tavor Configuration Profile Routines
30 *
31 * Implements the routines necessary for initializing and (later) tearing
32 * down the list of Tavor configuration information.
33 */
34
35 #include <sys/types.h>
36 #include <sys/conf.h>
37 #include <sys/ddi.h>
38 #include <sys/sunddi.h>
39 #include <sys/modctl.h>
40 #include <sys/bitmap.h>
41
42 #include <sys/ib/adapters/tavor/tavor.h>
43
44 /* Set to enable alternative configurations: 0 = automatic config, 1 = manual */
45 uint32_t tavor_alt_config_enable = 0;
46
47 /* Number of supported QPs and their maximum size */
48 uint32_t tavor_log_num_qp = TAVOR_NUM_QP_SHIFT_128;
49 uint32_t tavor_log_max_qp_sz = TAVOR_QP_SZ_SHIFT;
50
51 /* Number of supported SGL per WQE */
52 uint32_t tavor_wqe_max_sgl = TAVOR_NUM_WQE_SGL;
53
54 /* Number of supported CQs and their maximum size */
640 {
641 uint_t max_size, log2;
642 uint_t max_sgl, real_max_sgl;
643
644 /*
645 * Get the requested maximum number SGL per WQE from the Tavor
646 * patchable variable
647 */
648 max_sgl = tavor_wqe_max_sgl;
649
650 /*
651 * Use requested maximum number of SGL to calculate the max descriptor
652 * size (while guaranteeing that the descriptor size is a power-of-2
653 * cachelines). We have to use the calculation for QP1 MLX transport
654 * because the possibility that we might need to inline a GRH, along
655 * with all the other headers and alignment restrictions, sets the
656 * maximum for the number of SGLs that we can advertise support for.
657 */
658 max_size = (TAVOR_QP_WQE_MLX_QP1_HDRS + (max_sgl << 4));
659 log2 = highbit(max_size);
660 if ((max_size & (max_size - 1)) == 0) {
661 log2 = log2 - 1;
662 }
663 max_size = (1 << log2);
664
665 /*
666 * Now clip the maximum descriptor size based on Tavor HW maximum
667 */
668 max_size = min(max_size, TAVOR_QP_WQE_MAX_SIZE);
669
670 /*
671 * Then use the calculated max descriptor size to determine the "real"
672 * maximum SGL (the number beyond which we would roll over to the next
673 * power-of-2).
674 */
675 real_max_sgl = (max_size - TAVOR_QP_WQE_MLX_QP1_HDRS) >> 4;
676
677 /* Then save away this configuration information */
678 cp->cp_wqe_max_sgl = max_sgl;
679 cp->cp_wqe_real_max_sgl = real_max_sgl;
680
|
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * tavor_cfg.c
29 * Tavor Configuration Profile Routines
30 *
31 * Implements the routines necessary for initializing and (later) tearing
32 * down the list of Tavor configuration information.
33 */
34
35 #include <sys/sysmacros.h>
36 #include <sys/types.h>
37 #include <sys/conf.h>
38 #include <sys/ddi.h>
39 #include <sys/sunddi.h>
40 #include <sys/modctl.h>
41 #include <sys/bitmap.h>
42
43 #include <sys/ib/adapters/tavor/tavor.h>
44
45 /* Set to enable alternative configurations: 0 = automatic config, 1 = manual */
46 uint32_t tavor_alt_config_enable = 0;
47
48 /* Number of supported QPs and their maximum size */
49 uint32_t tavor_log_num_qp = TAVOR_NUM_QP_SHIFT_128;
50 uint32_t tavor_log_max_qp_sz = TAVOR_QP_SZ_SHIFT;
51
52 /* Number of supported SGL per WQE */
53 uint32_t tavor_wqe_max_sgl = TAVOR_NUM_WQE_SGL;
54
55 /* Number of supported CQs and their maximum size */
641 {
642 uint_t max_size, log2;
643 uint_t max_sgl, real_max_sgl;
644
645 /*
646 * Get the requested maximum number SGL per WQE from the Tavor
647 * patchable variable
648 */
649 max_sgl = tavor_wqe_max_sgl;
650
651 /*
652 * Use requested maximum number of SGL to calculate the max descriptor
653 * size (while guaranteeing that the descriptor size is a power-of-2
654 * cachelines). We have to use the calculation for QP1 MLX transport
655 * because the possibility that we might need to inline a GRH, along
656 * with all the other headers and alignment restrictions, sets the
657 * maximum for the number of SGLs that we can advertise support for.
658 */
659 max_size = (TAVOR_QP_WQE_MLX_QP1_HDRS + (max_sgl << 4));
660 log2 = highbit(max_size);
661 if (ISP2(max_size)) {
662 log2 = log2 - 1;
663 }
664 max_size = (1 << log2);
665
666 /*
667 * Now clip the maximum descriptor size based on Tavor HW maximum
668 */
669 max_size = min(max_size, TAVOR_QP_WQE_MAX_SIZE);
670
671 /*
672 * Then use the calculated max descriptor size to determine the "real"
673 * maximum SGL (the number beyond which we would roll over to the next
674 * power-of-2).
675 */
676 real_max_sgl = (max_size - TAVOR_QP_WQE_MLX_QP1_HDRS) >> 4;
677
678 /* Then save away this configuration information */
679 cp->cp_wqe_max_sgl = max_sgl;
680 cp->cp_wqe_real_max_sgl = real_max_sgl;
681
|