xref: /linux/drivers/net/ethernet/intel/ice/ice_repr.h (revision 3f41368fbfe1b3d5922d317fe1a0a0cab6846802)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2019-2021, Intel Corporation. */
3 
4 #ifndef _ICE_REPR_H_
5 #define _ICE_REPR_H_
6 
7 #include <net/dst_metadata.h>
8 
9 struct ice_repr_pcpu_stats {
10 	struct u64_stats_sync syncp;
11 	u64 rx_packets;
12 	u64 rx_bytes;
13 	u64 tx_packets;
14 	u64 tx_bytes;
15 	u64 tx_drops;
16 };
17 
18 struct ice_repr {
19 	struct ice_vsi *src_vsi;
20 	struct ice_vf *vf;
21 	struct net_device *netdev;
22 	struct metadata_dst *dst;
23 	struct ice_esw_br_port *br_port;
24 	struct ice_repr_pcpu_stats __percpu *stats;
25 	u32 id;
26 	u8 parent_mac[ETH_ALEN];
27 };
28 
29 struct ice_repr *ice_repr_add_vf(struct ice_vf *vf);
30 void ice_repr_rem_vf(struct ice_repr *repr);
31 
32 void ice_repr_start_tx_queues(struct ice_repr *repr);
33 void ice_repr_stop_tx_queues(struct ice_repr *repr);
34 
35 struct ice_repr *ice_netdev_to_repr(const struct net_device *netdev);
36 bool ice_is_port_repr_netdev(const struct net_device *netdev);
37 
38 struct ice_repr *ice_repr_get_by_vsi(struct ice_vsi *vsi);
39 
40 void ice_repr_inc_tx_stats(struct ice_repr *repr, unsigned int len,
41 			   int xmit_status);
42 void ice_repr_inc_rx_stats(struct net_device *netdev, unsigned int len);
43 #endif
44