With this patch, ice driver is able to track if the port representors or uplink port were added to the linux bridge in switchdev mode. Listen for NETDEV_CHANGEUPPER events in order to detect this. ice_esw_br data structure reflects the linux bridge and stores all the ports of the bridge (ice_esw_br_port) in xarray, it's created when the first port is added to the bridge and freed once the last port is removed. Note that only one bridge is supported per eswitch. Bridge port (ice_esw_br_port) can be either a VF port representor port or uplink port (ice_esw_br_port_type). In both cases bridge port holds a reference to the VSI, VF's VSI in case of the PR and uplink VSI in case of the uplink. VSI's index is used as an index to the xarray in which ports are stored. Add a check which prevents configuring switchdev mode if uplink is already added to any bridge. This is needed because we need to listen for NETDEV_CHANGEUPPER events to record if the uplink was added to the bridge. Netdevice notifier is registered after eswitch mode is changed to switchdev. Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
32 lines
877 B
C
32 lines
877 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) 2019-2021, Intel Corporation. */
|
|
|
|
#ifndef _ICE_REPR_H_
|
|
#define _ICE_REPR_H_
|
|
|
|
#include <net/dst_metadata.h>
|
|
|
|
struct ice_repr {
|
|
struct ice_vsi *src_vsi;
|
|
struct ice_vf *vf;
|
|
struct ice_q_vector *q_vector;
|
|
struct net_device *netdev;
|
|
struct metadata_dst *dst;
|
|
struct ice_esw_br_port *br_port;
|
|
#ifdef CONFIG_ICE_SWITCHDEV
|
|
/* info about slow path rule */
|
|
struct ice_rule_query_data sp_rule;
|
|
#endif
|
|
};
|
|
|
|
int ice_repr_add_for_all_vfs(struct ice_pf *pf);
|
|
void ice_repr_rem_from_all_vfs(struct ice_pf *pf);
|
|
|
|
void ice_repr_start_tx_queues(struct ice_repr *repr);
|
|
void ice_repr_stop_tx_queues(struct ice_repr *repr);
|
|
|
|
void ice_repr_set_traffic_vsi(struct ice_repr *repr, struct ice_vsi *vsi);
|
|
|
|
struct ice_repr *ice_netdev_to_repr(struct net_device *netdev);
|
|
bool ice_is_port_repr_netdev(const struct net_device *netdev);
|
|
#endif
|