Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.9-rc1 139 lines 3.0 kB view raw
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