1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*****************************************************************************
3  *                                                                           *
4  * File: sge.h                                                               *
5  * $Revision: 1.11 $                                                          *
6  * $Date: 2005/06/21 22:10:55 $                                              *
7  * Description:                                                              *
8  *  part of the Chelsio 10Gb Ethernet Driver.                                *
9  *                                                                           *
10  *                                                                           *
11  * http://www.chelsio.com                                                    *
12  *                                                                           *
13  * Copyright (c) 2003 - 2005 Chelsio Communications, Inc.                    *
14  * All rights reserved.                                                      *
15  *                                                                           *
16  * Maintainers: maintainers@chelsio.com                                      *
17  *                                                                           *
18  * Authors: Dimitrios Michailidis   <dm@chelsio.com>                         *
19  *          Tina Yang               <tainay@chelsio.com>                     *
20  *          Felix Marti             <felix@chelsio.com>                      *
21  *          Scott Bardone           <sbardone@chelsio.com>                   *
22  *          Kurt Ottaway            <kottaway@chelsio.com>                   *
23  *          Frank DiMambro          <frank@chelsio.com>                      *
24  *                                                                           *
25  * History:                                                                  *
26  *                                                                           *
27  ****************************************************************************/
28 
29 #ifndef _CXGB_SGE_H_
30 #define _CXGB_SGE_H_
31 
32 #include <linux/types.h>
33 #include <linux/interrupt.h>
34 #include <asm/byteorder.h>
35 
36 struct sge_intr_counts {
37 	unsigned int rx_drops;        /* # of packets dropped due to no mem */
38 	unsigned int pure_rsps;        /* # of non-payload responses */
39 	unsigned int unhandled_irqs;   /* # of unhandled interrupts */
40 	unsigned int respQ_empty;      /* # times respQ empty */
41 	unsigned int respQ_overflow;   /* # respQ overflow (fatal) */
42 	unsigned int freelistQ_empty;  /* # times freelist empty */
43 	unsigned int pkt_too_big;      /* packet too large (fatal) */
44 	unsigned int pkt_mismatch;
45 	unsigned int cmdQ_full[3];     /* not HW IRQ, host cmdQ[] full */
46 	unsigned int cmdQ_restarted[3];/* # of times cmdQ X was restarted */
47 };
48 
49 struct sge_port_stats {
50 	u64 rx_cso_good;     /* # of successful RX csum offloads */
51 	u64 tx_cso;          /* # of TX checksum offloads */
52 	u64 tx_tso;          /* # of TSO requests */
53 	u64 vlan_xtract;     /* # of VLAN tag extractions */
54 	u64 vlan_insert;     /* # of VLAN tag insertions */
55 	u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */
56 };
57 
58 struct sk_buff;
59 struct net_device;
60 struct adapter;
61 struct sge_params;
62 struct sge;
63 
64 struct sge *t1_sge_create(struct adapter *, struct sge_params *);
65 int t1_sge_configure(struct sge *, struct sge_params *);
66 int t1_sge_set_coalesce_params(struct sge *, struct sge_params *);
67 void t1_sge_destroy(struct sge *);
68 irqreturn_t t1_interrupt_thread(int irq, void *data);
69 irqreturn_t t1_interrupt(int irq, void *cookie);
70 int t1_poll(struct napi_struct *, int);
71 
72 netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev);
73 void t1_vlan_mode(struct adapter *adapter, netdev_features_t features);
74 void t1_sge_start(struct sge *);
75 void t1_sge_stop(struct sge *);
76 bool t1_sge_intr_error_handler(struct sge *sge);
77 void t1_sge_intr_enable(struct sge *);
78 void t1_sge_intr_disable(struct sge *);
79 void t1_sge_intr_clear(struct sge *);
80 const struct sge_intr_counts *t1_sge_get_intr_counts(const struct sge *sge);
81 void t1_sge_get_port_stats(const struct sge *sge, int port, struct sge_port_stats *);
82 unsigned int t1_sched_update_parms(struct sge *, unsigned int, unsigned int,
83 			   unsigned int);
84 
85 #endif /* _CXGB_SGE_H_ */
86