1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2019 Solarflare Communications Inc.
5 * Copyright 2020-2022 Xilinx Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation, incorporated herein by reference.
12 /* Handling for ef100 representor netdevs */
16 #include "net_driver.h"
19 struct efx_rep_sw_stats
{
20 atomic64_t rx_packets
, tx_packets
;
21 atomic64_t rx_bytes
, tx_bytes
;
22 atomic64_t rx_dropped
, tx_errors
;
28 * struct efx_rep - Private data for an Efx representor
30 * @parent: the efx PF which manages this representor
31 * @net_dev: representor netdevice
32 * @msg_enable: log message enable flags
33 * @mport: m-port ID of corresponding VF
35 * @write_index: number of packets enqueued to @rx_list
36 * @read_index: number of packets consumed from @rx_list
37 * @rx_pring_size: max length of RX list
38 * @dflt: default-rule for MAE switching
39 * @list: entry on efx->vf_reps
40 * @rx_list: list of SKBs queued for receive in NAPI poll
41 * @rx_lock: protects @rx_list
42 * @napi: NAPI control structure
43 * @stats: software traffic counters for netdev stats
44 * @dl_port: devlink port associated to this netdev representor
47 struct efx_nic
*parent
;
48 struct net_device
*net_dev
;
52 unsigned int write_index
, read_index
;
53 unsigned int rx_pring_size
;
54 struct efx_tc_flow_rule dflt
;
55 struct list_head list
;
56 struct list_head rx_list
;
58 struct napi_struct napi
;
59 struct efx_rep_sw_stats stats
;
60 struct devlink_port
*dl_port
;
63 int efx_ef100_vfrep_create(struct efx_nic
*efx
, unsigned int i
);
64 void efx_ef100_vfrep_destroy(struct efx_nic
*efx
, struct efx_rep
*efv
);
65 void efx_ef100_fini_vfreps(struct efx_nic
*efx
);
67 void efx_ef100_rep_rx_packet(struct efx_rep
*efv
, struct efx_rx_buffer
*rx_buf
);
68 /* Returns the representor corresponding to a VF m-port, or NULL
69 * @mport is an m-port label, *not* an m-port ID!
70 * Caller must hold rcu_read_lock().
72 struct efx_rep
*efx_ef100_find_rep_by_mport(struct efx_nic
*efx
, u16 mport
);
73 extern const struct net_device_ops efx_ef100_rep_netdev_ops
;
74 void efx_ef100_init_reps(struct efx_nic
*efx
);
75 void efx_ef100_fini_reps(struct efx_nic
*efx
);
76 struct mae_mport_desc
;
77 bool ef100_mport_on_local_intf(struct efx_nic
*efx
,
78 struct mae_mport_desc
*mport_desc
);
79 bool ef100_mport_is_vf(struct mae_mport_desc
*mport_desc
);
80 #endif /* EF100_REP_H */