+void
+format_odp_port_type(struct ds *ds, const struct odp_port *p)
+{
+ if (!strcmp(p->type, "gre")
+ || !strcmp(p->type, "ipsec_gre")
+ || !strcmp(p->type, "capwap")) {
+ const struct tnl_port_config *config;
+
+ config = (struct tnl_port_config *)p->config;
+
+ ds_put_format(ds, " (%s: remote_ip="IP_FMT,
+ p->type, IP_ARGS(&config->daddr));
+
+ if (config->saddr) {
+ ds_put_format(ds, ", local_ip="IP_FMT, IP_ARGS(&config->saddr));
+ }
+
+ if (config->in_key) {
+ ds_put_format(ds, ", in_key=%#"PRIx64, ntohll(config->in_key));
+ }
+
+ ds_put_cstr(ds, ")");
+ } else if (!strcmp(p->type, "patch")) {
+ ds_put_format(ds, " (%s: peer=%s)", p->type, (char *)p->config);
+ } else if (strcmp(p->type, "system")) {
+ ds_put_format(ds, " (%s)", p->type);
+ }
+}
+\f
+void
+odp_flow_key_from_flow(struct odp_flow_key *key, const struct flow *flow)
+{
+ key->tun_id = flow->tun_id;
+ key->nw_src = flow->nw_src;
+ key->nw_dst = flow->nw_dst;
+ key->in_port = flow->in_port;
+ key->dl_tci = flow->vlan_tci;
+ key->dl_type = flow->dl_type;
+ key->tp_src = flow->tp_src;
+ key->tp_dst = flow->tp_dst;
+ memcpy(key->dl_src, flow->dl_src, ETH_ADDR_LEN);
+ memcpy(key->dl_dst, flow->dl_dst, ETH_ADDR_LEN);
+ key->nw_proto = flow->nw_proto;
+ key->nw_tos = flow->nw_tos;
+}
+
+void
+odp_flow_key_to_flow(const struct odp_flow_key *key, struct flow *flow)
+{
+ memset(flow->regs, 0, sizeof flow->regs);
+ flow->tun_id = key->tun_id;
+ flow->nw_src = key->nw_src;
+ flow->nw_dst = key->nw_dst;
+ flow->in_port = key->in_port;
+ flow->vlan_tci = key->dl_tci;
+ flow->dl_type = key->dl_type;
+ flow->tp_src = key->tp_src;
+ flow->tp_dst = key->tp_dst;
+ memcpy(flow->dl_src, key->dl_src, ETH_ADDR_LEN);
+ memcpy(flow->dl_dst, key->dl_dst, ETH_ADDR_LEN);
+ flow->nw_proto = key->nw_proto;
+ flow->nw_tos = key->nw_tos;
+}