On 2020/05/06 0:37, William Tu wrote:
On Tue, Apr 21, 2020 at 11:47:03PM +0900, Toshiaki Makita wrote:...
+/* Convert odp_port to devmap_idx in output action */
+static int
+convert_port_to_devmap_idx(struct nlattr *actions, size_t actions_len)
+{
+    struct nlattr *a;
+    unsigned int left;
+    bool output_seen = false;
+
+    NL_ATTR_FOR_EACH_UNSAFE(a, left, actions, actions_len) {
+        int type = nl_attr_type(a);
+
+        if (output_seen) {
+            VLOG_DBG("XDP does not support packet copy");
+            return EOPNOTSUPP;
+        }
+
+        if (type == OVS_ACTION_ATTR_OUTPUT) {
+            odp_port_t *port;
+            struct netdev_info *netdev_info;
+
+            port = CONST_CAST(odp_port_t *,
+                              nl_attr_get_unspec(a, sizeof(odp_port_t)));
+            netdev_info = find_netdev_info(*port);
+            if (!netdev_info) {
+                VLOG_DBG("Cannot output to port %u without XDP prog attached",
+                         *port);

Hi Toshiaki,

Does this mean all of my port attached to ovs need to have XDP prog attached?

Yes.

Why can't a port with xdp offload receive a packet and forward to a 
non-xdp-offload
port? Is this a limitation in kernel?

Yes. In many cases XDP_REDIRECT does not work when redirect target device does not have XDP prog attached. Attaching an XDP prog is just a workaround and that's not sufficient, e.g. veth does not work even when doing that, but we don't have any other (right) way to workaround it. Linux netdev community is working on this problem. Once we have a sane way to fix it, we no longer need to attach an XDP prog.

Toshiaki Makita
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to