tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

load_balancing: more guidance needed for use of hash()

Open liujed opened this issue 8 years ago • 0 comments

  • Slide 78 of P4D2_2017_Fall/P4_tutorial_labs.pdf has information on the signature of hash() that should be copied into load_balancing.p4.
  • Comments for ecmp_base and ecmp_count are needed in load_balancing p4. (Otherwise, I wouldn't know to use them for baseand max in the call to hash().)
  • Hash algorithm is unspecified. (Need to say CRC16 somewhere.)
  • Attempts based on example usage in PSA spec didn't work. My attempt:
Hash<bit<14>>(HashAlgorithm_t.CRC16) h;
meta.ecmp_select =
  h.get_hash({hdr.ipv4.srcAddr, hdr.ipv4.dstAddr,
    hdr.ipv4.protocol, hdr.tcp.srcPort, hdr.tcp.dstPort});

Resulting error:

syntax error, unexpected IDENTIFIER, expecting ;
        Hash<bit<14>>(HashAlgorithm_t.CRC16) h
                                             ^

liujed avatar Nov 13 '17 23:11 liujed