aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorYuval Mintz <Yuval.Mintz@caviumnetworks.com>2016-10-01 14:59:55 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-03 23:22:46 -0400
commit0a7fb11c23c0fb8f5ad37f285f40348f1ab9ccbd (patch)
treebea79cf204080cbc89e454dd04a62c77e5a69036 /include/linux
parentb9118b7221ebb12156d2b08d4d5647bc6076d6bb (diff)
qed: Add Light L2 support
Other protocols beside the networking driver need the ability of passing some L2 traffic, usually [although not limited] for the purpose of some management traffic. Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com> Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/qed/qed_if.h1
-rw-r--r--include/linux/qed/qed_ll2_if.h139
2 files changed, 140 insertions, 0 deletions
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index e4546abcea08..c2d74e8785cf 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -627,6 +627,7 @@ enum DP_MODULE {
627 QED_MSG_SP = 0x100000, 627 QED_MSG_SP = 0x100000,
628 QED_MSG_STORAGE = 0x200000, 628 QED_MSG_STORAGE = 0x200000,
629 QED_MSG_CXT = 0x800000, 629 QED_MSG_CXT = 0x800000,
630 QED_MSG_LL2 = 0x1000000,
630 QED_MSG_ILT = 0x2000000, 631 QED_MSG_ILT = 0x2000000,
631 QED_MSG_ROCE = 0x4000000, 632 QED_MSG_ROCE = 0x4000000,
632 QED_MSG_DEBUG = 0x8000000, 633 QED_MSG_DEBUG = 0x8000000,
diff --git a/include/linux/qed/qed_ll2_if.h b/include/linux/qed/qed_ll2_if.h
new file mode 100644
index 000000000000..fd75c265dba3
--- /dev/null
+++ b/include/linux/qed/qed_ll2_if.h
@@ -0,0 +1,139 @@
1/* QLogic qed NIC Driver
2 *
3 * Copyright (c) 2015 QLogic Corporation
4 *
5 * This software is available under the terms of the GNU General Public License
6 * (GPL) Version 2, available from the file COPYING in the main directory of
7 * this source tree.
8 */
9
10#ifndef _QED_LL2_IF_H
11#define _QED_LL2_IF_H
12
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/netdevice.h>
16#include <linux/pci.h>
17#include <linux/skbuff.h>
18#include <linux/version.h>
19#include <linux/kernel.h>
20#include <linux/slab.h>
21#include <linux/qed/qed_if.h>
22
23struct qed_ll2_stats {
24 u64 gsi_invalid_hdr;
25 u64 gsi_invalid_pkt_length;
26 u64 gsi_unsupported_pkt_typ;
27 u64 gsi_crcchksm_error;
28
29 u64 packet_too_big_discard;
30 u64 no_buff_discard;
31
32 u64 rcv_ucast_bytes;
33 u64 rcv_mcast_bytes;
34 u64 rcv_bcast_bytes;
35 u64 rcv_ucast_pkts;
36 u64 rcv_mcast_pkts;
37 u64 rcv_bcast_pkts;
38
39 u64 sent_ucast_bytes;
40 u64 sent_mcast_bytes;
41 u64 sent_bcast_bytes;
42 u64 sent_ucast_pkts;
43 u64 sent_mcast_pkts;
44 u64 sent_bcast_pkts;
45};
46
47#define QED_LL2_UNUSED_HANDLE (0xff)
48
49struct qed_ll2_cb_ops {
50 int (*rx_cb)(void *, struct sk_buff *, u32, u32);
51 int (*tx_cb)(void *, struct sk_buff *, bool);
52};
53
54struct qed_ll2_params {
55 u16 mtu;
56 bool drop_ttl0_packets;
57 bool rx_vlan_stripping;
58 u8 tx_tc;
59 bool frags_mapped;
60 u8 ll2_mac_address[ETH_ALEN];
61};
62
63struct qed_ll2_ops {
64/**
65 * @brief start - initializes ll2
66 *
67 * @param cdev
68 * @param params - protocol driver configuration for the ll2.
69 *
70 * @return 0 on success, otherwise error value.
71 */
72 int (*start)(struct qed_dev *cdev, struct qed_ll2_params *params);
73
74/**
75 * @brief stop - stops the ll2
76 *
77 * @param cdev
78 *
79 * @return 0 on success, otherwise error value.
80 */
81 int (*stop)(struct qed_dev *cdev);
82
83/**
84 * @brief start_xmit - transmits an skb over the ll2 interface
85 *
86 * @param cdev
87 * @param skb
88 *
89 * @return 0 on success, otherwise error value.
90 */
91 int (*start_xmit)(struct qed_dev *cdev, struct sk_buff *skb);
92
93/**
94 * @brief register_cb_ops - protocol driver register the callback for Rx/Tx
95 * packets. Should be called before `start'.
96 *
97 * @param cdev
98 * @param cookie - to be passed to the callback functions.
99 * @param ops - the callback functions to register for Rx / Tx.
100 *
101 * @return 0 on success, otherwise error value.
102 */
103 void (*register_cb_ops)(struct qed_dev *cdev,
104 const struct qed_ll2_cb_ops *ops,
105 void *cookie);
106
107/**
108 * @brief get LL2 related statistics
109 *
110 * @param cdev
111 * @param stats - pointer to struct that would be filled with stats
112 *
113 * @return 0 on success, error otherwise.
114 */
115 int (*get_stats)(struct qed_dev *cdev, struct qed_ll2_stats *stats);
116};
117
118#ifdef CONFIG_QED_LL2
119int qed_ll2_alloc_if(struct qed_dev *);
120void qed_ll2_dealloc_if(struct qed_dev *);
121#else
122static const struct qed_ll2_ops qed_ll2_ops_pass = {
123 .start = NULL,
124 .stop = NULL,
125 .start_xmit = NULL,
126 .register_cb_ops = NULL,
127 .get_stats = NULL,
128};
129
130static inline int qed_ll2_alloc_if(struct qed_dev *cdev)
131{
132 return 0;
133}
134
135static inline void qed_ll2_dealloc_if(struct qed_dev *cdev)
136{
137}
138#endif
139#endif