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 #ifndef EFX_TC_H
0013 #define EFX_TC_H
0014 #include "net_driver.h"
0015 
0016 struct efx_tc_action_set {
0017     u16 deliver:1;
0018     u32 dest_mport;
0019     u32 fw_id; /* index of this entry in firmware actions table */
0020     struct list_head list;
0021 };
0022 
0023 struct efx_tc_match_fields {
0024     /* L1 */
0025     u32 ingress_port;
0026 };
0027 
0028 struct efx_tc_match {
0029     struct efx_tc_match_fields value;
0030     struct efx_tc_match_fields mask;
0031 };
0032 
0033 struct efx_tc_action_set_list {
0034     struct list_head list;
0035     u32 fw_id;
0036 };
0037 
0038 struct efx_tc_flow_rule {
0039     struct efx_tc_match match;
0040     struct efx_tc_action_set_list acts;
0041     u32 fw_id;
0042 };
0043 
0044 enum efx_tc_rule_prios {
0045     EFX_TC_PRIO_DFLT, /* Default switch rule; one of efx_tc_default_rules */
0046     EFX_TC_PRIO__NUM
0047 };
0048 
0049 /**
0050  * struct efx_tc_state - control plane data for TC offload
0051  *
0052  * @reps_mport_id: MAE port allocated for representor RX
0053  * @reps_filter_uc: VNIC filter for representor unicast RX (promisc)
0054  * @reps_filter_mc: VNIC filter for representor multicast RX (allmulti)
0055  * @reps_mport_vport_id: vport_id for representor RX filters
0056  * @dflt: Match-action rules for default switching; at priority
0057  *  %EFX_TC_PRIO_DFLT.  Named by *ingress* port
0058  * @dflt.pf: rule for traffic ingressing from PF (egresses to wire)
0059  * @dflt.wire: rule for traffic ingressing from wire (egresses to PF)
0060  */
0061 struct efx_tc_state {
0062     u32 reps_mport_id, reps_mport_vport_id;
0063     s32 reps_filter_uc, reps_filter_mc;
0064     struct {
0065         struct efx_tc_flow_rule pf;
0066         struct efx_tc_flow_rule wire;
0067     } dflt;
0068 };
0069 
0070 struct efx_rep;
0071 
0072 int efx_tc_configure_default_rule_rep(struct efx_rep *efv);
0073 void efx_tc_deconfigure_default_rule(struct efx_nic *efx,
0074                      struct efx_tc_flow_rule *rule);
0075 
0076 int efx_tc_insert_rep_filters(struct efx_nic *efx);
0077 void efx_tc_remove_rep_filters(struct efx_nic *efx);
0078 
0079 int efx_init_tc(struct efx_nic *efx);
0080 void efx_fini_tc(struct efx_nic *efx);
0081 
0082 int efx_init_struct_tc(struct efx_nic *efx);
0083 void efx_fini_struct_tc(struct efx_nic *efx);
0084 
0085 #endif /* EFX_TC_H */