Skip to content

Commit 230ead0

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
mlxsw: spectrum: Add placeholder for dpipe
Add placeholder for dpipe. Support for specific tables and headers will be introduced in following patches. The headers are shared between all mlxsw_sp instances. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0f630fc commit 230ead0

4 files changed

Lines changed: 109 additions & 1 deletion

File tree

‎drivers/net/ethernet/mellanox/mlxsw/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mlxsw_spectrum-objs := spectrum.o spectrum_buffers.o \
1616
spectrum_switchdev.o spectrum_router.o \
1717
spectrum_kvdl.o spectrum_acl_tcam.o \
1818
spectrum_acl.o spectrum_flower.o \
19-
spectrum_cnt.o
19+
spectrum_cnt.o spectrum_dpipe.o
2020
mlxsw_spectrum-$(CONFIG_MLXSW_SPECTRUM_DCB) += spectrum_dcb.o
2121
obj-$(CONFIG_MLXSW_MINIMAL) += mlxsw_minimal.o
2222
mlxsw_minimal-objs := minimal.o

‎drivers/net/ethernet/mellanox/mlxsw/spectrum.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include "trap.h"
6868
#include "txheader.h"
6969
#include "spectrum_cnt.h"
70+
#include "spectrum_dpipe.h"
7071

7172
static const char mlxsw_sp_driver_name[] = "mlxsw_spectrum";
7273
static const char mlxsw_sp_driver_version[] = "1.0";
@@ -3339,6 +3340,12 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core,
33393340
goto err_counter_pool_init;
33403341
}
33413342

3343+
err = mlxsw_sp_dpipe_init(mlxsw_sp);
3344+
if (err) {
3345+
dev_err(mlxsw_sp->bus_info->dev, "Failed to init pipeline debug\n");
3346+
goto err_dpipe_init;
3347+
}
3348+
33423349
err = mlxsw_sp_ports_create(mlxsw_sp);
33433350
if (err) {
33443351
dev_err(mlxsw_sp->bus_info->dev, "Failed to create ports\n");
@@ -3348,6 +3355,8 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core,
33483355
return 0;
33493356

33503357
err_ports_create:
3358+
mlxsw_sp_dpipe_fini(mlxsw_sp);
3359+
err_dpipe_init:
33513360
mlxsw_sp_counter_pool_fini(mlxsw_sp);
33523361
err_counter_pool_init:
33533362
mlxsw_sp_acl_fini(mlxsw_sp);
@@ -3372,6 +3381,7 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
33723381
struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
33733382

33743383
mlxsw_sp_ports_remove(mlxsw_sp);
3384+
mlxsw_sp_dpipe_fini(mlxsw_sp);
33753385
mlxsw_sp_counter_pool_fini(mlxsw_sp);
33763386
mlxsw_sp_acl_fini(mlxsw_sp);
33773387
mlxsw_sp_span_fini(mlxsw_sp);
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c
3+
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
4+
* Copyright (c) 2017 Arkadi Sharshevsky <arakdis@mellanox.com>
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* 3. Neither the names of the copyright holders nor the names of its
15+
* contributors may be used to endorse or promote products derived from
16+
* this software without specific prior written permission.
17+
*
18+
* Alternatively, this software may be distributed under the terms of the
19+
* GNU General Public License ("GPL") version 2 as published by the Free
20+
* Software Foundation.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
* POSSIBILITY OF SUCH DAMAGE.
33+
*/
34+
35+
#include <linux/kernel.h>
36+
#include <net/devlink.h>
37+
38+
#include "spectrum.h"
39+
#include "spectrum_dpipe.h"
40+
41+
static struct devlink_dpipe_header *mlxsw_dpipe_headers[] = {};
42+
43+
static struct devlink_dpipe_headers mlxsw_sp_dpipe_headers = {
44+
.headers = mlxsw_dpipe_headers,
45+
.headers_count = ARRAY_SIZE(mlxsw_dpipe_headers),
46+
};
47+
48+
int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp)
49+
{
50+
return devlink_dpipe_headers_register(priv_to_devlink(mlxsw_sp->core),
51+
&mlxsw_sp_dpipe_headers);
52+
}
53+
54+
void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp)
55+
{
56+
devlink_dpipe_headers_unregister(priv_to_devlink(mlxsw_sp->core));
57+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.h
3+
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
4+
* Copyright (c) 2017 Arkadi Sharshevsky <arkadis@mellanox.com>
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* 3. Neither the names of the copyright holders nor the names of its
15+
* contributors may be used to endorse or promote products derived from
16+
* this software without specific prior written permission.
17+
*
18+
* Alternatively, this software may be distributed under the terms of the
19+
* GNU General Public License ("GPL") version 2 as published by the Free
20+
* Software Foundation.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
* POSSIBILITY OF SUCH DAMAGE.
33+
*/
34+
35+
#ifndef _MLXSW_PIPELINE_H_
36+
#define _MLXSW_PIPELINE_H_
37+
38+
int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp);
39+
void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp);
40+
41+
#endif /* _MLXSW_PIPELINE_H_*/

0 commit comments

Comments
 (0)