aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r--drivers/net/bnx2x/bnx2x_dcb.c2
-rw-r--r--drivers/net/bnx2x/bnx2x_link.c753
-rw-r--r--drivers/net/bnx2x/bnx2x_link.h40
-rw-r--r--drivers/net/bnx2x/bnx2x_reg.h172
4 files changed, 963 insertions, 4 deletions
diff --git a/drivers/net/bnx2x/bnx2x_dcb.c b/drivers/net/bnx2x/bnx2x_dcb.c
index aaed9f09c329..50a5c4f3d583 100644
--- a/drivers/net/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/bnx2x/bnx2x_dcb.c
@@ -424,7 +424,7 @@ static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp)
424 struct bnx2x_dcbx_pg_params *ets = &(bp->dcbx_port_params.ets); 424 struct bnx2x_dcbx_pg_params *ets = &(bp->dcbx_port_params.ets);
425 u8 status = 0; 425 u8 status = 0;
426 426
427 bnx2x_ets_disabled(&bp->link_params/*, &bp->link_vars*/); 427 bnx2x_ets_disabled(&bp->link_params, &bp->link_vars);
428 428
429 if (!ets->enabled) 429 if (!ets->enabled)
430 return; 430 return;
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 73938f9201a9..a5c34880b39e 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -337,12 +337,12 @@ static void bnx2x_set_cfg_pin(struct bnx2x *bp, u32 pin_cfg, u32 val)
337/******************************************************************/ 337/******************************************************************/
338/* ETS section */ 338/* ETS section */
339/******************************************************************/ 339/******************************************************************/
340void bnx2x_ets_disabled(struct link_params *params) 340static void bnx2x_ets_e2e3a0_disabled(struct link_params *params)
341{ 341{
342 /* ETS disabled configuration*/ 342 /* ETS disabled configuration*/
343 struct bnx2x *bp = params->bp; 343 struct bnx2x *bp = params->bp;
344 344
345 DP(NETIF_MSG_LINK, "ETS disabled configuration\n"); 345 DP(NETIF_MSG_LINK, "ETS E2E3 disabled configuration\n");
346 346
347 /* 347 /*
348 * mapping between entry priority to client number (0,1,2 -debug and 348 * mapping between entry priority to client number (0,1,2 -debug and
@@ -395,7 +395,756 @@ void bnx2x_ets_disabled(struct link_params *params)
395 /* Defines the number of consecutive slots for the strict priority */ 395 /* Defines the number of consecutive slots for the strict priority */
396 REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); 396 REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0);
397} 397}
398/******************************************************************************
399* Description:
400* Getting min_w_val will be set according to line speed .
401*.
402******************************************************************************/
403static u32 bnx2x_ets_get_min_w_val_nig(const struct link_vars *vars)
404{
405 u32 min_w_val = 0;
406 /* Calculate min_w_val.*/
407 if (vars->link_up) {
408 if (SPEED_20000 == vars->line_speed)
409 min_w_val = ETS_E3B0_NIG_MIN_W_VAL_20GBPS;
410 else
411 min_w_val = ETS_E3B0_NIG_MIN_W_VAL_UP_TO_10GBPS;
412 } else
413 min_w_val = ETS_E3B0_NIG_MIN_W_VAL_20GBPS;
414 /**
415 * If the link isn't up (static configuration for example ) The
416 * link will be according to 20GBPS.
417 */
418 return min_w_val;
419}
420/******************************************************************************
421* Description:
422* Getting credit upper bound form min_w_val.
423*.
424******************************************************************************/
425static u32 bnx2x_ets_get_credit_upper_bound(const u32 min_w_val)
426{
427 const u32 credit_upper_bound = (u32)MAXVAL((150 * min_w_val),
428 MAX_PACKET_SIZE);
429 return credit_upper_bound;
430}
431/******************************************************************************
432* Description:
433* Set credit upper bound for NIG.
434*.
435******************************************************************************/
436static void bnx2x_ets_e3b0_set_credit_upper_bound_nig(
437 const struct link_params *params,
438 const u32 min_w_val)
439{
440 struct bnx2x *bp = params->bp;
441 const u8 port = params->port;
442 const u32 credit_upper_bound =
443 bnx2x_ets_get_credit_upper_bound(min_w_val);
444
445 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_0 :
446 NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0, credit_upper_bound);
447 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_1 :
448 NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_1, credit_upper_bound);
449 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_2 :
450 NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_2, credit_upper_bound);
451 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_3 :
452 NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_3, credit_upper_bound);
453 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_4 :
454 NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_4, credit_upper_bound);
455 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_5 :
456 NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_5, credit_upper_bound);
457
458 if (0 == port) {
459 REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_6,
460 credit_upper_bound);
461 REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_7,
462 credit_upper_bound);
463 REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_8,
464 credit_upper_bound);
465 }
466}
467/******************************************************************************
468* Description:
469* Will return the NIG ETS registers to init values.Except
470* credit_upper_bound.
471* That isn't used in this configuration (No WFQ is enabled) and will be
472* configured acording to spec
473*.
474******************************************************************************/
475static void bnx2x_ets_e3b0_nig_disabled(const struct link_params *params,
476 const struct link_vars *vars)
477{
478 struct bnx2x *bp = params->bp;
479 const u8 port = params->port;
480 const u32 min_w_val = bnx2x_ets_get_min_w_val_nig(vars);
481 /**
482 * mapping between entry priority to client number (0,1,2 -debug and
483 * management clients, 3 - COS0 client, 4 - COS1, ... 8 -
484 * COS5)(HIGHEST) 4bits client num.TODO_ETS - Should be done by
485 * reset value or init tool
486 */
487 if (port) {
488 REG_WR(bp, NIG_REG_P1_TX_ARB_PRIORITY_CLIENT2_LSB, 0x543210);
489 REG_WR(bp, NIG_REG_P1_TX_ARB_PRIORITY_CLIENT2_MSB, 0x0);
490 } else {
491 REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_LSB, 0x76543210);
492 REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_MSB, 0x8);
493 }
494 /**
495 * For strict priority entries defines the number of consecutive
496 * slots for the highest priority.
497 */
498 /* TODO_ETS - Should be done by reset value or init tool */
499 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS :
500 NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100);
501 /**
502 * mapping between the CREDIT_WEIGHT registers and actual client
503 * numbers
504 */
505 /* TODO_ETS - Should be done by reset value or init tool */
506 if (port) {
507 /*Port 1 has 6 COS*/
508 REG_WR(bp, NIG_REG_P1_TX_ARB_CLIENT_CREDIT_MAP2_LSB, 0x210543);
509 REG_WR(bp, NIG_REG_P1_TX_ARB_CLIENT_CREDIT_MAP2_MSB, 0x0);
510 } else {
511 /*Port 0 has 9 COS*/
512 REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP2_LSB,
513 0x43210876);
514 REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP2_MSB, 0x5);
515 }
516
517 /**
518 * Bitmap of 5bits length. Each bit specifies whether the entry behaves
519 * as strict. Bits 0,1,2 - debug and management entries, 3 -
520 * COS0 entry, 4 - COS1 entry.
521 * COS1 | COS0 | DEBUG1 | DEBUG0 | MGMT
522 * bit4 bit3 bit2 bit1 bit0
523 * MCP and debug are strict
524 */
525 if (port)
526 REG_WR(bp, NIG_REG_P1_TX_ARB_CLIENT_IS_STRICT, 0x3f);
527 else
528 REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x1ff);
529 /* defines which entries (clients) are subjected to WFQ arbitration */
530 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CLIENT_IS_SUBJECT2WFQ :
531 NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0);
532
533 /**
534 * Please notice the register address are note continuous and a
535 * for here is note appropriate.In 2 port mode port0 only COS0-5
536 * can be used. DEBUG1,DEBUG1,MGMT are never used for WFQ* In 4
537 * port mode port1 only COS0-2 can be used. DEBUG1,DEBUG1,MGMT
538 * are never used for WFQ
539 */
540 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_0 :
541 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_0, 0x0);
542 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_1 :
543 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_1, 0x0);
544 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_2 :
545 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_2, 0x0);
546 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_3 :
547 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_3, 0x0);
548 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_4 :
549 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_4, 0x0);
550 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_5 :
551 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_5, 0x0);
552 if (0 == port) {
553 REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_6, 0x0);
554 REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_7, 0x0);
555 REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_8, 0x0);
556 }
557
558 bnx2x_ets_e3b0_set_credit_upper_bound_nig(params, min_w_val);
559}
560/******************************************************************************
561* Description:
562* Set credit upper bound for PBF.
563*.
564******************************************************************************/
565static void bnx2x_ets_e3b0_set_credit_upper_bound_pbf(
566 const struct link_params *params,
567 const u32 min_w_val)
568{
569 struct bnx2x *bp = params->bp;
570 const u32 credit_upper_bound =
571 bnx2x_ets_get_credit_upper_bound(min_w_val);
572 const u8 port = params->port;
573 u32 base_upper_bound = 0;
574 u8 max_cos = 0;
575 u8 i = 0;
576 /**
577 * In 2 port mode port0 has COS0-5 that can be used for WFQ.In 4
578 * port mode port1 has COS0-2 that can be used for WFQ.
579 */
580 if (0 == port) {
581 base_upper_bound = PBF_REG_COS0_UPPER_BOUND_P0;
582 max_cos = DCBX_E3B0_MAX_NUM_COS_PORT0;
583 } else {
584 base_upper_bound = PBF_REG_COS0_UPPER_BOUND_P1;
585 max_cos = DCBX_E3B0_MAX_NUM_COS_PORT1;
586 }
587
588 for (i = 0; i < max_cos; i++)
589 REG_WR(bp, base_upper_bound + (i << 2), credit_upper_bound);
590}
398 591
592/******************************************************************************
593* Description:
594* Will return the PBF ETS registers to init values.Except
595* credit_upper_bound.
596* That isn't used in this configuration (No WFQ is enabled) and will be
597* configured acording to spec
598*.
599******************************************************************************/
600static void bnx2x_ets_e3b0_pbf_disabled(const struct link_params *params)
601{
602 struct bnx2x *bp = params->bp;
603 const u8 port = params->port;
604 const u32 min_w_val_pbf = ETS_E3B0_PBF_MIN_W_VAL;
605 u8 i = 0;
606 u32 base_weight = 0;
607 u8 max_cos = 0;
608
609 /**
610 * mapping between entry priority to client number 0 - COS0
611 * client, 2 - COS1, ... 5 - COS5)(HIGHEST) 4bits client num.
612 * TODO_ETS - Should be done by reset value or init tool
613 */
614 if (port)
615 /* 0x688 (|011|0 10|00 1|000) */
616 REG_WR(bp, PBF_REG_ETS_ARB_PRIORITY_CLIENT_P1 , 0x688);
617 else
618 /* (10 1|100 |011|0 10|00 1|000) */
619 REG_WR(bp, PBF_REG_ETS_ARB_PRIORITY_CLIENT_P0 , 0x2C688);
620
621 /* TODO_ETS - Should be done by reset value or init tool */
622 if (port)
623 /* 0x688 (|011|0 10|00 1|000)*/
624 REG_WR(bp, PBF_REG_ETS_ARB_CLIENT_CREDIT_MAP_P1, 0x688);
625 else
626 /* 0x2C688 (10 1|100 |011|0 10|00 1|000) */
627 REG_WR(bp, PBF_REG_ETS_ARB_CLIENT_CREDIT_MAP_P0, 0x2C688);
628
629 REG_WR(bp, (port) ? PBF_REG_ETS_ARB_NUM_STRICT_ARB_SLOTS_P1 :
630 PBF_REG_ETS_ARB_NUM_STRICT_ARB_SLOTS_P0 , 0x100);
631
632
633 REG_WR(bp, (port) ? PBF_REG_ETS_ARB_CLIENT_IS_STRICT_P1 :
634 PBF_REG_ETS_ARB_CLIENT_IS_STRICT_P0 , 0);
635
636 REG_WR(bp, (port) ? PBF_REG_ETS_ARB_CLIENT_IS_SUBJECT2WFQ_P1 :
637 PBF_REG_ETS_ARB_CLIENT_IS_SUBJECT2WFQ_P0 , 0);
638 /**
639 * In 2 port mode port0 has COS0-5 that can be used for WFQ.
640 * In 4 port mode port1 has COS0-2 that can be used for WFQ.
641 */
642 if (0 == port) {
643 base_weight = PBF_REG_COS0_WEIGHT_P0;
644 max_cos = DCBX_E3B0_MAX_NUM_COS_PORT0;
645 } else {
646 base_weight = PBF_REG_COS0_WEIGHT_P1;
647 max_cos = DCBX_E3B0_MAX_NUM_COS_PORT1;
648 }
649
650 for (i = 0; i < max_cos; i++)
651 REG_WR(bp, base_weight + (0x4 * i), 0);
652
653 bnx2x_ets_e3b0_set_credit_upper_bound_pbf(params, min_w_val_pbf);
654}
655/******************************************************************************
656* Description:
657* E3B0 disable will return basicly the values to init values.
658*.
659******************************************************************************/
660static int bnx2x_ets_e3b0_disabled(const struct link_params *params,
661 const struct link_vars *vars)
662{
663 struct bnx2x *bp = params->bp;
664
665 if (!CHIP_IS_E3B0(bp)) {
666 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_disabled the chip isn't E3B0"
667 "\n");
668 return -EINVAL;
669 }
670
671 bnx2x_ets_e3b0_nig_disabled(params, vars);
672
673 bnx2x_ets_e3b0_pbf_disabled(params);
674
675 return 0;
676}
677
678/******************************************************************************
679* Description:
680* Disable will return basicly the values to init values.
681*.
682******************************************************************************/
683int bnx2x_ets_disabled(struct link_params *params,
684 struct link_vars *vars)
685{
686 struct bnx2x *bp = params->bp;
687 int bnx2x_status = 0;
688
689 if ((CHIP_IS_E2(bp)) || (CHIP_IS_E3A0(bp)))
690 bnx2x_ets_e2e3a0_disabled(params);
691 else if (CHIP_IS_E3B0(bp))
692 bnx2x_status = bnx2x_ets_e3b0_disabled(params, vars);
693 else {
694 DP(NETIF_MSG_LINK, "bnx2x_ets_disabled - chip not supported\n");
695 return -EINVAL;
696 }
697
698 return bnx2x_status;
699}
700
701/******************************************************************************
702* Description
703* Set the COS mappimg to SP and BW until this point all the COS are not
704* set as SP or BW.
705******************************************************************************/
706static int bnx2x_ets_e3b0_cli_map(const struct link_params *params,
707 const struct bnx2x_ets_params *ets_params,
708 const u8 cos_sp_bitmap,
709 const u8 cos_bw_bitmap)
710{
711 struct bnx2x *bp = params->bp;
712 const u8 port = params->port;
713 const u8 nig_cli_sp_bitmap = 0x7 | (cos_sp_bitmap << 3);
714 const u8 pbf_cli_sp_bitmap = cos_sp_bitmap;
715 const u8 nig_cli_subject2wfq_bitmap = cos_bw_bitmap << 3;
716 const u8 pbf_cli_subject2wfq_bitmap = cos_bw_bitmap;
717
718 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CLIENT_IS_STRICT :
719 NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, nig_cli_sp_bitmap);
720
721 REG_WR(bp, (port) ? PBF_REG_ETS_ARB_CLIENT_IS_STRICT_P1 :
722 PBF_REG_ETS_ARB_CLIENT_IS_STRICT_P0 , pbf_cli_sp_bitmap);
723
724 REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_CLIENT_IS_SUBJECT2WFQ :
725 NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ,
726 nig_cli_subject2wfq_bitmap);
727
728 REG_WR(bp, (port) ? PBF_REG_ETS_ARB_CLIENT_IS_SUBJECT2WFQ_P1 :
729 PBF_REG_ETS_ARB_CLIENT_IS_SUBJECT2WFQ_P0,
730 pbf_cli_subject2wfq_bitmap);
731
732 return 0;
733}
734
735/******************************************************************************
736* Description:
737* This function is needed because NIG ARB_CREDIT_WEIGHT_X are
738* not continues and ARB_CREDIT_WEIGHT_0 + offset is suitable.
739******************************************************************************/
740static int bnx2x_ets_e3b0_set_cos_bw(struct bnx2x *bp,
741 const u8 cos_entry,
742 const u32 min_w_val_nig,
743 const u32 min_w_val_pbf,
744 const u16 total_bw,
745 const u8 bw,
746 const u8 port)
747{
748 u32 nig_reg_adress_crd_weight = 0;
749 u32 pbf_reg_adress_crd_weight = 0;
750 /* Calculate and set BW for this COS*/
751 const u32 cos_bw_nig = (bw * min_w_val_nig) / total_bw;
752 const u32 cos_bw_pbf = (bw * min_w_val_pbf) / total_bw;
753
754 switch (cos_entry) {
755 case 0:
756 nig_reg_adress_crd_weight =
757 (port) ? NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_0 :
758 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_0;
759 pbf_reg_adress_crd_weight = (port) ?
760 PBF_REG_COS0_WEIGHT_P1 : PBF_REG_COS0_WEIGHT_P0;
761 break;
762 case 1:
763 nig_reg_adress_crd_weight = (port) ?
764 NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_1 :
765 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_1;
766 pbf_reg_adress_crd_weight = (port) ?
767 PBF_REG_COS1_WEIGHT_P1 : PBF_REG_COS1_WEIGHT_P0;
768 break;
769 case 2:
770 nig_reg_adress_crd_weight = (port) ?
771 NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_2 :
772 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_2;
773
774 pbf_reg_adress_crd_weight = (port) ?
775 PBF_REG_COS2_WEIGHT_P1 : PBF_REG_COS2_WEIGHT_P0;
776 break;
777 case 3:
778 if (port)
779 return -EINVAL;
780 nig_reg_adress_crd_weight =
781 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_3;
782 pbf_reg_adress_crd_weight =
783 PBF_REG_COS3_WEIGHT_P0;
784 break;
785 case 4:
786 if (port)
787 return -EINVAL;
788 nig_reg_adress_crd_weight =
789 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_4;
790 pbf_reg_adress_crd_weight = PBF_REG_COS4_WEIGHT_P0;
791 break;
792 case 5:
793 if (port)
794 return -EINVAL;
795 nig_reg_adress_crd_weight =
796 NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_5;
797 pbf_reg_adress_crd_weight = PBF_REG_COS5_WEIGHT_P0;
798 break;
799 }
800
801 REG_WR(bp, nig_reg_adress_crd_weight, cos_bw_nig);
802
803 REG_WR(bp, pbf_reg_adress_crd_weight, cos_bw_pbf);
804
805 return 0;
806}
807/******************************************************************************
808* Description:
809* Calculate the total BW.A value of 0 isn't legal.
810*.
811******************************************************************************/
812static int bnx2x_ets_e3b0_get_total_bw(
813 const struct link_params *params,
814 const struct bnx2x_ets_params *ets_params,
815 u16 *total_bw)
816{
817 struct bnx2x *bp = params->bp;
818 u8 cos_idx = 0;
819
820 *total_bw = 0 ;
821 /* Calculate total BW requested */
822 for (cos_idx = 0; cos_idx < ets_params->num_of_cos; cos_idx++) {
823 if (bnx2x_cos_state_bw == ets_params->cos[cos_idx].state) {
824
825 if (0 == ets_params->cos[cos_idx].params.bw_params.bw) {
826 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config BW"
827 "was set to 0\n");
828 return -EINVAL;
829 }
830 *total_bw +=
831 ets_params->cos[cos_idx].params.bw_params.bw;
832 }
833 }
834
835 /*Check taotl BW is valid */
836 if ((100 != *total_bw) || (0 == *total_bw)) {
837 if (0 == *total_bw) {
838 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config toatl BW"
839 "shouldn't be 0\n");
840 return -EINVAL;
841 }
842 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config toatl BW should be"
843 "100\n");
844 /**
845 * We can handle a case whre the BW isn't 100 this can happen
846 * if the TC are joined.
847 */
848 }
849 return 0;
850}
851
852/******************************************************************************
853* Description:
854* Invalidate all the sp_pri_to_cos.
855*.
856******************************************************************************/
857static void bnx2x_ets_e3b0_sp_pri_to_cos_init(u8 *sp_pri_to_cos)
858{
859 u8 pri = 0;
860 for (pri = 0; pri < DCBX_MAX_NUM_COS; pri++)
861 sp_pri_to_cos[pri] = DCBX_INVALID_COS;
862}
863/******************************************************************************
864* Description:
865* Calculate and set the SP (ARB_PRIORITY_CLIENT) NIG and PBF registers
866* according to sp_pri_to_cos.
867*.
868******************************************************************************/
869static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params,
870 u8 *sp_pri_to_cos, const u8 pri,
871 const u8 cos_entry)
872{
873 struct bnx2x *bp = params->bp;
874 const u8 port = params->port;
875 const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 :
876 DCBX_E3B0_MAX_NUM_COS_PORT0;
877
878 if (DCBX_INVALID_COS != sp_pri_to_cos[pri]) {
879 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid "
880 "parameter There can't be two COS's with"
881 "the same strict pri\n");
882 return -EINVAL;
883 }
884
885 if (pri > max_num_of_cos) {
886 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid"
887 "parameter Illegal strict priority\n");
888 return -EINVAL;
889 }
890
891 sp_pri_to_cos[pri] = cos_entry;
892 return 0;
893
894}
895
896/******************************************************************************
897* Description:
898* Returns the correct value according to COS and priority in
899* the sp_pri_cli register.
900*.
901******************************************************************************/
902static u64 bnx2x_e3b0_sp_get_pri_cli_reg(const u8 cos, const u8 cos_offset,
903 const u8 pri_set,
904 const u8 pri_offset,
905 const u8 entry_size)
906{
907 u64 pri_cli_nig = 0;
908 pri_cli_nig = ((u64)(cos + cos_offset)) << (entry_size *
909 (pri_set + pri_offset));
910
911 return pri_cli_nig;
912}
913/******************************************************************************
914* Description:
915* Returns the correct value according to COS and priority in the
916* sp_pri_cli register for NIG.
917*.
918******************************************************************************/
919static u64 bnx2x_e3b0_sp_get_pri_cli_reg_nig(const u8 cos, const u8 pri_set)
920{
921 /* MCP Dbg0 and dbg1 are always with higher strict pri*/
922 const u8 nig_cos_offset = 3;
923 const u8 nig_pri_offset = 3;
924
925 return bnx2x_e3b0_sp_get_pri_cli_reg(cos, nig_cos_offset, pri_set,
926 nig_pri_offset, 4);
927
928}
929/******************************************************************************
930* Description:
931* Returns the correct value according to COS and priority in the
932* sp_pri_cli register for PBF.
933*.
934******************************************************************************/
935static u64 bnx2x_e3b0_sp_get_pri_cli_reg_pbf(const u8 cos, const u8 pri_set)
936{
937 const u8 pbf_cos_offset = 0;
938 const u8 pbf_pri_offset = 0;
939
940 return bnx2x_e3b0_sp_get_pri_cli_reg(cos, pbf_cos_offset, pri_set,
941 pbf_pri_offset, 3);
942
943}
944
945/******************************************************************************
946* Description:
947* Calculate and set the SP (ARB_PRIORITY_CLIENT) NIG and PBF registers
948* according to sp_pri_to_cos.(which COS has higher priority)
949*.
950******************************************************************************/
951static int bnx2x_ets_e3b0_sp_set_pri_cli_reg(const struct link_params *params,
952 u8 *sp_pri_to_cos)
953{
954 struct bnx2x *bp = params->bp;
955 u8 i = 0;
956 const u8 port = params->port;
957 /* MCP Dbg0 and dbg1 are always with higher strict pri*/
958 u64 pri_cli_nig = 0x210;
959 u32 pri_cli_pbf = 0x0;
960 u8 pri_set = 0;
961 u8 pri_bitmask = 0;
962 const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 :
963 DCBX_E3B0_MAX_NUM_COS_PORT0;
964
965 u8 cos_bit_to_set = (1 << max_num_of_cos) - 1;
966
967 /* Set all the strict priority first */
968 for (i = 0; i < max_num_of_cos; i++) {
969 if (DCBX_INVALID_COS != sp_pri_to_cos[i]) {
970 if (DCBX_MAX_NUM_COS <= sp_pri_to_cos[i]) {
971 DP(NETIF_MSG_LINK,
972 "bnx2x_ets_e3b0_sp_set_pri_cli_reg "
973 "invalid cos entry\n");
974 return -EINVAL;
975 }
976
977 pri_cli_nig |= bnx2x_e3b0_sp_get_pri_cli_reg_nig(
978 sp_pri_to_cos[i], pri_set);
979
980 pri_cli_pbf |= bnx2x_e3b0_sp_get_pri_cli_reg_pbf(
981 sp_pri_to_cos[i], pri_set);
982 pri_bitmask = 1 << sp_pri_to_cos[i];
983 /* COS is used remove it from bitmap.*/
984 if (0 == (pri_bitmask & cos_bit_to_set)) {
985 DP(NETIF_MSG_LINK,
986 "bnx2x_ets_e3b0_sp_set_pri_cli_reg "
987 "invalid There can't be two COS's with"
988 " the same strict pri\n");
989 return -EINVAL;
990 }
991 cos_bit_to_set &= ~pri_bitmask;
992 pri_set++;
993 }
994 }
995
996 /* Set all the Non strict priority i= COS*/
997 for (i = 0; i < max_num_of_cos; i++) {
998 pri_bitmask = 1 << i;
999 /* Check if COS was already used for SP */
1000 if (pri_bitmask & cos_bit_to_set) {
1001 /* COS wasn't used for SP */
1002 pri_cli_nig |= bnx2x_e3b0_sp_get_pri_cli_reg_nig(
1003 i, pri_set);
1004
1005 pri_cli_pbf |= bnx2x_e3b0_sp_get_pri_cli_reg_pbf(
1006 i, pri_set);
1007 /* COS is used remove it from bitmap.*/
1008 cos_bit_to_set &= ~pri_bitmask;
1009 pri_set++;
1010 }
1011 }
1012
1013 if (pri_set != max_num_of_cos) {
1014 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_set_pri_cli_reg not all "
1015 "entries were set\n");
1016 return -EINVAL;
1017 }
1018
1019 if (port) {
1020 /* Only 6 usable clients*/
1021 REG_WR(bp, NIG_REG_P1_TX_ARB_PRIORITY_CLIENT2_LSB,
1022 (u32)pri_cli_nig);
1023
1024 REG_WR(bp, PBF_REG_ETS_ARB_PRIORITY_CLIENT_P1 , pri_cli_pbf);
1025 } else {
1026 /* Only 9 usable clients*/
1027 const u32 pri_cli_nig_lsb = (u32) (pri_cli_nig);
1028 const u32 pri_cli_nig_msb = (u32) ((pri_cli_nig >> 32) & 0xF);
1029
1030 REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_LSB,
1031 pri_cli_nig_lsb);
1032 REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_MSB,
1033 pri_cli_nig_msb);
1034
1035 REG_WR(bp, PBF_REG_ETS_ARB_PRIORITY_CLIENT_P0 , pri_cli_pbf);
1036 }
1037 return 0;
1038}
1039
1040/******************************************************************************
1041* Description:
1042* Configure the COS to ETS according to BW and SP settings.
1043******************************************************************************/
1044int bnx2x_ets_e3b0_config(const struct link_params *params,
1045 const struct link_vars *vars,
1046 const struct bnx2x_ets_params *ets_params)
1047{
1048 struct bnx2x *bp = params->bp;
1049 int bnx2x_status = 0;
1050 const u8 port = params->port;
1051 u16 total_bw = 0;
1052 const u32 min_w_val_nig = bnx2x_ets_get_min_w_val_nig(vars);
1053 const u32 min_w_val_pbf = ETS_E3B0_PBF_MIN_W_VAL;
1054 u8 cos_bw_bitmap = 0;
1055 u8 cos_sp_bitmap = 0;
1056 u8 sp_pri_to_cos[DCBX_MAX_NUM_COS] = {0};
1057 const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 :
1058 DCBX_E3B0_MAX_NUM_COS_PORT0;
1059 u8 cos_entry = 0;
1060
1061 if (!CHIP_IS_E3B0(bp)) {
1062 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_disabled the chip isn't E3B0"
1063 "\n");
1064 return -EINVAL;
1065 }
1066
1067 if ((ets_params->num_of_cos > max_num_of_cos)) {
1068 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config the number of COS "
1069 "isn't supported\n");
1070 return -EINVAL;
1071 }
1072
1073 /* Prepare sp strict priority parameters*/
1074 bnx2x_ets_e3b0_sp_pri_to_cos_init(sp_pri_to_cos);
1075
1076 /* Prepare BW parameters*/
1077 bnx2x_status = bnx2x_ets_e3b0_get_total_bw(params, ets_params,
1078 &total_bw);
1079 if (0 != bnx2x_status) {
1080 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config get_total_bw failed "
1081 "\n");
1082 return -EINVAL;
1083 }
1084
1085 /**
1086 * Upper bound is set according to current link speed (min_w_val
1087 * should be the same for upper bound and COS credit val).
1088 */
1089 bnx2x_ets_e3b0_set_credit_upper_bound_nig(params, min_w_val_nig);
1090 bnx2x_ets_e3b0_set_credit_upper_bound_pbf(params, min_w_val_pbf);
1091
1092
1093 for (cos_entry = 0; cos_entry < ets_params->num_of_cos; cos_entry++) {
1094 if (bnx2x_cos_state_bw == ets_params->cos[cos_entry].state) {
1095 cos_bw_bitmap |= (1 << cos_entry);
1096 /**
1097 * The function also sets the BW in HW(not the mappin
1098 * yet)
1099 */
1100 bnx2x_status = bnx2x_ets_e3b0_set_cos_bw(
1101 bp, cos_entry, min_w_val_nig, min_w_val_pbf,
1102 total_bw,
1103 ets_params->cos[cos_entry].params.bw_params.bw,
1104 port);
1105 } else if (bnx2x_cos_state_strict ==
1106 ets_params->cos[cos_entry].state){
1107 cos_sp_bitmap |= (1 << cos_entry);
1108
1109 bnx2x_status = bnx2x_ets_e3b0_sp_pri_to_cos_set(
1110 params,
1111 sp_pri_to_cos,
1112 ets_params->cos[cos_entry].params.sp_params.pri,
1113 cos_entry);
1114
1115 } else {
1116 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_config cos state not"
1117 " valid\n");
1118 return -EINVAL;
1119 }
1120 if (0 != bnx2x_status) {
1121 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_config set cos bw "
1122 "failed\n");
1123 return bnx2x_status;
1124 }
1125 }
1126
1127 /* Set SP register (which COS has higher priority) */
1128 bnx2x_status = bnx2x_ets_e3b0_sp_set_pri_cli_reg(params,
1129 sp_pri_to_cos);
1130
1131 if (0 != bnx2x_status) {
1132 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config set_pri_cli_reg "
1133 "failed\n");
1134 return bnx2x_status;
1135 }
1136
1137 /* Set client mapping of BW and strict */
1138 bnx2x_status = bnx2x_ets_e3b0_cli_map(params, ets_params,
1139 cos_sp_bitmap,
1140 cos_bw_bitmap);
1141
1142 if (0 != bnx2x_status) {
1143 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config SP failed\n");
1144 return bnx2x_status;
1145 }
1146 return 0;
1147}
399static void bnx2x_ets_bw_limit_common(const struct link_params *params) 1148static void bnx2x_ets_bw_limit_common(const struct link_params *params)
400{ 1149{
401 /* ETS disabled configuration */ 1150 /* ETS disabled configuration */
diff --git a/drivers/net/bnx2x/bnx2x_link.h b/drivers/net/bnx2x/bnx2x_link.h
index 82bc021bdf07..3d9c46bb108c 100644
--- a/drivers/net/bnx2x/bnx2x_link.h
+++ b/drivers/net/bnx2x/bnx2x_link.h
@@ -411,6 +411,38 @@ struct bnx2x_nig_brb_pfc_port_params {
411 u32 cos1_pauseable; 411 u32 cos1_pauseable;
412}; 412};
413 413
414
415/* ETS port configuration params */
416struct bnx2x_ets_bw_params {
417 u8 bw;
418};
419
420struct bnx2x_ets_sp_params {
421 /**
422 * valid values are 0 - 5. 0 is highest strict priority.
423 * There can't be two COS's with the same pri.
424 */
425 u8 pri;
426};
427
428enum bnx2x_cos_state {
429 bnx2x_cos_state_strict = 0,
430 bnx2x_cos_state_bw = 1,
431};
432
433struct bnx2x_ets_cos_params {
434 enum bnx2x_cos_state state ;
435 union {
436 struct bnx2x_ets_bw_params bw_params;
437 struct bnx2x_ets_sp_params sp_params;
438 } params;
439};
440
441struct bnx2x_ets_params {
442 u8 num_of_cos; /* Number of valid COS entries*/
443 struct bnx2x_ets_cos_params cos[DCBX_MAX_NUM_COS];
444};
445
414/** 446/**
415 * Used to update the PFC attributes in EMAC, BMAC, NIG and BRB 447 * Used to update the PFC attributes in EMAC, BMAC, NIG and BRB
416 * when link is already up 448 * when link is already up
@@ -421,7 +453,8 @@ int bnx2x_update_pfc(struct link_params *params,
421 453
422 454
423/* Used to configure the ETS to disable */ 455/* Used to configure the ETS to disable */
424void bnx2x_ets_disabled(struct link_params *params); 456int bnx2x_ets_disabled(struct link_params *params,
457 struct link_vars *vars);
425 458
426/* Used to configure the ETS to BW limited */ 459/* Used to configure the ETS to BW limited */
427void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw, 460void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw,
@@ -430,6 +463,11 @@ void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw,
430/* Used to configure the ETS to strict */ 463/* Used to configure the ETS to strict */
431int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos); 464int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos);
432 465
466
467/* Configure the COS to ETS according to BW and SP settings.*/
468int bnx2x_ets_e3b0_config(const struct link_params *params,
469 const struct link_vars *vars,
470 const struct bnx2x_ets_params *ets_params);
433/* Read pfc statistic*/ 471/* Read pfc statistic*/
434void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars, 472void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars,
435 u32 pfc_frames_sent[2], 473 u32 pfc_frames_sent[2],
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h
index bf43b9b16d8b..d0cf072d21eb 100644
--- a/drivers/net/bnx2x/bnx2x_reg.h
+++ b/drivers/net/bnx2x/bnx2x_reg.h
@@ -2057,6 +2057,26 @@
2057 * clients that are not subject to WFQ credit blocking - their 2057 * clients that are not subject to WFQ credit blocking - their
2058 * specifications here are not used. */ 2058 * specifications here are not used. */
2059#define NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP 0x180f0 2059#define NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP 0x180f0
2060/* [RW 32] Specify which of the credit registers the client is to be mapped
2061 * to. This register specifies bits 31:0 of the 36-bit value. Bits[3:0] are
2062 * for client 0; bits [35:32] are for client 8. For clients that are not
2063 * subject to WFQ credit blocking - their specifications here are not used.
2064 * This is a new register (with 2_) added in E3 B0 to accommodate the 9
2065 * input clients to ETS arbiter. The reset default is set for management and
2066 * debug to use credit registers 6, 7, and 8, respectively, and COSes 0-5 to
2067 * use credit registers 0-5 respectively (0x543210876). Note that credit
2068 * registers can not be shared between clients. */
2069#define NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP2_LSB 0x18688
2070/* [RW 4] Specify which of the credit registers the client is to be mapped
2071 * to. This register specifies bits 35:32 of the 36-bit value. Bits[3:0] are
2072 * for client 0; bits [35:32] are for client 8. For clients that are not
2073 * subject to WFQ credit blocking - their specifications here are not used.
2074 * This is a new register (with 2_) added in E3 B0 to accommodate the 9
2075 * input clients to ETS arbiter. The reset default is set for management and
2076 * debug to use credit registers 6, 7, and 8, respectively, and COSes 0-5 to
2077 * use credit registers 0-5 respectively (0x543210876). Note that credit
2078 * registers can not be shared between clients. */
2079#define NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP2_MSB 0x1868c
2060/* [RW 5] Specify whether the client competes directly in the strict 2080/* [RW 5] Specify whether the client competes directly in the strict
2061 * priority arbiter. The bits are mapped according to client ID (client IDs 2081 * priority arbiter. The bits are mapped according to client ID (client IDs
2062 * are defined in tx_arb_priority_client). Default value is set to enable 2082 * are defined in tx_arb_priority_client). Default value is set to enable
@@ -2071,10 +2091,24 @@
2071 * reach. */ 2091 * reach. */
2072#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0 0x1810c 2092#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0 0x1810c
2073#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_1 0x18110 2093#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_1 0x18110
2094#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_2 0x18114
2095#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_3 0x18118
2096#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_4 0x1811c
2097#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_5 0x186a0
2098#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_6 0x186a4
2099#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_7 0x186a8
2100#define NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_8 0x186ac
2074/* [RW 32] Specify the weight (in bytes) to be added to credit register 0 2101/* [RW 32] Specify the weight (in bytes) to be added to credit register 0
2075 * when it is time to increment. */ 2102 * when it is time to increment. */
2076#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_0 0x180f8 2103#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_0 0x180f8
2077#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_1 0x180fc 2104#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_1 0x180fc
2105#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_2 0x18100
2106#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_3 0x18104
2107#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_4 0x18108
2108#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_5 0x18690
2109#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_6 0x18694
2110#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_7 0x18698
2111#define NIG_REG_P0_TX_ARB_CREDIT_WEIGHT_8 0x1869c
2078/* [RW 12] Specify the number of strict priority arbitration slots between 2112/* [RW 12] Specify the number of strict priority arbitration slots between
2079 * two round-robin arbitration slots to avoid starvation. A value of 0 means 2113 * two round-robin arbitration slots to avoid starvation. A value of 0 means
2080 * no strict priority cycles - the strict priority with anti-starvation 2114 * no strict priority cycles - the strict priority with anti-starvation
@@ -2094,6 +2128,26 @@
2094#define NIG_REG_P1_HDRS_AFTER_BASIC 0x1818c 2128#define NIG_REG_P1_HDRS_AFTER_BASIC 0x1818c
2095#define NIG_REG_P1_LLH_FUNC_MEM2 0x184c0 2129#define NIG_REG_P1_LLH_FUNC_MEM2 0x184c0
2096#define NIG_REG_P1_LLH_FUNC_MEM2_ENABLE 0x18460 2130#define NIG_REG_P1_LLH_FUNC_MEM2_ENABLE 0x18460
2131/* [RW 32] Specify the client number to be assigned to each priority of the
2132 * strict priority arbiter. This register specifies bits 31:0 of the 36-bit
2133 * value. Priority 0 is the highest priority. Bits [3:0] are for priority 0
2134 * client; bits [35-32] are for priority 8 client. The clients are assigned
2135 * the following IDs: 0-management; 1-debug traffic from this port; 2-debug
2136 * traffic from other port; 3-COS0 traffic; 4-COS1 traffic; 5-COS2 traffic;
2137 * 6-COS3 traffic; 7-COS4 traffic; 8-COS5 traffic. The reset value[35:0] is
2138 * set to 0x345678021. This is a new register (with 2_) added in E3 B0 to
2139 * accommodate the 9 input clients to ETS arbiter. */
2140#define NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_LSB 0x18680
2141/* [RW 4] Specify the client number to be assigned to each priority of the
2142 * strict priority arbiter. This register specifies bits 35:32 of the 36-bit
2143 * value. Priority 0 is the highest priority. Bits [3:0] are for priority 0
2144 * client; bits [35-32] are for priority 8 client. The clients are assigned
2145 * the following IDs: 0-management; 1-debug traffic from this port; 2-debug
2146 * traffic from other port; 3-COS0 traffic; 4-COS1 traffic; 5-COS2 traffic;
2147 * 6-COS3 traffic; 7-COS4 traffic; 8-COS5 traffic. The reset value[35:0] is
2148 * set to 0x345678021. This is a new register (with 2_) added in E3 B0 to
2149 * accommodate the 9 input clients to ETS arbiter. */
2150#define NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_MSB 0x18684
2097#define NIG_REG_P1_MAC_IN_EN 0x185c0 2151#define NIG_REG_P1_MAC_IN_EN 0x185c0
2098/* [RW 1] Output enable for TX MAC interface */ 2152/* [RW 1] Output enable for TX MAC interface */
2099#define NIG_REG_P1_MAC_OUT_EN 0x185c4 2153#define NIG_REG_P1_MAC_OUT_EN 0x185c4
@@ -2164,6 +2218,54 @@
2164 * traffic; 6-COS3 traffic; 7-COS4 traffic; 8-COS5 traffic. Default value is 2218 * traffic; 6-COS3 traffic; 7-COS4 traffic; 8-COS5 traffic. Default value is
2165 * 0 for not using WFQ credit blocking. */ 2219 * 0 for not using WFQ credit blocking. */
2166#define NIG_REG_P1_TX_ARB_CLIENT_IS_SUBJECT2WFQ 0x18238 2220#define NIG_REG_P1_TX_ARB_CLIENT_IS_SUBJECT2WFQ 0x18238
2221#define NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_0 0x18258
2222#define NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_1 0x1825c
2223#define NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_2 0x18260
2224#define NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_3 0x18264
2225#define NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_4 0x18268
2226#define NIG_REG_P1_TX_ARB_CREDIT_UPPER_BOUND_5 0x186f4
2227/* [RW 32] Specify the weight (in bytes) to be added to credit register 0
2228 * when it is time to increment. */
2229#define NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_0 0x18244
2230#define NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_1 0x18248
2231#define NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_2 0x1824c
2232#define NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_3 0x18250
2233#define NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_4 0x18254
2234#define NIG_REG_P1_TX_ARB_CREDIT_WEIGHT_5 0x186f0
2235/* [RW 12] Specify the number of strict priority arbitration slots between
2236 two round-robin arbitration slots to avoid starvation. A value of 0 means
2237 no strict priority cycles - the strict priority with anti-starvation
2238 arbiter becomes a round-robin arbiter. */
2239#define NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS 0x18240
2240/* [RW 32] Specify the client number to be assigned to each priority of the
2241 strict priority arbiter. This register specifies bits 31:0 of the 36-bit
2242 value. Priority 0 is the highest priority. Bits [3:0] are for priority 0
2243 client; bits [35-32] are for priority 8 client. The clients are assigned
2244 the following IDs: 0-management; 1-debug traffic from this port; 2-debug
2245 traffic from other port; 3-COS0 traffic; 4-COS1 traffic; 5-COS2 traffic;
2246 6-COS3 traffic; 7-COS4 traffic; 8-COS5 traffic. The reset value[35:0] is
2247 set to 0x345678021. This is a new register (with 2_) added in E3 B0 to
2248 accommodate the 9 input clients to ETS arbiter. Note that this register
2249 is the same as the one for port 0, except that port 1 only has COS 0-2
2250 traffic. There is no traffic for COS 3-5 of port 1. */
2251#define NIG_REG_P1_TX_ARB_PRIORITY_CLIENT2_LSB 0x186e0
2252/* [RW 4] Specify the client number to be assigned to each priority of the
2253 strict priority arbiter. This register specifies bits 35:32 of the 36-bit
2254 value. Priority 0 is the highest priority. Bits [3:0] are for priority 0
2255 client; bits [35-32] are for priority 8 client. The clients are assigned
2256 the following IDs: 0-management; 1-debug traffic from this port; 2-debug
2257 traffic from other port; 3-COS0 traffic; 4-COS1 traffic; 5-COS2 traffic;
2258 6-COS3 traffic; 7-COS4 traffic; 8-COS5 traffic. The reset value[35:0] is
2259 set to 0x345678021. This is a new register (with 2_) added in E3 B0 to
2260 accommodate the 9 input clients to ETS arbiter. Note that this register
2261 is the same as the one for port 0, except that port 1 only has COS 0-2
2262 traffic. There is no traffic for COS 3-5 of port 1. */
2263#define NIG_REG_P1_TX_ARB_PRIORITY_CLIENT2_MSB 0x186e4
2264/* [R 1] TX FIFO for transmitting data to MAC is empty. */
2265#define NIG_REG_P1_TX_MACFIFO_EMPTY 0x18594
2266/* [R 1] FIFO empty status of the MCP TX FIFO used for storing MCP packets
2267 forwarded to the host. */
2268#define NIG_REG_P1_TX_MNG_HOST_FIFO_EMPTY 0x182b8
2167/* [RW 32] Specify the upper bound that credit register 0 is allowed to 2269/* [RW 32] Specify the upper bound that credit register 0 is allowed to
2168 * reach. */ 2270 * reach. */
2169/* [RW 1] Pause enable for port0. This register may get 1 only when 2271/* [RW 1] Pause enable for port0. This register may get 1 only when
@@ -2249,12 +2351,36 @@
2249#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK_STATUS_SIZE 18 2351#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK_STATUS_SIZE 18
2250/* [RW 31] The upper bound of the weight of COS0 in the ETS command arbiter. */ 2352/* [RW 31] The upper bound of the weight of COS0 in the ETS command arbiter. */
2251#define PBF_REG_COS0_UPPER_BOUND 0x15c05c 2353#define PBF_REG_COS0_UPPER_BOUND 0x15c05c
2354/* [RW 31] The upper bound of the weight of COS0 in the ETS command arbiter
2355 * of port 0. */
2356#define PBF_REG_COS0_UPPER_BOUND_P0 0x15c2cc
2357/* [RW 31] The upper bound of the weight of COS0 in the ETS command arbiter
2358 * of port 1. */
2359#define PBF_REG_COS0_UPPER_BOUND_P1 0x15c2e4
2252/* [RW 31] The weight of COS0 in the ETS command arbiter. */ 2360/* [RW 31] The weight of COS0 in the ETS command arbiter. */
2253#define PBF_REG_COS0_WEIGHT 0x15c054 2361#define PBF_REG_COS0_WEIGHT 0x15c054
2362/* [RW 31] The weight of COS0 in port 0 ETS command arbiter. */
2363#define PBF_REG_COS0_WEIGHT_P0 0x15c2a8
2364/* [RW 31] The weight of COS0 in port 1 ETS command arbiter. */
2365#define PBF_REG_COS0_WEIGHT_P1 0x15c2c0
2254/* [RW 31] The upper bound of the weight of COS1 in the ETS command arbiter. */ 2366/* [RW 31] The upper bound of the weight of COS1 in the ETS command arbiter. */
2255#define PBF_REG_COS1_UPPER_BOUND 0x15c060 2367#define PBF_REG_COS1_UPPER_BOUND 0x15c060
2256/* [RW 31] The weight of COS1 in the ETS command arbiter. */ 2368/* [RW 31] The weight of COS1 in the ETS command arbiter. */
2257#define PBF_REG_COS1_WEIGHT 0x15c058 2369#define PBF_REG_COS1_WEIGHT 0x15c058
2370/* [RW 31] The weight of COS1 in port 0 ETS command arbiter. */
2371#define PBF_REG_COS1_WEIGHT_P0 0x15c2ac
2372/* [RW 31] The weight of COS1 in port 1 ETS command arbiter. */
2373#define PBF_REG_COS1_WEIGHT_P1 0x15c2c4
2374/* [RW 31] The weight of COS2 in port 0 ETS command arbiter. */
2375#define PBF_REG_COS2_WEIGHT_P0 0x15c2b0
2376/* [RW 31] The weight of COS2 in port 1 ETS command arbiter. */
2377#define PBF_REG_COS2_WEIGHT_P1 0x15c2c8
2378/* [RW 31] The weight of COS3 in port 0 ETS command arbiter. */
2379#define PBF_REG_COS3_WEIGHT_P0 0x15c2b4
2380/* [RW 31] The weight of COS4 in port 0 ETS command arbiter. */
2381#define PBF_REG_COS4_WEIGHT_P0 0x15c2b8
2382/* [RW 31] The weight of COS5 in port 0 ETS command arbiter. */
2383#define PBF_REG_COS5_WEIGHT_P0 0x15c2bc
2258/* [R 11] Current credit for the LB queue in the tx port buffers in 16 byte 2384/* [R 11] Current credit for the LB queue in the tx port buffers in 16 byte
2259 * lines. */ 2385 * lines. */
2260#define PBF_REG_CREDIT_LB_Q 0x140338 2386#define PBF_REG_CREDIT_LB_Q 0x140338
@@ -2274,6 +2400,52 @@
2274 current task in process). */ 2400 current task in process). */
2275#define PBF_REG_DISABLE_NEW_TASK_PROC_P4 0x14006c 2401#define PBF_REG_DISABLE_NEW_TASK_PROC_P4 0x14006c
2276#define PBF_REG_DISABLE_PF 0x1402e8 2402#define PBF_REG_DISABLE_PF 0x1402e8
2403/* [RW 18] For port 0: For each client that is subject to WFQ (the
2404 * corresponding bit is 1); indicates to which of the credit registers this
2405 * client is mapped. For clients which are not credit blocked; their mapping
2406 * is dont care. */
2407#define PBF_REG_ETS_ARB_CLIENT_CREDIT_MAP_P0 0x15c288
2408/* [RW 9] For port 1: For each client that is subject to WFQ (the
2409 * corresponding bit is 1); indicates to which of the credit registers this
2410 * client is mapped. For clients which are not credit blocked; their mapping
2411 * is dont care. */
2412#define PBF_REG_ETS_ARB_CLIENT_CREDIT_MAP_P1 0x15c28c
2413/* [RW 6] For port 0: Bit per client to indicate if the client competes in
2414 * the strict priority arbiter directly (corresponding bit = 1); or first
2415 * goes to the RR arbiter (corresponding bit = 0); and then competes in the
2416 * lowest priority in the strict-priority arbiter. */
2417#define PBF_REG_ETS_ARB_CLIENT_IS_STRICT_P0 0x15c278
2418/* [RW 3] For port 1: Bit per client to indicate if the client competes in
2419 * the strict priority arbiter directly (corresponding bit = 1); or first
2420 * goes to the RR arbiter (corresponding bit = 0); and then competes in the
2421 * lowest priority in the strict-priority arbiter. */
2422#define PBF_REG_ETS_ARB_CLIENT_IS_STRICT_P1 0x15c27c
2423/* [RW 6] For port 0: Bit per client to indicate if the client is subject to
2424 * WFQ credit blocking (corresponding bit = 1). */
2425#define PBF_REG_ETS_ARB_CLIENT_IS_SUBJECT2WFQ_P0 0x15c280
2426/* [RW 3] For port 0: Bit per client to indicate if the client is subject to
2427 * WFQ credit blocking (corresponding bit = 1). */
2428#define PBF_REG_ETS_ARB_CLIENT_IS_SUBJECT2WFQ_P1 0x15c284
2429/* [RW 16] For port 0: The number of strict priority arbitration slots
2430 * between 2 RR arbitration slots. A value of 0 means no strict priority
2431 * cycles; i.e. the strict-priority w/ anti-starvation arbiter is a RR
2432 * arbiter. */
2433#define PBF_REG_ETS_ARB_NUM_STRICT_ARB_SLOTS_P0 0x15c2a0
2434/* [RW 16] For port 1: The number of strict priority arbitration slots
2435 * between 2 RR arbitration slots. A value of 0 means no strict priority
2436 * cycles; i.e. the strict-priority w/ anti-starvation arbiter is a RR
2437 * arbiter. */
2438#define PBF_REG_ETS_ARB_NUM_STRICT_ARB_SLOTS_P1 0x15c2a4
2439/* [RW 18] For port 0: Indicates which client is connected to each priority
2440 * in the strict-priority arbiter. Priority 0 is the highest priority, and
2441 * priority 5 is the lowest; to which the RR output is connected to (this is
2442 * not configurable). */
2443#define PBF_REG_ETS_ARB_PRIORITY_CLIENT_P0 0x15c270
2444/* [RW 9] For port 1: Indicates which client is connected to each priority
2445 * in the strict-priority arbiter. Priority 0 is the highest priority, and
2446 * priority 5 is the lowest; to which the RR output is connected to (this is
2447 * not configurable). */
2448#define PBF_REG_ETS_ARB_PRIORITY_CLIENT_P1 0x15c274
2277/* [RW 1] Indicates that ETS is performed between the COSes in the command 2449/* [RW 1] Indicates that ETS is performed between the COSes in the command
2278 * arbiter. If reset strict priority w/ anti-starvation will be performed 2450 * arbiter. If reset strict priority w/ anti-starvation will be performed
2279 * w/o WFQ. */ 2451 * w/o WFQ. */