-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: microchip: sparx5: Adding initial VCAP API support
This provides the initial VCAP API framework and Sparx5 specific VCAP implementation. When the Sparx5 Switchdev driver is initialized it will also initialize its VCAP module, and this hooks up the concrete Sparx5 VCAP model to the VCAP API, so that the VCAP API knows what VCAP instances are available. Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Steen Hegelund
authored and
David S. Miller
committed
Oct 24, 2022
1 parent
abc2109
commit 8beef08
Showing
10 changed files
with
699 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* Microchip Sparx5 Switch driver VCAP implementation | ||
* | ||
* Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries. | ||
* | ||
* The Sparx5 Chip Register Model can be browsed at this location: | ||
* https://github.com/microchip-ung/sparx-5_reginfo | ||
*/ | ||
|
||
#include <linux/types.h> | ||
#include <linux/list.h> | ||
|
||
#include "vcap_api.h" | ||
#include "sparx5_main_regs.h" | ||
#include "sparx5_main.h" | ||
|
||
/* Allocate a vcap control and vcap instances and configure the system */ | ||
int sparx5_vcap_init(struct sparx5 *sparx5) | ||
{ | ||
struct vcap_control *ctrl; | ||
|
||
/* Create a VCAP control instance that owns the platform specific VCAP | ||
* model with VCAP instances and information about keysets, keys, | ||
* actionsets and actions | ||
*/ | ||
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | ||
if (!ctrl) | ||
return -ENOMEM; | ||
|
||
sparx5->vcap_ctrl = ctrl; | ||
|
||
return 0; | ||
} | ||
|
||
void sparx5_vcap_destroy(struct sparx5 *sparx5) | ||
{ | ||
if (!sparx5->vcap_ctrl) | ||
return; | ||
|
||
kfree(sparx5->vcap_ctrl); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# | ||
# Microchip VCAP API configuration | ||
# | ||
|
||
if NET_VENDOR_MICROCHIP | ||
|
||
config VCAP | ||
bool "VCAP (Versatile Content-Aware Processor) library" | ||
help | ||
Provides the basic VCAP functionality for multiple Microchip switchcores | ||
|
||
A VCAP is essentially a TCAM with rules consisting of | ||
|
||
- Programmable key fields | ||
- Programmable action fields | ||
- A counter (which may be only one bit wide) | ||
|
||
Besides this each VCAP has: | ||
|
||
- A number of lookups | ||
- A keyset configuration per port per lookup | ||
|
||
The VCAP implementation provides switchcore independent handling of rules | ||
and supports: | ||
|
||
- Creating and deleting rules | ||
- Updating and getting rules | ||
|
||
The platform specific configuration as well as the platform specific model | ||
of the VCAP instances are attached to the VCAP API and a client can then | ||
access rules via the API in a platform independent way, with the | ||
limitations that each VCAP has in terms of its supported keys and actions. | ||
|
||
Different switchcores will have different VCAP instances with different | ||
characteristics. Look in the datasheet for the VCAP specifications for the | ||
specific switchcore. | ||
|
||
endif # NET_VENDOR_MICROCHIP |
Oops, something went wrong.