Hi Sasha,

Right, I forgot to include here additional info about IB Spec.
Current CC annex version has many problems. Attached file
is the right format of CC MADs (tables 508, 509, 511 - 517,
519, 520).
Except for the slid <-> dlid typo, all the comments refer
to MADs format. I'll repost a patch with this fix.

-- Yevgeny


Sasha Khapyorsky wrote:
Hi Yevgeny,

On 09:53 Mon 30 Jun     , Yevgeny Kliteynik wrote:
@@ -7126,6 +7250,19 @@ typedef struct _ib_mad_notice_attr       // Total Size 
calc  Accumulated
                        uint8_t details[54];
                } PACK_SUFFIX raw_data;

+               struct _ntc_0 {                 // CC_Key violation [54 bytes]
+                       ib_net16_t source_lid;  // Source LID from offending 
packet LRH
+                       uint8_t method;         // Method, from common MAD 
header
+                       uint8_t resv0;
+                       ib_net16_t attr_id;     // Attribute ID, from common 
MAD header
+                       ib_net16_t resv1;
+                       ib_net32_t attr_mod;    // Attribute Modif, from common 
MAD header
+                       ib_net32_t qp;          // 8b pad, 24b dest QP from BTH

Looked at the spec (1.2.1). Should not here be:

        ib_net16_t attr_id;
        ib_net32_t attr_mode;
        ib_net32_t qp;

?

+                       ib_net64_t cc_key;      // CC key of the offending 
packet
+                       ib_gid_t source_gid;    // GID from GRH of the 
offending packet
+                       uint8_t padding[14];    // Padding - ignored on read

And
        uint8_t padding[24];
        
here?

+               } PACK_SUFFIX ntc_0;
+
                struct _ntc_64_67 {
                        uint8_t res[6];
                        ib_gid_t gid;   // the Node or Multicast Group that 
came in/out

[snip...]

+/****s* IBA Base: Types/ib_cong_info_t
+* NAME
+*      ib_cong_info_t
+*
+* DESCRIPTION
+*      IBA defined CongestionInfo attribute (A10.4.3.3)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_info {
+       uint8_t cong_info;
+       uint8_t resv;

It is probably better to make it

        ib_net16_t cong_info;

, so we will not need to rework later. Bits values we can define in
network byte order.

+       uint8_t ctrl_table_cap;
+} PACK_SUFFIX ib_cong_info_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      cong_info
+*              Congestion control capabilities of the node.
+*
+*      ctrl_table_cap
+*              Number of 64 entry blocks in the CongestionControlTable.
+*
+* SEE ALSO
+*      ib_cc_mad_t
+*********/

[snip...]

+/****s* IBA Base: Types/ib_cong_log_event_sw_t
+* NAME
+*      ib_cong_log_event_sw_t
+*
+* DESCRIPTION
+*      IBA defined CongestionLogEvent (SW) entry (A10.4.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_log_event_sw {
+       ib_net16_t slid;
+       ib_net16_t dlid;
+       uint8_t resv0_sl;
+       uint8_t resv1;
+       ib_net16_t resv2;
+       ib_net32_t time_stamp;
+} PACK_SUFFIX ib_cong_log_event_sw_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      slid
+*              Source LID of congestion event.
+*
+*      slid
        ^^^^

typo - 'dlid'.

+*              Destination LID of congestion event.
+*
+*      sl
+*              bits [3:0] SL of congestion event.
+*              bits [7:4] reserved.
+*
+*      time_stamp
+*              Timestamp of congestion event.
+*
+* SEE ALSO
+*      ib_cc_mad_t, ib_cong_log_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_log_event_ca_t
+* NAME
+*      ib_cong_log_event_ca_t
+*
+* DESCRIPTION
+*      IBA defined CongestionLogEvent (CA) entry (A10.4.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_log_event_ca {
+       ib_net32_t resv0_local_qp;
+       ib_net32_t remote_qp_sl_service_type;
+       ib_net16_t remote_lid;
+       ib_net16_t resv1;
+       ib_net32_t time_stamp;
+} PACK_SUFFIX ib_cong_log_event_ca_t;
+#include <complib/cl_packoff.h>

Does it implement table 514?

+/*
+* FIELDS
+*      resv0_local_qp
+*              bits [23:0] local QP that reached CN threshold.
+*              bits [31:24] reserved.
+*
+*      remote_qp_sl_service_type
+*              bits [23:0] remote QP that is connected to local QP.
+*              bits [27:24] SL of the local QP.
+*              bits [31:28] Service Type of the local QP.
+*
+*      remote_lid
+*              LID of the remote port that is connected to local QP.
+*
+*      time_stamp
+*              Timestamp when threshold reached.
+*
+* SEE ALSO
+*      ib_cc_mad_t, ib_cong_log_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_log_t
+* NAME
+*      ib_cong_log_t
+*
+* DESCRIPTION
+*      IBA defined CongestionLog attribute (A10.4.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_log {
+       uint8_t log_type;
+       union _log_details
+       {
+               struct _log_sw {
+                       uint8_t cong_flags;
+                       ib_net16_t event_counter;
+                       ib_net32_t time_stamp;
+                       uint8_t port_map[32];
+                       ib_cong_log_event_sw_t entry_list[15];
+               } PACK_SUFFIX log_sw;
+
+               struct _log_ca {
+                       uint8_t cong_flags;
+                       ib_net16_t event_counter;
+                       ib_net16_t event_map;
+                       ib_net16_t resv;
+                       ib_net32_t time_stamp;

In the spec I see:

        ib_net16_t event_map;
        ib_net16_t time_stamp;

+                       ib_cong_log_event_ca_t log_event[13];
+               } PACK_SUFFIX log_ca;
+
+       } log_details;
+} PACK_SUFFIX ib_cong_log_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*      log_{sw,ca}.log_type
+*              Log type: 0x1 is for Switch, 0x2 is for CA
+*
+*      log_{sw,ca}.cong_flags
+*              Congestion Flags.
+*
+*      log_{sw,ca}.event_counter
+*              Number of events since log last sent.
+*
+*      log_{sw,ca}.time_stamp
+*              Timestamp when log sent.
+*
+*      log_sw.port_map
+*              If a bit set to 1, then the corresponding port
+*              has marked packets with a FECN.
+*              bits 0 and 255 - reserved
+*              bits [254..1] - ports [254..1].
+*
+*      log_sw.entry_list
+*              Array of 13 most recent congestion log events.
+*
+*      log_ca.event_map
+*              array 16 bits, one for each SL.
+*
+*      log_ca.log_event
+*              Array of 13 most recent congestion log events.
+*
+* SEE ALSO
+*      ib_cc_mad_t, ib_cong_log_event_sw_t, ib_cong_log_event_ca_t
+*********/
+
+/****s* IBA Base: Types/ib_sw_cong_setting_t
+* NAME
+*      ib_sw_cong_setting_t
+*
+* DESCRIPTION
+*      IBA defined SwitchCongestionSetting attribute (A10.4.3.6)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_sw_cong_setting {
+       ib_net32_t control_map;
+       uint8_t victim_mask[32];
+       uint8_t credit_mask[32];
+       uint8_t threshold;
+       uint8_t packet_size;
+       uint8_t cs_threshold;
+       uint8_t resv0;

I don't see this resv0 byte in the spec.

+       ib_net16_t cs_return_delay;
+       ib_net16_t marking_rate;
+} PACK_SUFFIX ib_sw_cong_setting_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*      control_map
+*              Indicates which components of this attribute are valid
+*
+*      victim_mask
+*              If the bit set to 1, then the port corresponding to
+*              that bit shall mark packets that encounter congestion
+*              with a FECN, whether they are the source or victim
+*              of congestion. (See A10.2.1.1.1)
+*                bit 0: port 0 (enhanced port 0 only)
+*                bits [254..1]: ports [254..1]
+*                bit 255: reserved
+*
+*      credit_mask
+*              If the bit set to 1, then the port corresponding
+*              to that bit shall apply Credit Starvation.
+*                bit 0: port 0 (enhanced port 0 only)
+*                bits [254..1]: ports [254..1]
+*                bit 255: reserved
+*
+*      threshold
+*              bits [3..0] Indicates how agressive cong. marking should be
+*              bits [7..4] Reserved
+*
+*      packet_size
+*              Any packet less than this size won't be marked with FECN
+*
+*      cs_threshold
+*              bits [3..0] How agressive Credit Starvation should be
+*              bits [7..4] Reserved
+*
+*      cs_return_delay
+*              Value that controls credit return rate.
+*
+*      marking_rate
+*              The value that provides the mean number of packets
+*              between marking eligible packets with FECN.
+*
+* SEE ALSO
+*      ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_sw_port_cong_setting_element_t
+* NAME
+*      ib_sw_port_cong_setting_element_t
+*
+* DESCRIPTION
+*      IBA defined SwitchPortCongestionSettingElement (A10.4.3.7)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_sw_port_cong_setting_element {
+       uint8_t valid_ctrl_type_res_threshold;
+       uint8_t packet_size;
+       ib_net16_t cong_param;

packet_size and cong_param is a same 16-bit field in the spec.

+} PACK_SUFFIX ib_sw_port_cong_setting_element_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*      valid_ctrl_type_res_threshold
+*              bit 0: "Valid"
+*                      when set to 1, indicates this switch
+*                      port congestion setting element is valid.
+*              bit 1: "Control Type"
+*                      Indicates which type of attribute is being set:
+*                      0b = Congestion Control parameters are being set.
+*                      1b = Credit Starvation parameters are being set.
+*              bits [3..2]: reserved
+*              bits [7..4]: "Threshold"
+*                      When Control Type is 0, contains the congestion
+*                      threshold value (Threshold) for this port.
+*                      When Control Type is 1, contains the credit
+*                      starvation threshold (CS_Threshold) value for
+*                      this port.
+*
+*      packet_size
+*              When Control Type is 0, this field contains the minimum
+*              size of packets that may be marked with a FECN.
+*              When Control Type is 1, this field is reserved.
+*
+*      cong_parm
+*              When Control Type is 0, this field contains the port
+*              marking_rate.
+*              When Control Type is 1, this field is reserved.
+*
+* SEE ALSO
+*      ib_cc_mad_t, ib_sw_port_cong_setting_t
+*********/
+
+/****d* IBA Base: Types/ib_sw_port_cong_setting_block_t
+* NAME
+*      ib_sw_port_cong_setting_block_t
+*
+* DESCRIPTION
+*      Defines the SwitchPortCongestionSetting Block (A10.4.3.7).
+*
+* SOURCE
+*/
+typedef ib_sw_port_cong_setting_element_t ib_sw_port_cong_setting_block_t[32];

In the spec I see that it should be 64 24-bit elements here.

Are we using the same spec?

Sasha


table 508 - notice details:
  slid             16
  method            8
  reserved          8
  attr_id          16
  reserved         16
  attr_mod         32
  reserved          8
  qp               24
  cc_key           64
  sgid            128
  padding         112

table 509 - congestion info:
  support_credit_starvation            1 //switch only
  support_per_port_threshold           1 //switch only
  support_per_port_pkt_size            1 //switch only
  support_per_port_mark_rate           1 //switch only
  support_per_port_cs_threshold        1 //switch only
  support_per_port_cs_return_delay     1 //switch only
  support_qp_based_congestion_control  1 //ca only
  support_sl_based_congestion_control  1 //ca only
  reserved                             8
  control_table_cap                    8

table 511 - congestion log (switch):
  log_type          8
  flags             8
  event_ctr        16
  timestamp        32
  port_map         256
  entry_list      1440 // array of 15 most recent events (instead of 20)

table 512 - congestion log event (switch):
  slid             16
  dlid             16
  sl                4
  reserved         28
  timestamp        32

table 513 - congestion log (ca):
  log_type          8
  flags             8
  event_ctr        16
  event_map        16
  reserved         16
  timestamp        32
  event_log      1664 // array of 13 most recent events (instead of 16)

table 514 - congestion log event (ca):
  local_qpn        24
  reserved          8
  remote_qpn       24
  sl                4
  service_type      4
  rlid             16
  reserved         16
  timestamp        32

table 515 - switch congestion setting:
  control_map      32
  victim_mask     256
  credit_mask     256
  threshold         4
  reserved          4
  packet_size       8
  cs_threshold      4
  reserved         12
  cs_return_delay  16
  marking_rate     16

table 516 - switch port congestion setting attribute:
  cong_setting_block   1024  // contains an array of 32 
switch_port_congestion_setting_elements

table 517 - switch port congestion setting element:
  valid             1
  control_type      1
  reserved          2
  threshold         4
  packet_size       8 // when control_type=1 this field is reserved
  cong_parm        16 // when control_type=0 this field contains the port 
marking_rate
                      // attribute_modifier is a pointer to a block of 32 
congestion controls

table 519 - ca congestion entry:
  ccti_timer       16
  ccti_increase     8
  trigger_thresh    8
  ccti_min          8
  reserved         24

table 520 - congestion control table:
  ccti_limit       16
  reserved         16
  ccti_entries   1024 // origin of the ccti_entry_list is attribute_modifer*64 
(instead of attribute_modifier*64+1)

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to