--- zzzz-none-000/linux-5.15.111/include/uapi/linux/openvswitch.h 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/include/uapi/linux/openvswitch.h 2024-02-07 10:23:28.000000000 +0000 @@ -18,6 +18,16 @@ * 02110-1301, USA */ +/* + * Includes Inango Systems Ltd’s changes/modifications dated: 2021. + * Changed/modified portions - Copyright (c) 2021 , Inango Systems Ltd. + */ + +/* + Includes MaxLinear's changes dated: 2021, 2023. + Changed portions - Copyright 2021-2023 MaxLinear, Inc. +*/ + #ifndef _UAPI__LINUX_OPENVSWITCH_H #define _UAPI__LINUX_OPENVSWITCH_H 1 @@ -218,7 +228,17 @@ OVS_VPORT_CMD_NEW, OVS_VPORT_CMD_DEL, OVS_VPORT_CMD_GET, - OVS_VPORT_CMD_SET + OVS_VPORT_CMD_SET, + OVS_VPORT_CMD_ADDMCASTGRP, + OVS_VPORT_CMD_DELMCASTGRP, +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT + OVS_VPORT_CMD_NEWNEIGH, + OVS_VPORT_CMD_DELNEIGH, + OVS_VPORT_CMD_SET_FLAGS, + OVS_VPORT_CMD_DEL_FLAGS, + OVS_VPORT_CMD_SET_CARRIER, +#endif + __OVS_VPORT_CMD_MAX }; enum ovs_vport_type { @@ -267,8 +287,20 @@ OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT + OVS_VPORT_ATTR_BRNAME, /* string bridge name, up to IFNAMSIZ bytes long */ +#endif OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT + OVS_VPORT_ATTR_MAC, /* mac address */ +#endif + OVS_VPORT_ATTR_IPV4, /* IPv4 address */ + OVS_VPORT_ATTR_IPV6, /* IPv6 address */ + OVS_VPORT_ATTR_VLAN, /* VLAN tag */ +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT + OVS_VPORT_ATTR_FLAGS, /* operational flags */ +#endif /* receiving upcalls */ OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ OVS_VPORT_ATTR_PAD, @@ -402,6 +434,13 @@ #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT +/* vport operational flags */ +#define OVS_VPORT_FLAG_SET_MTU_BY_USER (0x01u) +#define OVS_VPORT_FLAG_SET_MTU_AUTO (0x02u) +#define OVS_VPORT_FLAG_SET_MAC (0x04u) +#endif + struct ovs_key_ethernet { __u8 eth_src[ETH_ALEN]; __u8 eth_dst[ETH_ALEN]; @@ -582,6 +621,7 @@ OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ + OVS_FLOW_ATTR_TIMEOUT, /* session timeout */ OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ @@ -590,6 +630,8 @@ * logging should be suppressed. */ OVS_FLOW_ATTR_UFID, /* Variable length unique flow identifier. */ OVS_FLOW_ATTR_UFID_FLAGS,/* u32 of OVS_UFID_F_*. */ + OVS_FLOW_ATTR_PROACTIVE_FLAG, /* Bool flag for proactive or reactive mode. */ + OVS_FLOW_ATTR_FLOW_TYPE, /* Bool flag for proactive or reactive mode. */ OVS_FLOW_ATTR_PAD, __OVS_FLOW_ATTR_MAX }; @@ -597,6 +639,23 @@ #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) /** + * Flow type attribute provide addtional info from userspace. + * helps to determine how decisiion to create flow was made. + * UNKNOWN_FLOW_TYPE - can't determine flow type + * BROADCAST_FLOW_TYPE - flow created via normal rule for broadcast/multicast traffic or via FLOOD rule. + * UNICAST_FLOW_TYPE - flow created via fdb for specified dst mac address. + * MULTICAST_FLOW_TYPE - flow created for multicast data traffic when multicast snooping enabled. + * UNKNOWN_UNICAST_FLOW_TYPE - flow created during normal rule when fdb doesn't contains specified mac. +*/ +enum flow_type { + UNKNOWN_FLOW_TYPE, + BROADCAST_FLOW_TYPE, + UNICAST_FLOW_TYPE, + MULTICAST_FLOW_TYPE, + UNKNOWN_UNICAST_FLOW_TYPE +}; + +/** * Omit attributes for notifications. * * If a datapath request contains an %OVS_UFID_F_OMIT_* flag, then the datapath @@ -664,10 +723,28 @@ #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) +/** + * struct ovs_action_mcast_output + * TODO. fill + */ +struct ovs_action_mcast_output { + uint32_t out_port; + __u8 host_mac[ETH_ALEN]; + __u8 unicast_to_mcast; +}; struct ovs_action_trunc { __u32 max_len; /* Max packet size in bytes. */ }; +struct ovs_action_set_of_mark { + uint32_t value; /* Some value. */ + uint32_t mask; /* Some mask. */ +}; + +struct ovs_action_skip_acc { + uint32_t number_of_packets; /* Packets number to prevent acceleration */ +}; + /** * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument. * @mpls_lse: MPLS label stack entry to push. @@ -884,6 +961,7 @@ * enum ovs_action_attr - Action types. * * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. + * @OVS_ACTION_ATTR_MULTICAST_OUTPUT: * @OVS_ACTION_ATTR_TRUNC: Output packet to port with truncated packet size. * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested * %OVS_USERSPACE_ATTR_* attributes. @@ -943,6 +1021,7 @@ enum ovs_action_attr { OVS_ACTION_ATTR_UNSPEC, OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ + OVS_ACTION_ATTR_MULTICAST_OUTPUT, /* struct ovs_action_mcast_output */ OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ @@ -965,6 +1044,9 @@ OVS_ACTION_ATTR_POP_NSH, /* No argument. */ OVS_ACTION_ATTR_METER, /* u32 meter ID. */ OVS_ACTION_ATTR_CLONE, /* Nested OVS_CLONE_ATTR_*. */ + OVS_ACTION_ATTR_SET_OF_MARK1, /* struct ovs_action_set_of_mark. */ + OVS_ACTION_ATTR_SET_OF_MARK2, /* struct ovs_action_set_of_mark. */ + OVS_ACTION_ATTR_SKIP_ACC, /* struct ovs_action_skip_acc */ OVS_ACTION_ATTR_CHECK_PKT_LEN, /* Nested OVS_CHECK_PKT_LEN_ATTR_*. */ OVS_ACTION_ATTR_ADD_MPLS, /* struct ovs_action_add_mpls. */ OVS_ACTION_ATTR_DEC_TTL, /* Nested OVS_DEC_TTL_ATTR_*. */ @@ -1068,4 +1150,87 @@ #define OVS_DEC_TTL_ATTR_MAX (__OVS_DEC_TTL_ATTR_MAX - 1) +/* AM API */ + +#define PP_AM_MAX_UFID_LENGTH 4 /* 128 bits */ +#define PP_AM_EGRESS_PORTS_MAX 52 + +typedef enum { + PP_AM_OK, + PP_AM_NO_SESSIONS_LEFT, + PP_AM_UNSUPPORTED_PARAM, + PP_AM_GENERIC_FAIL, + PP_AM_STATS_NOT_UPDATED, + PP_AM_NO_SUCH_SESSION, + PP_AM_UNDEFINED_FUNCTION +} pp_am_status_ret; + +struct pp_am_stats { + __u64 packets; + __u64 bytes; + __u64 last_used; +}; + +typedef enum { + PP_AM_UNDEFINED = 0, // NOP + PP_AM_SET_OUTPUT, + PP_AM_SET_DROP, + PP_AM_SET_FLOOD, + PP_AM_SET_SKIP, + PP_AM_SET_FORWARD_UDP, + PP_AM_SET_MCAST_FLOOD, + PP_AM_SET_MCAST_PORT_OUTPUT +} pp_am_skb_process_action; + +typedef enum pp_am_port_event_type { + PP_AM_UNKNOWN_PORT_EVENT, + PP_AM_MULTICAST_JOIN, + PP_AM_MULTICAST_LEAVE +} pp_am_port_event_type; + +struct pp_am_ip_addr { + union { + struct in_addr ipv4; + struct in6_addr ipv6; + }; + __u16 eth_proto; +}; + +struct pp_am_multicast_event_msg { + int ifindex; + struct pp_am_ip_addr ip; +}; + +struct pp_am_mcast_port_output { + int ifindex; + __u8 host_mac[ETH_ALEN]; +}; + +struct datapath; +struct sw_flow; +struct sw_flow_actions; +struct net_device; +struct sk_buff; + +struct ovs_acceleration_module_ops { + pp_am_status_ret (*pp_am_create_session)(struct datapath *dp, struct sw_flow *flow, bool proactive_flag); + pp_am_status_ret (*pp_am_modify_session)(struct datapath *dp, struct sw_flow *flow, struct sw_flow_actions *old_acts); + pp_am_status_ret (*pp_am_delete_session)(struct sw_flow *flow, struct pp_am_stats *stats_out); + pp_am_status_ret (*pp_am_get_session_stats)(__u32 pp_am_id, struct pp_am_stats *stats_out); + pp_am_status_ret (*pp_am_skb_preprocess)(pp_am_skb_process_action action, __u32 ufid[4], __u32 pp_am_id, struct sk_buff *skb); + pp_am_status_ret (*pp_am_skb_postprocess)(pp_am_skb_process_action action, void *data, __u32 ufid[4], __u32 pp_am_id, struct sk_buff *skb); + pp_am_status_ret (*pp_am_port_event)(pp_am_port_event_type type, struct pp_am_multicast_event_msg *msg); + bool (*pp_am_can_accelerate_ports)(const unsigned int *ports, const size_t ports_len); +}; + +pp_am_status_ret ovs_acceleration_module_register(struct ovs_acceleration_module_ops *ops); + +pp_am_status_ret ovs_acceleration_module_unregister(void); + +pp_am_status_ret ovs_notify_am_id(__u32 ufid[PP_AM_MAX_UFID_LENGTH], __u32 am_id, __u32 *old_am_id, __u32 session_timeout); + +struct net_device * ovs_get_net_device_rcu(const struct datapath *dp, int port_no); + +struct net_device * ovs_get_net_device(const struct datapath *dp, int port_no); + #endif /* _LINUX_OPENVSWITCH_H */