Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
t4_msg.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Chelsio T4 Ethernet driver for Linux.
3  *
4  * Copyright (c) 2003-2010 Chelsio Communications, Inc. All rights reserved.
5  *
6  * This software is available to you under a choice of one of two
7  * licenses. You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenIB.org BSD license below:
11  *
12  * Redistribution and use in source and binary forms, with or
13  * without modification, are permitted provided that the following
14  * conditions are met:
15  *
16  * - Redistributions of source code must retain the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer.
19  *
20  * - Redistributions in binary form must reproduce the above
21  * copyright notice, this list of conditions and the following
22  * disclaimer in the documentation and/or other materials
23  * provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  */
34 
35 #ifndef __T4_MSG_H
36 #define __T4_MSG_H
37 
38 #include <linux/types.h>
39 
40 enum {
45  CPL_GET_TCB = 0x6,
51  CPL_TX_PKT = 0xE,
54 
62 
64  CPL_ISCSI_HDR = 0x33,
65  CPL_RDMA_CQE = 0x35,
68  CPL_RX_DATA = 0x39,
70  CPL_RX_PKT = 0x3B,
72 
77 
79 
82 
86 
87  CPL_TRACE_PKT = 0xB0,
88 
89  CPL_FW4_MSG = 0xC0,
90  CPL_FW4_PLD = 0xC1,
91  CPL_FW4_ACK = 0xC3,
92 
93  CPL_FW6_MSG = 0xE0,
94  CPL_FW6_PLD = 0xE1,
96  CPL_TX_PKT_XT = 0xEE,
97 
99 };
100 
101 enum CPL_error {
120 };
121 
122 enum {
128 };
129 
130 enum {
131  ULP_CRC_HEADER = 1 << 0,
132  ULP_CRC_DATA = 1 << 1
133 };
134 
135 enum {
138 };
139 
140 enum { /* TX_PKT_XT checksum types */
152 };
153 
154 union opcode_tid {
156  u8 opcode;
157 };
158 
159 #define CPL_OPCODE(x) ((x) << 24)
160 #define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE(opcode) | (tid))
161 #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
162 #define GET_TID(cmd) (ntohl(OPCODE_TID(cmd)) & 0xFFFFFF)
163 
164 /* partitioning of TID fields that also carry a queue id */
165 #define GET_TID_TID(x) ((x) & 0x3fff)
166 #define GET_TID_QID(x) (((x) >> 14) & 0x3ff)
167 #define TID_QID(x) ((x) << 14)
168 
169 struct rss_header {
171 #if defined(__LITTLE_ENDIAN_BITFIELD)
172  u8 channel:2;
173  u8 filter_hit:1;
174  u8 filter_tid:1;
175  u8 hash_type:2;
176  u8 ipv6:1;
177  u8 send2fw:1;
178 #else
180  u8 ipv6:1;
185 #endif
188 };
189 
190 struct work_request_hdr {
191  __be32 wr_hi;
194 };
195 
196 #define WR_HDR struct work_request_hdr wr
197 
198 struct cpl_pass_open_req {
199  WR_HDR;
200  union opcode_tid ot;
204  __be32 peer_ip;
206 #define TX_CHAN(x) ((x) << 2)
207 #define DELACK(x) ((x) << 5)
208 #define ULP_MODE(x) ((x) << 8)
209 #define RCV_BUFSIZ(x) ((x) << 12)
210 #define DSCP(x) ((x) << 22)
211 #define SMAC_SEL(x) ((u64)(x) << 28)
212 #define L2T_IDX(x) ((u64)(x) << 36)
213 #define NAGLE(x) ((u64)(x) << 49)
214 #define WND_SCALE(x) ((u64)(x) << 50)
215 #define KEEP_ALIVE(x) ((u64)(x) << 54)
216 #define MSS_IDX(x) ((u64)(x) << 60)
218 #define SYN_RSS_ENABLE (1 << 0)
219 #define SYN_RSS_QUEUE(x) ((x) << 2)
220 #define CONN_POLICY_ASK (1 << 22)
221 };
222 
225  union opcode_tid ot;
234 };
235 
236 struct cpl_pass_open_rpl {
237  union opcode_tid ot;
238  u8 rsvd[3];
239  u8 status;
240 };
241 
242 struct cpl_pass_accept_rpl {
243  WR_HDR;
244  union opcode_tid ot;
245  __be32 opt2;
246 #define RSS_QUEUE(x) ((x) << 0)
247 #define RSS_QUEUE_VALID (1 << 10)
248 #define RX_COALESCE_VALID(x) ((x) << 11)
249 #define RX_COALESCE(x) ((x) << 12)
250 #define TX_QUEUE(x) ((x) << 23)
251 #define RX_CHANNEL(x) ((x) << 26)
252 #define WND_SCALE_EN(x) ((x) << 28)
253 #define TSTAMPS_EN(x) ((x) << 29)
254 #define SACK_EN(x) ((x) << 30)
256 };
257 
258 struct cpl_act_open_req {
259  WR_HDR;
260  union opcode_tid ot;
264  __be32 peer_ip;
266  __be32 params;
267  __be32 opt2;
268 };
269 
272  union opcode_tid ot;
282 };
283 
284 struct cpl_act_open_rpl {
285  union opcode_tid ot;
287 #define GET_AOPEN_STATUS(x) ((x) & 0xff)
288 #define GET_AOPEN_ATID(x) (((x) >> 8) & 0xffffff)
289 };
290 
291 struct cpl_pass_establish {
292  union opcode_tid ot;
295 #define GET_POPEN_TID(x) ((x) & 0xffffff)
296 #define GET_POPEN_TOS(x) (((x) >> 24) & 0xff)
298  __be16 tcp_opt;
299 #define GET_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
300 #define GET_TCPOPT_SACK(x) (((x) >> 6) & 1)
301 #define GET_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
302 #define GET_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
303 #define GET_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
304  __be32 snd_isn;
305  __be32 rcv_isn;
306 };
307 
308 struct cpl_act_establish {
309  union opcode_tid ot;
313  __be16 tcp_opt;
314  __be32 snd_isn;
315  __be32 rcv_isn;
316 };
317 
318 struct cpl_get_tcb {
319  WR_HDR;
320  union opcode_tid ot;
322 #define QUEUENO(x) ((x) << 0)
323 #define REPLY_CHAN(x) ((x) << 14)
324 #define NO_REPLY(x) ((x) << 15)
326 };
327 
328 struct cpl_set_tcb_field {
329  WR_HDR;
330  union opcode_tid ot;
333 #define TCB_WORD(x) ((x) << 0)
334 #define TCB_COOKIE(x) ((x) << 5)
335  __be64 mask;
336  __be64 val;
337 };
338 
339 struct cpl_set_tcb_rpl {
340  union opcode_tid ot;
343  u8 status;
345 };
346 
347 struct cpl_close_con_req {
348  WR_HDR;
349  union opcode_tid ot;
350  __be32 rsvd;
351 };
352 
353 struct cpl_close_con_rpl {
354  union opcode_tid ot;
355  u8 rsvd[3];
356  u8 status;
357  __be32 snd_nxt;
358  __be32 rcv_nxt;
359 };
360 
363  union opcode_tid ot;
365 #define LISTSVR_IPV6 (1 << 14)
367 };
368 
370  union opcode_tid ot;
371  u8 rsvd[3];
373 };
374 
375 struct cpl_abort_req_rss {
376  union opcode_tid ot;
377  u8 rsvd[3];
379 };
380 
381 struct cpl_abort_req {
382  WR_HDR;
383  union opcode_tid ot;
384  __be32 rsvd0;
385  u8 rsvd1;
386  u8 cmd;
387  u8 rsvd2[6];
388 };
389 
390 struct cpl_abort_rpl_rss {
391  union opcode_tid ot;
392  u8 rsvd[3];
394 };
395 
396 struct cpl_abort_rpl {
397  WR_HDR;
398  union opcode_tid ot;
399  __be32 rsvd0;
400  u8 rsvd1;
402  u8 rsvd2[6];
403 };
404 
405 struct cpl_peer_close {
406  union opcode_tid ot;
407  __be32 rcv_nxt;
408 };
409 
410 struct cpl_tid_release {
411  WR_HDR;
412  union opcode_tid ot;
413  __be32 rsvd;
414 };
415 
418 #define TXPKT_VF(x) ((x) << 0)
419 #define TXPKT_PF(x) ((x) << 8)
420 #define TXPKT_VF_VLD (1 << 11)
421 #define TXPKT_OVLAN_IDX(x) ((x) << 12)
422 #define TXPKT_INTF(x) ((x) << 16)
423 #define TXPKT_INS_OVLAN (1 << 21)
424 #define TXPKT_OPCODE(x) ((x) << 24)
428 #define TXPKT_CSUM_END(x) ((x) << 12)
429 #define TXPKT_CSUM_START(x) ((x) << 20)
430 #define TXPKT_IPHDR_LEN(x) ((u64)(x) << 20)
431 #define TXPKT_CSUM_LOC(x) ((u64)(x) << 30)
432 #define TXPKT_ETHHDR_LEN(x) ((u64)(x) << 34)
433 #define TXPKT_CSUM_TYPE(x) ((u64)(x) << 40)
434 #define TXPKT_VLAN(x) ((u64)(x) << 44)
435 #define TXPKT_VLAN_VLD (1ULL << 60)
436 #define TXPKT_IPCSUM_DIS (1ULL << 62)
437 #define TXPKT_L4CSUM_DIS (1ULL << 63)
438 };
439 
440 struct cpl_tx_pkt {
441  WR_HDR;
443 };
444 
445 #define cpl_tx_pkt_xt cpl_tx_pkt
446 
449 #define LSO_TCPHDR_LEN(x) ((x) << 0)
450 #define LSO_IPHDR_LEN(x) ((x) << 4)
451 #define LSO_ETHHDR_LEN(x) ((x) << 16)
452 #define LSO_IPV6(x) ((x) << 20)
453 #define LSO_LAST_SLICE (1 << 22)
454 #define LSO_FIRST_SLICE (1 << 23)
455 #define LSO_OPCODE(x) ((x) << 24)
460  /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
461 };
462 
463 struct cpl_tx_pkt_lso {
464  WR_HDR;
466  /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
467 };
468 
469 struct cpl_iscsi_hdr {
470  union opcode_tid ot;
472 #define ISCSI_PDU_LEN(x) ((x) & 0x7FFF)
473 #define ISCSI_DDP (1 << 15)
474  __be16 len;
475  __be32 seq;
476  __be16 urg;
479 };
480 
481 struct cpl_rx_data {
482  union opcode_tid ot;
483  __be16 rsvd;
484  __be16 len;
485  __be32 seq;
486  __be16 urg;
487 #if defined(__LITTLE_ENDIAN_BITFIELD)
488  u8 dack_mode:2;
489  u8 psh:1;
490  u8 heartbeat:1;
491  u8 ddp_off:1;
492  u8 :3;
493 #else
494  u8 :3;
497  u8 psh:1;
499 #endif
500  u8 status;
501 };
502 
503 struct cpl_rx_data_ack {
504  WR_HDR;
505  union opcode_tid ot;
507 #define RX_CREDITS(x) ((x) << 0)
508 #define RX_FORCE_ACK(x) ((x) << 28)
509 };
510 
511 struct cpl_rx_pkt {
513  u8 opcode;
514 #if defined(__LITTLE_ENDIAN_BITFIELD)
515  u8 iff:4;
516  u8 csum_calc:1;
517  u8 ipmi_pkt:1;
518  u8 vlan_ex:1;
519  u8 ip_frag:1;
520 #else
525  u8 iff:4;
526 #endif
527  __be16 csum;
528  __be16 vlan;
529  __be16 len;
531 #define RXF_UDP (1 << 22)
532 #define RXF_TCP (1 << 23)
533 #define RXF_IP (1 << 24)
534 #define RXF_IP6 (1 << 25)
537 };
538 
539 struct cpl_trace_pkt {
542 #if defined(__LITTLE_ENDIAN_BITFIELD)
543  u8 runt:4;
544  u8 filter_hit:4;
545  u8 :6;
546  u8 err:1;
547  u8 trunc:1;
548 #else
550  u8 runt:4;
552  u8 err:1;
553  u8 :6;
554 #endif
556  __be16 len;
558 };
559 
560 struct cpl_l2t_write_req {
561  WR_HDR;
562  union opcode_tid ot;
564 #define L2T_W_INFO(x) ((x) << 2)
565 #define L2T_W_PORT(x) ((x) << 8)
566 #define L2T_W_NOREPLY(x) ((x) << 15)
569  u8 dst_mac[6];
570 };
571 
572 struct cpl_l2t_write_rpl {
573  union opcode_tid ot;
574  u8 status;
575  u8 rsvd[3];
576 };
577 
578 struct cpl_rdma_terminate {
579  union opcode_tid ot;
582 };
583 
586 #define EGR_QID(x) ((x) & 0x1FFFF)
589 };
590 
591 struct cpl_fw4_pld {
593  u8 rsvd0[3];
599 };
600 
601 struct cpl_fw6_pld {
603  u8 rsvd[5];
606 };
607 
608 struct cpl_fw4_msg {
614 };
615 
616 struct cpl_fw4_ack {
617  union opcode_tid ot;
619  u8 rsvd0[2];
624 };
625 
626 struct cpl_fw6_msg {
632 };
633 
634 /* cpl_fw6_msg.type values */
635 enum {
637 };
638 
639 enum {
643 };
644 
645 enum {
650 };
651 
655 };
656 
657 struct ulptx_sgl {
659 #define ULPTX_CMD(x) ((x) << 24)
660 #define ULPTX_NSGE(x) ((x) << 0)
663  struct ulptx_sge_pair sge[0];
664 };
665 
666 struct ulp_mem_io {
667  WR_HDR;
669 #define ULP_MEMIO_ORDER(x) ((x) << 23)
670  __be32 len16; /* command length */
671  __be32 dlen; /* data length in 32-byte units */
672 #define ULP_MEMIO_DATA_LEN(x) ((x) << 0)
674 #define ULP_MEMIO_ADDR(x) ((x) << 0)
675 #define ULP_MEMIO_LOCK(x) ((x) << 31)
676 };
677 
678 #endif /* __T4_MSG_H */