Skip to content

Commit 6a345b3

Browse files
Kumar Sanghvidavem330
authored andcommitted
cxgb4: add tc flower offload skeleton
Add basic skeleton to prepare for offloading tc-flower flows. Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 52a59bd commit 6a345b3

File tree

4 files changed

+128
-1
lines changed

4 files changed

+128
-1
lines changed

drivers/net/ethernet/chelsio/cxgb4/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
66

7-
cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o cxgb4_ptp.o
7+
cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o \
8+
cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \
9+
cxgb4_ptp.o cxgb4_tc_flower.o
810
cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o
911
cxgb4-$(CONFIG_CHELSIO_T4_FCOE) += cxgb4_fcoe.o
1012
cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include "l2t.h"
8080
#include "sched.h"
8181
#include "cxgb4_tc_u32.h"
82+
#include "cxgb4_tc_flower.h"
8283
#include "cxgb4_ptp.h"
8384

8485
char cxgb4_driver_name[] = KBUILD_MODNAME;
@@ -2873,6 +2874,25 @@ static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
28732874
return err;
28742875
}
28752876

2877+
static int cxgb_setup_tc_flower(struct net_device *dev,
2878+
struct tc_cls_flower_offload *cls_flower)
2879+
{
2880+
if (!is_classid_clsact_ingress(cls_flower->common.classid) ||
2881+
cls_flower->common.chain_index)
2882+
return -EOPNOTSUPP;
2883+
2884+
switch (cls_flower->command) {
2885+
case TC_CLSFLOWER_REPLACE:
2886+
return cxgb4_tc_flower_replace(dev, cls_flower);
2887+
case TC_CLSFLOWER_DESTROY:
2888+
return cxgb4_tc_flower_destroy(dev, cls_flower);
2889+
case TC_CLSFLOWER_STATS:
2890+
return cxgb4_tc_flower_stats(dev, cls_flower);
2891+
default:
2892+
return -EOPNOTSUPP;
2893+
}
2894+
}
2895+
28762896
static int cxgb_setup_tc_cls_u32(struct net_device *dev,
28772897
struct tc_cls_u32_offload *cls_u32)
28782898
{
@@ -2907,6 +2927,8 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
29072927
switch (type) {
29082928
case TC_SETUP_CLSU32:
29092929
return cxgb_setup_tc_cls_u32(dev, type_data);
2930+
case TC_SETUP_CLSFLOWER:
2931+
return cxgb_setup_tc_flower(dev, type_data);
29102932
default:
29112933
return -EOPNOTSUPP;
29122934
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* This file is part of the Chelsio T4/T5/T6 Ethernet driver for Linux.
3+
*
4+
* Copyright (c) 2017 Chelsio Communications, Inc. All rights reserved.
5+
*
6+
* This software is available to you under a choice of one of two
7+
* licenses. You may choose to be licensed under the terms of the GNU
8+
* General Public License (GPL) Version 2, available from the file
9+
* COPYING in the main directory of this source tree, or the
10+
* OpenIB.org BSD license below:
11+
*
12+
* Redistribution and use in source and binary forms, with or
13+
* without modification, are permitted provided that the following
14+
* conditions are met:
15+
*
16+
* - Redistributions of source code must retain the above
17+
* copyright notice, this list of conditions and the following
18+
* disclaimer.
19+
*
20+
* - Redistributions in binary form must reproduce the above
21+
* copyright notice, this list of conditions and the following
22+
* disclaimer in the documentation and/or other materials
23+
* provided with the distribution.
24+
*
25+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32+
* SOFTWARE.
33+
*/
34+
35+
#include <net/tc_act/tc_gact.h>
36+
#include <net/tc_act/tc_mirred.h>
37+
38+
#include "cxgb4.h"
39+
#include "cxgb4_tc_flower.h"
40+
41+
int cxgb4_tc_flower_replace(struct net_device *dev,
42+
struct tc_cls_flower_offload *cls)
43+
{
44+
return -EOPNOTSUPP;
45+
}
46+
47+
int cxgb4_tc_flower_destroy(struct net_device *dev,
48+
struct tc_cls_flower_offload *cls)
49+
{
50+
return -EOPNOTSUPP;
51+
}
52+
53+
int cxgb4_tc_flower_stats(struct net_device *dev,
54+
struct tc_cls_flower_offload *cls)
55+
{
56+
return -EOPNOTSUPP;
57+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This file is part of the Chelsio T4/T5/T6 Ethernet driver for Linux.
3+
*
4+
* Copyright (c) 2017 Chelsio Communications, Inc. All rights reserved.
5+
*
6+
* This software is available to you under a choice of one of two
7+
* licenses. You may choose to be licensed under the terms of the GNU
8+
* General Public License (GPL) Version 2, available from the file
9+
* COPYING in the main directory of this source tree, or the
10+
* OpenIB.org BSD license below:
11+
*
12+
* Redistribution and use in source and binary forms, with or
13+
* without modification, are permitted provided that the following
14+
* conditions are met:
15+
*
16+
* - Redistributions of source code must retain the above
17+
* copyright notice, this list of conditions and the following
18+
* disclaimer.
19+
*
20+
* - Redistributions in binary form must reproduce the above
21+
* copyright notice, this list of conditions and the following
22+
* disclaimer in the documentation and/or other materials
23+
* provided with the distribution.
24+
*
25+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32+
* SOFTWARE.
33+
*/
34+
35+
#ifndef __CXGB4_TC_FLOWER_H
36+
#define __CXGB4_TC_FLOWER_H
37+
38+
#include <net/pkt_cls.h>
39+
40+
int cxgb4_tc_flower_replace(struct net_device *dev,
41+
struct tc_cls_flower_offload *cls);
42+
int cxgb4_tc_flower_destroy(struct net_device *dev,
43+
struct tc_cls_flower_offload *cls);
44+
int cxgb4_tc_flower_stats(struct net_device *dev,
45+
struct tc_cls_flower_offload *cls);
46+
#endif /* __CXGB4_TC_FLOWER_H */

0 commit comments

Comments
 (0)