[P4-dev] How to dynamically set egress output port

Eric Ruan ruanweizhang at gmail.com
Fri Jul 14 06:01:10 EDT 2017


Hello everyone,

I am trying to dynamically set egress port for a packet.
I think the possible way is to request the current port
bit rate of physical output ports and then use if-else sentences to
dynamically set up the egress port in the ingress pipeline stage.
Then I came up with some questions.

Q1: in this link *https://goo.gl/jqmD64 <https://goo.gl/jqmD64>*

/** port speed */
typedef enum {
  SWITCH_API_PORT_SPEED_NONE, /**< Port Speed Not set */
  SWITCH_API_PORT_SPEED_1G,   /**< port speed 1G */
  SWITCH_API_PORT_SPEED_10G,  /**< port speed 10G */
  SWITCH_API_PORT_SPEED_25G,  /**< port speed 25G */
  SWITCH_API_PORT_SPEED_40G,  /**< port speed 40G */
  SWITCH_API_PORT_SPEED_50G,  /**< port speed 50G */
  SWITCH_API_PORT_SPEED_100G  /**< port speed 100G */
} switch_port_speed_t;

where switch_port_speed_t is not continuous number, how can it
accurately record the current bit rate of a physical output port?

Q2: again in the same link *https://goo.gl/jqmD64 <https://goo.gl/jqmD64>*
the get function is like this, but I couldn't find any example on Internet
on how to use this. Since it is written in C/C++ language, I don't know how
to call this function in p4 program.

switch_status_t switch_api_port_speed_get(switch_device_t device,
                                          switch_port_t port,
                                          switch_port_speed_t *speed) {
  return SWITCH_STATUS_SUCCESS;
}

Thanks in advance.

Best,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170714/c3fb5299/attachment-0002.html>


More information about the P4-dev mailing list