--- zzzz-none-000/linux-5.4.213/net/openvswitch/datapath.h 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/net/openvswitch/datapath.h 2024-05-29 11:20:02.000000000 +0000 @@ -139,6 +139,37 @@ bool xt_label; }; +/** + * struct ovs_accel_callback - OVS acceleration callbacks + * @ovs_accel_dp_add - new data path is created + * @ovs_accel_dp_del - data path is deleted + * @ovs_accel_dp_port_add - new port is added into data path + * @ovs_accel_dp_port_del - port is deleted from data path + * @ovs_accel_dp_flow_add - new flow rule is added in data path + * @ovs_accel_dp_flow_del - flow rule is deleted from data path + * @ovs_accel_dp_flow_set - existing flow rule is modified in data path + * @ovs_accel_dp_flow_tbl_flush - flow table is flushed in data path + * @ovs_accel_dp_pkt_process - Process data path packet + */ +struct ovs_accel_callback { + void (*ovs_accel_dp_add)(void *dp, struct net_device *dev); + void (*ovs_accel_dp_del)(void *dp, struct net_device *dev); + void (*ovs_accel_dp_port_add)(void *dp, void *vp, + int vp_num, enum ovs_vport_type vp_type, + const char *master, struct net_device *dev); + void (*ovs_accel_dp_port_del)(void *dp, void *vp, + struct net_device *dev); + void (*ovs_accel_dp_flow_add)(void *dp, struct sw_flow *sf); + void (*ovs_accel_dp_flow_del)(void *dp, struct sw_flow *sf); + void (*ovs_accel_dp_flow_set)(void *dp, struct sw_flow *sf, + struct sw_flow_actions *sfa); + void (*ovs_accel_dp_flow_tbl_flush)(void *dp); + void (*ovs_accel_dp_pkt_process)(void *dp, struct sk_buff *skb, + struct sw_flow_key *key, + struct sw_flow *sf, + struct sw_flow_actions *sfa); +}; + extern unsigned int ovs_net_id; void ovs_lock(void); void ovs_unlock(void); @@ -225,6 +256,7 @@ int ovs_dp_upcall(struct datapath *, struct sk_buff *, const struct sw_flow_key *, const struct dp_upcall_info *, uint32_t cutlen); +void ovs_dp_port_del_notify(struct datapath *dp, struct vport *vp); const char *ovs_dp_name(const struct datapath *dp); struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, struct net *net, @@ -238,6 +270,21 @@ int action_fifos_init(void); void action_fifos_exit(void); +int ovs_register_accelerator(struct ovs_accel_callback *oac); +void ovs_unregister_accelerator(struct ovs_accel_callback *oac); +int ovs_accel_flow_stats_update(void *dp, void *out_vport, + struct sw_flow_key *sf, int pkts, int bytes); +struct sw_flow *ovs_accel_flow_find(void *dp, struct sw_flow_key *sfk); +struct net_device *ovs_accel_dev_find(void *dp, int vport_no); +struct net_device *ovs_accel_egress_dev_find(void *dp_inst, + struct sw_flow_key *key, + struct sk_buff *skb); + +struct sw_flow *ovs_accel_flow_find_by_mac(void *dp_inst, + struct net_device *indev, + struct net_device *outdev, + uint8_t *smac, uint8_t *dmac, uint16_t type); + /* 'KEY' must not have any bits set outside of the 'MASK' */ #define OVS_MASKED(OLD, KEY, MASK) ((KEY) | ((OLD) & ~(MASK))) #define OVS_SET_MASKED(OLD, KEY, MASK) ((OLD) = OVS_MASKED(OLD, KEY, MASK))