Currently, we support offloading of one output port. Remove that limitation by use of mirred mirror action for all output ports, except that the last one is mirred redirect action.
Issue: 1321102 Change-Id: I65f0d0b6b4531c74b5550ad88a19a441027dc8f6 Signed-off-by: Chris Mi <[email protected]> Reviewed-by: Paul Blakey <[email protected]> Reviewed-by: Roi Dayan <[email protected]> --- lib/dpif-netlink.c | 10 +--------- lib/tc.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 17be3ddde..bb9e95df7 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -2081,7 +2081,6 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put) odp_port_t in_port; const struct nlattr *nla; size_t left; - int outputs = 0; struct netdev *dev; struct offload_info info; ovs_be16 dst_port = 0; @@ -2108,20 +2107,13 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put) return EOPNOTSUPP; } - /* Get tunnel dst port and count outputs */ + /* Get tunnel dst port */ NL_ATTR_FOR_EACH(nla, left, put->actions, put->actions_len) { if (nl_attr_type(nla) == OVS_ACTION_ATTR_OUTPUT) { const struct netdev_tunnel_config *tnl_cfg; struct netdev *outdev; odp_port_t out_port; - outputs++; - if (outputs > 1) { - VLOG_DBG_RL(&rl, "offloading multiple ports isn't supported"); - err = EOPNOTSUPP; - goto out; - } - out_port = nl_attr_get_odp_port(nla); outdev = netdev_ports_get(out_port, dpif_class); if (!outdev) { diff --git a/lib/tc.c b/lib/tc.c index aeec94ac7..3fc390275 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -1209,15 +1209,16 @@ nl_msg_put_act_drop(struct ofpbuf *request) } static void -nl_msg_put_act_redirect(struct ofpbuf *request, int ifindex) +nl_msg_put_act_mirred(struct ofpbuf *request, int ifindex, int action, + int eaction) { size_t offset; nl_msg_put_string(request, TCA_ACT_KIND, "mirred"); offset = nl_msg_start_nested(request, TCA_ACT_OPTIONS); { - struct tc_mirred m = { .action = TC_ACT_STOLEN, - .eaction = TCA_EGRESS_REDIR, + struct tc_mirred m = { .action = action, + .eaction = eaction, .ifindex = ifindex }; nl_msg_put_unspec(request, TCA_MIRRED_PARMS, &m, sizeof m); @@ -1453,7 +1454,13 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) return EINVAL; } act_offset = nl_msg_start_nested(request, act_index++); - nl_msg_put_act_redirect(request, ifindex); + if (i == flower->action_count - 1) { + nl_msg_put_act_mirred(request, ifindex, TC_ACT_STOLEN, + TCA_EGRESS_REDIR); + } else { + nl_msg_put_act_mirred(request, ifindex, TC_ACT_PIPE, + TCA_EGRESS_MIRROR); + } nl_msg_put_act_cookie(request, &flower->act_cookie); nl_msg_end_nested(request, act_offset); } -- 2.14.3 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
