Thanks Justin for the clarification. So is it possible to query the interface and its corresponding openflow port from /ofproto/ofproto.c some where in add_flow(struct ofconn *ofconn, struct flow_mod *fm).
I am trying to write a function to achieve this, by copying all the relevant logic from ovs-ofctl to ofproto. The system hangs when call to poll_block() is made. May be I am doing it the wrong way. Bibrak On Wed, Aug 24, 2011 at 11:31 AM, Justin Pettit <[email protected]> wrote: > The confusion on our end is that what you call a hardware port number, we > consider to be just the interface name (e.g., "eth0" on Linux). What > platform is this? I haven't seen that naming convention. > > If you want to script it, one option is to query the config database with > the following: > > "ovs-vsctl get interface eth0 ofport" > > Obviously, you'd replace "eth0" with the name of your port. > > Hope that helps. > > --Justin > > > On Aug 23, 2011, at 11:21 PM, Bibrak Qamar wrote: > > > > > / # ./openvswitch/utilities/ovs-ofctl show br0 --> gives the following > result > > > > 1(p1): addr:00:00:00:00:00:01, config: 0, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > 2(p4): addr:00:00:00:00:00:04, config: 0, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > 3(p2): addr:00:00:00:00:00:02, config: 0, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > 4(p5): addr:00:00:00:00:00:05, config: 0, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > 5(p3): addr:00:00:00:00:00:03, config: 0, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > 6(p0): addr:00:00:00:00:00:00, config: 0, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > LOCAL(br0): addr:00:00:02:00:00:00, config: 0x1, state:0x1 > > current: 1GB-FD COPPER > > advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD > > > > OFPT_GET_CONFIG_REPLY (xid=0x3): frags=normal miss_send_len=0 > > --------------------- > > > > Here p0,p1,p2 .. .. represent physical port numbers. OVS uses its own > numbering which is in an incremental way starting from 1 to the number of > ports activated. > > > > Here, OVS port number 1 points to physical port number 1, OVS port number > 2 points to physical port number 4. > > So I would like to know whether there is any simple way to convert the > ovs port number to the physical number. > > Some thing like: > > int phyPort = getPhyPortNum(IN OVSportNum); > > > > > > > > MORE INFO: > > > > Following chunk of code in function --> static void > ofp_print_switch_features(struct ds *string,const struct ofp_switch_features > *osf), in ofp-print.c prints the ports numbers. > > > > port_list = xmemdup(osf->ports, len - sizeof *osf); > > qsort(port_list, n_ports, sizeof *port_list, compare_ports); > > for (i = 0; i < n_ports; i++) { > > ofp_print_phy_port(string, &port_list[i]); > > } > > > > And in ofp_print_phy_port(struct ds *string, const struct ofp_phy_port > *port) --> char name store the physical port number. > > > > > > > > > > Bibrak > > > > > > On Wed, Aug 24, 2011 at 10:14 AM, Ben Pfaff <[email protected]> wrote: > > On Wed, Aug 24, 2011 at 10:10:01AM +0500, Bibrak Qamar wrote: > > > ovs-ofctl show br0 --- > Shows list of ports with their OVS port number > and > > > Hardware port number. Is there any simple way (may be a function) to > convert > > > ovs port number to its corresponding hardware port number and vise > versa . > > > > Can you point out what part of the "ovs-ofctl show" output you regard as > > the hardware port number? > > > > _______________________________________________ > > dev mailing list > > [email protected] > > http://openvswitch.org/mailman/listinfo/dev > >
_______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
