2 * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
5 * Copyright (c) 2014, Cisco Systems, Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
43 /* Completion queue control */
45 u64 ring_base; /* 0x00 */
46 u32 ring_size; /* 0x08 */
48 u32 flow_control_enable; /* 0x10 */
50 u32 color_enable; /* 0x18 */
52 u32 cq_head; /* 0x20 */
54 u32 cq_tail; /* 0x28 */
56 u32 cq_tail_color; /* 0x30 */
58 u32 interrupt_enable; /* 0x38 */
60 u32 cq_entry_enable; /* 0x40 */
62 u32 cq_message_enable; /* 0x48 */
64 u32 interrupt_offset; /* 0x50 */
66 u64 cq_message_addr; /* 0x58 */
71 struct vnic_rx_bytes_counter {
72 unsigned int small_pkt_bytes_cnt;
73 unsigned int large_pkt_bytes_cnt;
79 struct vnic_dev *vdev;
80 struct vnic_cq_ctrl __iomem *ctrl; /* memory-mapped */
81 struct vnic_dev_ring ring;
82 unsigned int to_clean;
83 unsigned int last_color;
84 unsigned int interrupt_offset;
86 struct vnic_rx_bytes_counter pkt_size_counter;
87 unsigned int cur_rx_coal_timeval;
88 unsigned int tobe_rx_coal_timeval;
93 void vnic_cq_free(struct vnic_cq *cq);
94 int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index,
95 unsigned int socket_id,
96 unsigned int desc_count, unsigned int desc_size);
97 void vnic_cq_init(struct vnic_cq *cq, unsigned int flow_control_enable,
98 unsigned int color_enable, unsigned int cq_head, unsigned int cq_tail,
99 unsigned int cq_tail_color, unsigned int interrupt_enable,
100 unsigned int cq_entry_enable, unsigned int message_enable,
101 unsigned int interrupt_offset, u64 message_addr);
102 void vnic_cq_clean(struct vnic_cq *cq);
103 int vnic_cq_mem_size(struct vnic_cq *cq, unsigned int desc_count,
104 unsigned int desc_size);
106 #endif /* _VNIC_CQ_H_ */