X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto-sflow.c;h=04e8347050628eb68d565c3560b79165ccc99b5c;hb=52ce26ee3b13496f65132996120e59ec29ab64c2;hp=e5766603eb267160b7df389fb5de231c5573ca5b;hpb=ae412e7dd89489911a32c6723d4109c6d1de3a38;p=openvswitch diff --git a/ofproto/ofproto-sflow.c b/ofproto/ofproto-sflow.c index e5766603..04e83470 100644 --- a/ofproto/ofproto-sflow.c +++ b/ofproto/ofproto-sflow.c @@ -27,13 +27,14 @@ #include "netdev.h" #include "ofpbuf.h" #include "ofproto.h" +#include "packets.h" #include "poll-loop.h" #include "sflow_api.h" #include "socket-util.h" #include "timeval.h" #include "vlog.h" -VLOG_DEFINE_THIS_MODULE(sflow) +VLOG_DEFINE_THIS_MODULE(sflow); struct ofproto_sflow_port { struct hmap_node hmap_node; /* In struct ofproto_sflow's "ports" hmap. */ @@ -181,10 +182,8 @@ sflow_agent_get_counters(void *os_, SFLPoller *poller, counters->ifDirection = 0; } if (!netdev_get_flags(osp->netdev, &flags) && flags & NETDEV_UP) { - bool carrier; - counters->ifStatus = 1; /* ifAdminStatus up. */ - if (!netdev_get_carrier(osp->netdev, &carrier) && carrier) { + if (netdev_get_carrier(osp->netdev)) { counters->ifStatus |= 2; /* ifOperStatus us. */ } } else { @@ -566,6 +565,7 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg) n_outputs = 0; for (i = 0; i < n_actions; i++) { const union odp_action *a = &actions[i]; + uint16_t tci; switch (a->type) { case ODPAT_OUTPUT: @@ -573,12 +573,10 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg) n_outputs++; break; - case ODPAT_SET_VLAN_VID: - switchElem.flowType.sw.dst_vlan = ntohs(a->vlan_vid.vlan_vid); - break; - - case ODPAT_SET_VLAN_PCP: - switchElem.flowType.sw.dst_priority = a->vlan_pcp.vlan_pcp; + case ODPAT_SET_DL_TCI: + tci = a->dl_tci.tci; + switchElem.flowType.sw.dst_vlan = vlan_tci_to_vid(tci); + switchElem.flowType.sw.dst_priority = vlan_tci_to_pcp(tci); break; default: