Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /****************************************************************************
0003  * Driver for Solarflare network controllers and boards
0004  * Copyright 2019 Solarflare Communications Inc.
0005  * Copyright 2020-2022 Xilinx Inc.
0006  *
0007  * This program is free software; you can redistribute it and/or modify it
0008  * under the terms of the GNU General Public License version 2 as published
0009  * by the Free Software Foundation, incorporated herein by reference.
0010  */
0011 
0012 /* Handling for ef100 representor netdevs */
0013 #ifndef EF100_REP_H
0014 #define EF100_REP_H
0015 
0016 #include "net_driver.h"
0017 #include "tc.h"
0018 
0019 struct efx_rep_sw_stats {
0020     atomic64_t rx_packets, tx_packets;
0021     atomic64_t rx_bytes, tx_bytes;
0022     atomic64_t rx_dropped, tx_errors;
0023 };
0024 
0025 /**
0026  * struct efx_rep - Private data for an Efx representor
0027  *
0028  * @parent: the efx PF which manages this representor
0029  * @net_dev: representor netdevice
0030  * @msg_enable: log message enable flags
0031  * @mport: m-port ID of corresponding VF
0032  * @idx: VF index
0033  * @write_index: number of packets enqueued to @rx_list
0034  * @read_index: number of packets consumed from @rx_list
0035  * @rx_pring_size: max length of RX list
0036  * @dflt: default-rule for MAE switching
0037  * @list: entry on efx->vf_reps
0038  * @rx_list: list of SKBs queued for receive in NAPI poll
0039  * @rx_lock: protects @rx_list
0040  * @napi: NAPI control structure
0041  * @stats: software traffic counters for netdev stats
0042  */
0043 struct efx_rep {
0044     struct efx_nic *parent;
0045     struct net_device *net_dev;
0046     u32 msg_enable;
0047     u32 mport;
0048     unsigned int idx;
0049     unsigned int write_index, read_index;
0050     unsigned int rx_pring_size;
0051     struct efx_tc_flow_rule dflt;
0052     struct list_head list;
0053     struct list_head rx_list;
0054     spinlock_t rx_lock;
0055     struct napi_struct napi;
0056     struct efx_rep_sw_stats stats;
0057 };
0058 
0059 int efx_ef100_vfrep_create(struct efx_nic *efx, unsigned int i);
0060 void efx_ef100_vfrep_destroy(struct efx_nic *efx, struct efx_rep *efv);
0061 void efx_ef100_fini_vfreps(struct efx_nic *efx);
0062 
0063 void efx_ef100_rep_rx_packet(struct efx_rep *efv, struct efx_rx_buffer *rx_buf);
0064 /* Returns the representor corresponding to a VF m-port, or NULL
0065  * @mport is an m-port label, *not* an m-port ID!
0066  * Caller must hold rcu_read_lock().
0067  */
0068 struct efx_rep *efx_ef100_find_rep_by_mport(struct efx_nic *efx, u16 mport);
0069 #endif /* EF100_REP_H */