xref: /openbmc/linux/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h (revision cf40a76e7d5874bb25f4404eecc58a2e033af885)
1d8931847SRahul Lakkireddy /*
2d8931847SRahul Lakkireddy  * This file is part of the Chelsio T4 Ethernet driver for Linux.
3d8931847SRahul Lakkireddy  *
4d8931847SRahul Lakkireddy  * Copyright (c) 2016 Chelsio Communications, Inc. All rights reserved.
5d8931847SRahul Lakkireddy  *
6d8931847SRahul Lakkireddy  * This software is available to you under a choice of one of two
7d8931847SRahul Lakkireddy  * licenses.  You may choose to be licensed under the terms of the GNU
8d8931847SRahul Lakkireddy  * General Public License (GPL) Version 2, available from the file
9d8931847SRahul Lakkireddy  * COPYING in the main directory of this source tree, or the
10d8931847SRahul Lakkireddy  * OpenIB.org BSD license below:
11d8931847SRahul Lakkireddy  *
12d8931847SRahul Lakkireddy  *     Redistribution and use in source and binary forms, with or
13d8931847SRahul Lakkireddy  *     without modification, are permitted provided that the following
14d8931847SRahul Lakkireddy  *     conditions are met:
15d8931847SRahul Lakkireddy  *
16d8931847SRahul Lakkireddy  *      - Redistributions of source code must retain the above
17d8931847SRahul Lakkireddy  *        copyright notice, this list of conditions and the following
18d8931847SRahul Lakkireddy  *        disclaimer.
19d8931847SRahul Lakkireddy  *
20d8931847SRahul Lakkireddy  *      - Redistributions in binary form must reproduce the above
21d8931847SRahul Lakkireddy  *        copyright notice, this list of conditions and the following
22d8931847SRahul Lakkireddy  *        disclaimer in the documentation and/or other materials
23d8931847SRahul Lakkireddy  *        provided with the distribution.
24d8931847SRahul Lakkireddy  *
25d8931847SRahul Lakkireddy  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26d8931847SRahul Lakkireddy  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27d8931847SRahul Lakkireddy  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28d8931847SRahul Lakkireddy  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29d8931847SRahul Lakkireddy  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30d8931847SRahul Lakkireddy  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31d8931847SRahul Lakkireddy  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32d8931847SRahul Lakkireddy  * SOFTWARE.
33d8931847SRahul Lakkireddy  */
34d8931847SRahul Lakkireddy 
35d8931847SRahul Lakkireddy #ifndef __CXGB4_TC_U32_H
36d8931847SRahul Lakkireddy #define __CXGB4_TC_U32_H
37d8931847SRahul Lakkireddy 
38d8931847SRahul Lakkireddy #include <net/pkt_cls.h>
39d8931847SRahul Lakkireddy 
can_tc_u32_offload(struct net_device * dev)40d8931847SRahul Lakkireddy static inline bool can_tc_u32_offload(struct net_device *dev)
41d8931847SRahul Lakkireddy {
42d8931847SRahul Lakkireddy 	struct adapter *adap = netdev2adap(dev);
43d8931847SRahul Lakkireddy 
44d8931847SRahul Lakkireddy 	return (dev->features & NETIF_F_HW_TC) && adap->tc_u32 ? true : false;
45d8931847SRahul Lakkireddy }
46d8931847SRahul Lakkireddy 
47*5fd9fc4eSJiri Pirko int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls);
48*5fd9fc4eSJiri Pirko int cxgb4_delete_knode(struct net_device *dev, struct tc_cls_u32_offload *cls);
49d8931847SRahul Lakkireddy 
50d8931847SRahul Lakkireddy void cxgb4_cleanup_tc_u32(struct adapter *adapter);
5145da1ca2SArjun V struct cxgb4_tc_u32_table *cxgb4_init_tc_u32(struct adapter *adap);
52d8931847SRahul Lakkireddy #endif /* __CXGB4_TC_U32_H */
53