2 * Copyright (c) 2006-2008 Chelsio, Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 #include <linux/list.h>
34 #include <net/neighbour.h>
35 #include <linux/notifier.h>
36 #include <asm/atomic.h>
37 #include <linux/proc_fs.h>
38 #include <linux/if_vlan.h>
39 #include <net/netevent.h>
40 #include <linux/highmem.h>
41 #include <linux/vmalloc.h>
45 #include "cxgb3_ioctl.h"
46 #include "cxgb3_ctl_defs.h"
47 #include "cxgb3_defs.h"
49 #include "firmware_exports.h"
50 #include "cxgb3_offload.h"
52 static LIST_HEAD(client_list
);
53 static LIST_HEAD(ofld_dev_list
);
54 static DEFINE_MUTEX(cxgb3_db_lock
);
56 static DEFINE_RWLOCK(adapter_list_lock
);
57 static LIST_HEAD(adapter_list
);
59 static const unsigned int MAX_ATIDS
= 64 * 1024;
60 static const unsigned int ATID_BASE
= 0x10000;
62 static inline int offload_activated(struct t3cdev
*tdev
)
64 const struct adapter
*adapter
= tdev2adap(tdev
);
66 return (test_bit(OFFLOAD_DEVMAP_BIT
, &adapter
->open_device_map
));
70 * cxgb3_register_client - register an offload client
73 * Add the client to the client list,
74 * and call backs the client for each activated offload device
76 void cxgb3_register_client(struct cxgb3_client
*client
)
80 mutex_lock(&cxgb3_db_lock
);
81 list_add_tail(&client
->client_list
, &client_list
);
84 list_for_each_entry(tdev
, &ofld_dev_list
, ofld_dev_list
) {
85 if (offload_activated(tdev
))
89 mutex_unlock(&cxgb3_db_lock
);
92 EXPORT_SYMBOL(cxgb3_register_client
);
95 * cxgb3_unregister_client - unregister an offload client
98 * Remove the client to the client list,
99 * and call backs the client for each activated offload device.
101 void cxgb3_unregister_client(struct cxgb3_client
*client
)
105 mutex_lock(&cxgb3_db_lock
);
106 list_del(&client
->client_list
);
108 if (client
->remove
) {
109 list_for_each_entry(tdev
, &ofld_dev_list
, ofld_dev_list
) {
110 if (offload_activated(tdev
))
111 client
->remove(tdev
);
114 mutex_unlock(&cxgb3_db_lock
);
117 EXPORT_SYMBOL(cxgb3_unregister_client
);
120 * cxgb3_add_clients - activate registered clients for an offload device
121 * @tdev: the offload device
123 * Call backs all registered clients once a offload device is activated
125 void cxgb3_add_clients(struct t3cdev
*tdev
)
127 struct cxgb3_client
*client
;
129 mutex_lock(&cxgb3_db_lock
);
130 list_for_each_entry(client
, &client_list
, client_list
) {
134 mutex_unlock(&cxgb3_db_lock
);
138 * cxgb3_remove_clients - deactivates registered clients
139 * for an offload device
140 * @tdev: the offload device
142 * Call backs all registered clients once a offload device is deactivated
144 void cxgb3_remove_clients(struct t3cdev
*tdev
)
146 struct cxgb3_client
*client
;
148 mutex_lock(&cxgb3_db_lock
);
149 list_for_each_entry(client
, &client_list
, client_list
) {
151 client
->remove(tdev
);
153 mutex_unlock(&cxgb3_db_lock
);
156 void cxgb3_err_notify(struct t3cdev
*tdev
, u32 status
, u32 error
)
158 struct cxgb3_client
*client
;
160 mutex_lock(&cxgb3_db_lock
);
161 list_for_each_entry(client
, &client_list
, client_list
) {
162 if (client
->err_handler
)
163 client
->err_handler(tdev
, status
, error
);
165 mutex_unlock(&cxgb3_db_lock
);
168 static struct net_device
*get_iff_from_mac(struct adapter
*adapter
,
169 const unsigned char *mac
,
174 for_each_port(adapter
, i
) {
175 struct vlan_group
*grp
;
176 struct net_device
*dev
= adapter
->port
[i
];
177 const struct port_info
*p
= netdev_priv(dev
);
179 if (!memcmp(dev
->dev_addr
, mac
, ETH_ALEN
)) {
180 if (vlan
&& vlan
!= VLAN_VID_MASK
) {
184 dev
= vlan_group_get_device(grp
, vlan
);
194 static int cxgb_ulp_iscsi_ctl(struct adapter
*adapter
, unsigned int req
,
199 unsigned int val
= 0;
200 struct ulp_iscsi_info
*uiip
= data
;
203 case ULP_ISCSI_GET_PARAMS
:
204 uiip
->pdev
= adapter
->pdev
;
205 uiip
->llimit
= t3_read_reg(adapter
, A_ULPRX_ISCSI_LLIMIT
);
206 uiip
->ulimit
= t3_read_reg(adapter
, A_ULPRX_ISCSI_ULIMIT
);
207 uiip
->tagmask
= t3_read_reg(adapter
, A_ULPRX_ISCSI_TAGMASK
);
209 val
= t3_read_reg(adapter
, A_ULPRX_ISCSI_PSZ
);
210 for (i
= 0; i
< 4; i
++, val
>>= 8)
211 uiip
->pgsz_factor
[i
] = val
& 0xFF;
213 val
= t3_read_reg(adapter
, A_TP_PARA_REG7
);
215 uiip
->max_rxsz
= min((val
>> S_PMMAXXFERLEN0
)&M_PMMAXXFERLEN0
,
216 (val
>> S_PMMAXXFERLEN1
)&M_PMMAXXFERLEN1
);
218 * On tx, the iscsi pdu has to be <= tx page size and has to
219 * fit into the Tx PM FIFO.
221 val
= min(adapter
->params
.tp
.tx_pg_size
,
222 t3_read_reg(adapter
, A_PM1_TX_CFG
) >> 17);
223 uiip
->max_txsz
= min(val
, uiip
->max_txsz
);
225 /* set MaxRxData to 16224 */
226 val
= t3_read_reg(adapter
, A_TP_PARA_REG2
);
227 if ((val
>> S_MAXRXDATA
) != 0x3f60) {
228 val
&= (M_RXCOALESCESIZE
<< S_RXCOALESCESIZE
);
229 val
|= V_MAXRXDATA(0x3f60);
231 "%s, iscsi set MaxRxData to 16224 (0x%x).\n",
233 t3_write_reg(adapter
, A_TP_PARA_REG2
, val
);
237 * on rx, the iscsi pdu has to be < rx page size and the
238 * the max rx data length programmed in TP
240 val
= min(adapter
->params
.tp
.rx_pg_size
,
241 ((t3_read_reg(adapter
, A_TP_PARA_REG2
)) >>
242 S_MAXRXDATA
) & M_MAXRXDATA
);
243 uiip
->max_rxsz
= min(val
, uiip
->max_rxsz
);
245 case ULP_ISCSI_SET_PARAMS
:
246 t3_write_reg(adapter
, A_ULPRX_ISCSI_TAGMASK
, uiip
->tagmask
);
247 /* program the ddp page sizes */
248 for (i
= 0; i
< 4; i
++)
249 val
|= (uiip
->pgsz_factor
[i
] & 0xF) << (8 * i
);
250 if (val
&& (val
!= t3_read_reg(adapter
, A_ULPRX_ISCSI_PSZ
))) {
252 "%s, setting iscsi pgsz 0x%x, %u,%u,%u,%u.\n",
253 adapter
->name
, val
, uiip
->pgsz_factor
[0],
254 uiip
->pgsz_factor
[1], uiip
->pgsz_factor
[2],
255 uiip
->pgsz_factor
[3]);
256 t3_write_reg(adapter
, A_ULPRX_ISCSI_PSZ
, val
);
265 /* Response queue used for RDMA events. */
266 #define ASYNC_NOTIF_RSPQ 0
268 static int cxgb_rdma_ctl(struct adapter
*adapter
, unsigned int req
, void *data
)
273 case RDMA_GET_PARAMS
: {
274 struct rdma_info
*rdma
= data
;
275 struct pci_dev
*pdev
= adapter
->pdev
;
277 rdma
->udbell_physbase
= pci_resource_start(pdev
, 2);
278 rdma
->udbell_len
= pci_resource_len(pdev
, 2);
280 t3_read_reg(adapter
, A_ULPTX_TPT_LLIMIT
);
281 rdma
->tpt_top
= t3_read_reg(adapter
, A_ULPTX_TPT_ULIMIT
);
283 t3_read_reg(adapter
, A_ULPTX_PBL_LLIMIT
);
284 rdma
->pbl_top
= t3_read_reg(adapter
, A_ULPTX_PBL_ULIMIT
);
285 rdma
->rqt_base
= t3_read_reg(adapter
, A_ULPRX_RQ_LLIMIT
);
286 rdma
->rqt_top
= t3_read_reg(adapter
, A_ULPRX_RQ_ULIMIT
);
287 rdma
->kdb_addr
= adapter
->regs
+ A_SG_KDOORBELL
;
293 struct rdma_cq_op
*rdma
= data
;
295 /* may be called in any context */
296 spin_lock_irqsave(&adapter
->sge
.reg_lock
, flags
);
297 ret
= t3_sge_cqcntxt_op(adapter
, rdma
->id
, rdma
->op
,
299 spin_unlock_irqrestore(&adapter
->sge
.reg_lock
, flags
);
303 struct ch_mem_range
*t
= data
;
306 if ((t
->addr
& 7) || (t
->len
& 7))
308 if (t
->mem_id
== MEM_CM
)
310 else if (t
->mem_id
== MEM_PMRX
)
311 mem
= &adapter
->pmrx
;
312 else if (t
->mem_id
== MEM_PMTX
)
313 mem
= &adapter
->pmtx
;
318 t3_mc7_bd_read(mem
, t
->addr
/ 8, t
->len
/ 8,
325 struct rdma_cq_setup
*rdma
= data
;
327 spin_lock_irq(&adapter
->sge
.reg_lock
);
329 t3_sge_init_cqcntxt(adapter
, rdma
->id
,
330 rdma
->base_addr
, rdma
->size
,
332 rdma
->ovfl_mode
, rdma
->credits
,
334 spin_unlock_irq(&adapter
->sge
.reg_lock
);
337 case RDMA_CQ_DISABLE
:
338 spin_lock_irq(&adapter
->sge
.reg_lock
);
339 ret
= t3_sge_disable_cqcntxt(adapter
, *(unsigned int *)data
);
340 spin_unlock_irq(&adapter
->sge
.reg_lock
);
342 case RDMA_CTRL_QP_SETUP
:{
343 struct rdma_ctrlqp_setup
*rdma
= data
;
345 spin_lock_irq(&adapter
->sge
.reg_lock
);
346 ret
= t3_sge_init_ecntxt(adapter
, FW_RI_SGEEC_START
, 0,
349 rdma
->base_addr
, rdma
->size
,
350 FW_RI_TID_START
, 1, 0);
351 spin_unlock_irq(&adapter
->sge
.reg_lock
);
355 spin_lock(&adapter
->stats_lock
);
356 t3_tp_get_mib_stats(adapter
, (struct tp_mib_stats
*)data
);
357 spin_unlock(&adapter
->stats_lock
);
366 static int cxgb_offload_ctl(struct t3cdev
*tdev
, unsigned int req
, void *data
)
368 struct adapter
*adapter
= tdev2adap(tdev
);
369 struct tid_range
*tid
;
371 struct iff_mac
*iffmacp
;
372 struct ddp_params
*ddpp
;
373 struct adap_ports
*ports
;
374 struct ofld_page_info
*rx_page_info
;
375 struct tp_params
*tp
= &adapter
->params
.tp
;
379 case GET_MAX_OUTSTANDING_WR
:
380 *(unsigned int *)data
= FW_WR_NUM
;
383 *(unsigned int *)data
= WR_FLITS
;
385 case GET_TX_MAX_CHUNK
:
386 *(unsigned int *)data
= 1 << 20; /* 1MB */
390 tid
->num
= t3_mc5_size(&adapter
->mc5
) -
391 adapter
->params
.mc5
.nroutes
-
392 adapter
->params
.mc5
.nfilters
- adapter
->params
.mc5
.nservers
;
397 tid
->num
= adapter
->params
.mc5
.nservers
;
398 tid
->base
= t3_mc5_size(&adapter
->mc5
) - tid
->num
-
399 adapter
->params
.mc5
.nfilters
- adapter
->params
.mc5
.nroutes
;
401 case GET_L2T_CAPACITY
:
402 *(unsigned int *)data
= 2048;
407 mtup
->mtus
= adapter
->params
.mtus
;
409 case GET_IFF_FROM_MAC
:
411 iffmacp
->dev
= get_iff_from_mac(adapter
, iffmacp
->mac_addr
,
417 ddpp
->llimit
= t3_read_reg(adapter
, A_ULPRX_TDDP_LLIMIT
);
418 ddpp
->ulimit
= t3_read_reg(adapter
, A_ULPRX_TDDP_ULIMIT
);
419 ddpp
->tag_mask
= t3_read_reg(adapter
, A_ULPRX_TDDP_TAGMASK
);
423 ports
->nports
= adapter
->params
.nports
;
424 for_each_port(adapter
, i
)
425 ports
->lldevs
[i
] = adapter
->port
[i
];
427 case ULP_ISCSI_GET_PARAMS
:
428 case ULP_ISCSI_SET_PARAMS
:
429 if (!offload_running(adapter
))
431 return cxgb_ulp_iscsi_ctl(adapter
, req
, data
);
432 case RDMA_GET_PARAMS
:
435 case RDMA_CQ_DISABLE
:
436 case RDMA_CTRL_QP_SETUP
:
439 if (!offload_running(adapter
))
441 return cxgb_rdma_ctl(adapter
, req
, data
);
442 case GET_RX_PAGE_INFO
:
444 rx_page_info
->page_size
= tp
->rx_pg_size
;
445 rx_page_info
->num
= tp
->rx_num_pgs
;
447 case GET_ISCSI_IPV4ADDR
: {
448 struct iscsi_ipv4addr
*p
= data
;
449 struct port_info
*pi
= netdev_priv(p
->dev
);
450 p
->ipv4addr
= pi
->iscsi_ipv4addr
;
453 case GET_EMBEDDED_INFO
: {
454 struct ch_embedded_info
*e
= data
;
456 spin_lock(&adapter
->stats_lock
);
457 t3_get_fw_version(adapter
, &e
->fw_vers
);
458 t3_get_tp_version(adapter
, &e
->tp_vers
);
459 spin_unlock(&adapter
->stats_lock
);
469 * Dummy handler for Rx offload packets in case we get an offload packet before
470 * proper processing is setup. This complains and drops the packet as it isn't
471 * normal to get offload packets at this stage.
473 static int rx_offload_blackhole(struct t3cdev
*dev
, struct sk_buff
**skbs
,
477 dev_kfree_skb_any(skbs
[n
]);
481 static void dummy_neigh_update(struct t3cdev
*dev
, struct neighbour
*neigh
)
485 void cxgb3_set_dummy_ops(struct t3cdev
*dev
)
487 dev
->recv
= rx_offload_blackhole
;
488 dev
->neigh_update
= dummy_neigh_update
;
492 * Free an active-open TID.
494 void *cxgb3_free_atid(struct t3cdev
*tdev
, int atid
)
496 struct tid_info
*t
= &(T3C_DATA(tdev
))->tid_maps
;
497 union active_open_entry
*p
= atid2entry(t
, atid
);
498 void *ctx
= p
->t3c_tid
.ctx
;
500 spin_lock_bh(&t
->atid_lock
);
504 spin_unlock_bh(&t
->atid_lock
);
509 EXPORT_SYMBOL(cxgb3_free_atid
);
512 * Free a server TID and return it to the free pool.
514 void cxgb3_free_stid(struct t3cdev
*tdev
, int stid
)
516 struct tid_info
*t
= &(T3C_DATA(tdev
))->tid_maps
;
517 union listen_entry
*p
= stid2entry(t
, stid
);
519 spin_lock_bh(&t
->stid_lock
);
523 spin_unlock_bh(&t
->stid_lock
);
526 EXPORT_SYMBOL(cxgb3_free_stid
);
528 void cxgb3_insert_tid(struct t3cdev
*tdev
, struct cxgb3_client
*client
,
529 void *ctx
, unsigned int tid
)
531 struct tid_info
*t
= &(T3C_DATA(tdev
))->tid_maps
;
533 t
->tid_tab
[tid
].client
= client
;
534 t
->tid_tab
[tid
].ctx
= ctx
;
535 atomic_inc(&t
->tids_in_use
);
538 EXPORT_SYMBOL(cxgb3_insert_tid
);
541 * Populate a TID_RELEASE WR. The skb must be already propely sized.
543 static inline void mk_tid_release(struct sk_buff
*skb
, unsigned int tid
)
545 struct cpl_tid_release
*req
;
547 skb
->priority
= CPL_PRIORITY_SETUP
;
548 req
= (struct cpl_tid_release
*)__skb_put(skb
, sizeof(*req
));
549 req
->wr
.wr_hi
= htonl(V_WR_OP(FW_WROPCODE_FORWARD
));
550 OPCODE_TID(req
) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE
, tid
));
553 static void t3_process_tid_release_list(struct work_struct
*work
)
555 struct t3c_data
*td
= container_of(work
, struct t3c_data
,
558 struct t3cdev
*tdev
= td
->dev
;
561 spin_lock_bh(&td
->tid_release_lock
);
562 while (td
->tid_release_list
) {
563 struct t3c_tid_entry
*p
= td
->tid_release_list
;
565 td
->tid_release_list
= (struct t3c_tid_entry
*)p
->ctx
;
566 spin_unlock_bh(&td
->tid_release_lock
);
568 skb
= alloc_skb(sizeof(struct cpl_tid_release
),
569 GFP_KERNEL
| __GFP_NOFAIL
);
570 mk_tid_release(skb
, p
- td
->tid_maps
.tid_tab
);
571 cxgb3_ofld_send(tdev
, skb
);
573 spin_lock_bh(&td
->tid_release_lock
);
575 spin_unlock_bh(&td
->tid_release_lock
);
578 /* use ctx as a next pointer in the tid release list */
579 void cxgb3_queue_tid_release(struct t3cdev
*tdev
, unsigned int tid
)
581 struct t3c_data
*td
= T3C_DATA(tdev
);
582 struct t3c_tid_entry
*p
= &td
->tid_maps
.tid_tab
[tid
];
584 spin_lock_bh(&td
->tid_release_lock
);
585 p
->ctx
= (void *)td
->tid_release_list
;
587 td
->tid_release_list
= p
;
589 schedule_work(&td
->tid_release_task
);
590 spin_unlock_bh(&td
->tid_release_lock
);
593 EXPORT_SYMBOL(cxgb3_queue_tid_release
);
596 * Remove a tid from the TID table. A client may defer processing its last
597 * CPL message if it is locked at the time it arrives, and while the message
598 * sits in the client's backlog the TID may be reused for another connection.
599 * To handle this we atomically switch the TID association if it still points
600 * to the original client context.
602 void cxgb3_remove_tid(struct t3cdev
*tdev
, void *ctx
, unsigned int tid
)
604 struct tid_info
*t
= &(T3C_DATA(tdev
))->tid_maps
;
606 BUG_ON(tid
>= t
->ntids
);
607 if (tdev
->type
== T3A
)
608 (void)cmpxchg(&t
->tid_tab
[tid
].ctx
, ctx
, NULL
);
612 skb
= alloc_skb(sizeof(struct cpl_tid_release
), GFP_ATOMIC
);
614 mk_tid_release(skb
, tid
);
615 cxgb3_ofld_send(tdev
, skb
);
616 t
->tid_tab
[tid
].ctx
= NULL
;
618 cxgb3_queue_tid_release(tdev
, tid
);
620 atomic_dec(&t
->tids_in_use
);
623 EXPORT_SYMBOL(cxgb3_remove_tid
);
625 int cxgb3_alloc_atid(struct t3cdev
*tdev
, struct cxgb3_client
*client
,
629 struct tid_info
*t
= &(T3C_DATA(tdev
))->tid_maps
;
631 spin_lock_bh(&t
->atid_lock
);
633 t
->atids_in_use
+ atomic_read(&t
->tids_in_use
) + MC5_MIN_TIDS
<=
635 union active_open_entry
*p
= t
->afree
;
637 atid
= (p
- t
->atid_tab
) + t
->atid_base
;
639 p
->t3c_tid
.ctx
= ctx
;
640 p
->t3c_tid
.client
= client
;
643 spin_unlock_bh(&t
->atid_lock
);
647 EXPORT_SYMBOL(cxgb3_alloc_atid
);
649 int cxgb3_alloc_stid(struct t3cdev
*tdev
, struct cxgb3_client
*client
,
653 struct tid_info
*t
= &(T3C_DATA(tdev
))->tid_maps
;
655 spin_lock_bh(&t
->stid_lock
);
657 union listen_entry
*p
= t
->sfree
;
659 stid
= (p
- t
->stid_tab
) + t
->stid_base
;
661 p
->t3c_tid
.ctx
= ctx
;
662 p
->t3c_tid
.client
= client
;
665 spin_unlock_bh(&t
->stid_lock
);
669 EXPORT_SYMBOL(cxgb3_alloc_stid
);
671 /* Get the t3cdev associated with a net_device */
672 struct t3cdev
*dev2t3cdev(struct net_device
*dev
)
674 const struct port_info
*pi
= netdev_priv(dev
);
676 return (struct t3cdev
*)pi
->adapter
;
679 EXPORT_SYMBOL(dev2t3cdev
);
681 static int do_smt_write_rpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
683 struct cpl_smt_write_rpl
*rpl
= cplhdr(skb
);
685 if (rpl
->status
!= CPL_ERR_NONE
)
687 "Unexpected SMT_WRITE_RPL status %u for entry %u\n",
688 rpl
->status
, GET_TID(rpl
));
690 return CPL_RET_BUF_DONE
;
693 static int do_l2t_write_rpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
695 struct cpl_l2t_write_rpl
*rpl
= cplhdr(skb
);
697 if (rpl
->status
!= CPL_ERR_NONE
)
699 "Unexpected L2T_WRITE_RPL status %u for entry %u\n",
700 rpl
->status
, GET_TID(rpl
));
702 return CPL_RET_BUF_DONE
;
705 static int do_rte_write_rpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
707 struct cpl_rte_write_rpl
*rpl
= cplhdr(skb
);
709 if (rpl
->status
!= CPL_ERR_NONE
)
711 "Unexpected RTE_WRITE_RPL status %u for entry %u\n",
712 rpl
->status
, GET_TID(rpl
));
714 return CPL_RET_BUF_DONE
;
717 static int do_act_open_rpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
719 struct cpl_act_open_rpl
*rpl
= cplhdr(skb
);
720 unsigned int atid
= G_TID(ntohl(rpl
->atid
));
721 struct t3c_tid_entry
*t3c_tid
;
723 t3c_tid
= lookup_atid(&(T3C_DATA(dev
))->tid_maps
, atid
);
724 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
&&
725 t3c_tid
->client
->handlers
&&
726 t3c_tid
->client
->handlers
[CPL_ACT_OPEN_RPL
]) {
727 return t3c_tid
->client
->handlers
[CPL_ACT_OPEN_RPL
] (dev
, skb
,
731 printk(KERN_ERR
"%s: received clientless CPL command 0x%x\n",
732 dev
->name
, CPL_ACT_OPEN_RPL
);
733 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
737 static int do_stid_rpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
739 union opcode_tid
*p
= cplhdr(skb
);
740 unsigned int stid
= G_TID(ntohl(p
->opcode_tid
));
741 struct t3c_tid_entry
*t3c_tid
;
743 t3c_tid
= lookup_stid(&(T3C_DATA(dev
))->tid_maps
, stid
);
744 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
->handlers
&&
745 t3c_tid
->client
->handlers
[p
->opcode
]) {
746 return t3c_tid
->client
->handlers
[p
->opcode
] (dev
, skb
,
749 printk(KERN_ERR
"%s: received clientless CPL command 0x%x\n",
750 dev
->name
, p
->opcode
);
751 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
755 static int do_hwtid_rpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
757 union opcode_tid
*p
= cplhdr(skb
);
758 unsigned int hwtid
= G_TID(ntohl(p
->opcode_tid
));
759 struct t3c_tid_entry
*t3c_tid
;
761 t3c_tid
= lookup_tid(&(T3C_DATA(dev
))->tid_maps
, hwtid
);
762 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
->handlers
&&
763 t3c_tid
->client
->handlers
[p
->opcode
]) {
764 return t3c_tid
->client
->handlers
[p
->opcode
]
765 (dev
, skb
, t3c_tid
->ctx
);
767 printk(KERN_ERR
"%s: received clientless CPL command 0x%x\n",
768 dev
->name
, p
->opcode
);
769 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
773 static int do_cr(struct t3cdev
*dev
, struct sk_buff
*skb
)
775 struct cpl_pass_accept_req
*req
= cplhdr(skb
);
776 unsigned int stid
= G_PASS_OPEN_TID(ntohl(req
->tos_tid
));
777 struct tid_info
*t
= &(T3C_DATA(dev
))->tid_maps
;
778 struct t3c_tid_entry
*t3c_tid
;
779 unsigned int tid
= GET_TID(req
);
781 if (unlikely(tid
>= t
->ntids
)) {
782 printk("%s: passive open TID %u too large\n",
784 t3_fatal_err(tdev2adap(dev
));
785 return CPL_RET_BUF_DONE
;
788 t3c_tid
= lookup_stid(t
, stid
);
789 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
->handlers
&&
790 t3c_tid
->client
->handlers
[CPL_PASS_ACCEPT_REQ
]) {
791 return t3c_tid
->client
->handlers
[CPL_PASS_ACCEPT_REQ
]
792 (dev
, skb
, t3c_tid
->ctx
);
794 printk(KERN_ERR
"%s: received clientless CPL command 0x%x\n",
795 dev
->name
, CPL_PASS_ACCEPT_REQ
);
796 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
801 * Returns an sk_buff for a reply CPL message of size len. If the input
802 * sk_buff has no other users it is trimmed and reused, otherwise a new buffer
803 * is allocated. The input skb must be of size at least len. Note that this
804 * operation does not destroy the original skb data even if it decides to reuse
807 static struct sk_buff
*cxgb3_get_cpl_reply_skb(struct sk_buff
*skb
, size_t len
,
810 if (likely(!skb_cloned(skb
))) {
811 BUG_ON(skb
->len
< len
);
812 __skb_trim(skb
, len
);
815 skb
= alloc_skb(len
, gfp
);
822 static int do_abort_req_rss(struct t3cdev
*dev
, struct sk_buff
*skb
)
824 union opcode_tid
*p
= cplhdr(skb
);
825 unsigned int hwtid
= G_TID(ntohl(p
->opcode_tid
));
826 struct t3c_tid_entry
*t3c_tid
;
828 t3c_tid
= lookup_tid(&(T3C_DATA(dev
))->tid_maps
, hwtid
);
829 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
->handlers
&&
830 t3c_tid
->client
->handlers
[p
->opcode
]) {
831 return t3c_tid
->client
->handlers
[p
->opcode
]
832 (dev
, skb
, t3c_tid
->ctx
);
834 struct cpl_abort_req_rss
*req
= cplhdr(skb
);
835 struct cpl_abort_rpl
*rpl
;
836 struct sk_buff
*reply_skb
;
837 unsigned int tid
= GET_TID(req
);
838 u8 cmd
= req
->status
;
840 if (req
->status
== CPL_ERR_RTX_NEG_ADVICE
||
841 req
->status
== CPL_ERR_PERSIST_NEG_ADVICE
)
844 reply_skb
= cxgb3_get_cpl_reply_skb(skb
,
850 printk("do_abort_req_rss: couldn't get skb!\n");
853 reply_skb
->priority
= CPL_PRIORITY_DATA
;
854 __skb_put(reply_skb
, sizeof(struct cpl_abort_rpl
));
855 rpl
= cplhdr(reply_skb
);
857 htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL
));
858 rpl
->wr
.wr_lo
= htonl(V_WR_TID(tid
));
859 OPCODE_TID(rpl
) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL
, tid
));
861 cxgb3_ofld_send(dev
, reply_skb
);
863 return CPL_RET_BUF_DONE
;
867 static int do_act_establish(struct t3cdev
*dev
, struct sk_buff
*skb
)
869 struct cpl_act_establish
*req
= cplhdr(skb
);
870 unsigned int atid
= G_PASS_OPEN_TID(ntohl(req
->tos_tid
));
871 struct tid_info
*t
= &(T3C_DATA(dev
))->tid_maps
;
872 struct t3c_tid_entry
*t3c_tid
;
873 unsigned int tid
= GET_TID(req
);
875 if (unlikely(tid
>= t
->ntids
)) {
876 printk("%s: active establish TID %u too large\n",
878 t3_fatal_err(tdev2adap(dev
));
879 return CPL_RET_BUF_DONE
;
882 t3c_tid
= lookup_atid(t
, atid
);
883 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
->handlers
&&
884 t3c_tid
->client
->handlers
[CPL_ACT_ESTABLISH
]) {
885 return t3c_tid
->client
->handlers
[CPL_ACT_ESTABLISH
]
886 (dev
, skb
, t3c_tid
->ctx
);
888 printk(KERN_ERR
"%s: received clientless CPL command 0x%x\n",
889 dev
->name
, CPL_ACT_ESTABLISH
);
890 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
894 static int do_trace(struct t3cdev
*dev
, struct sk_buff
*skb
)
896 struct cpl_trace_pkt
*p
= cplhdr(skb
);
898 skb
->protocol
= htons(0xffff);
899 skb
->dev
= dev
->lldev
;
900 skb_pull(skb
, sizeof(*p
));
901 skb_reset_mac_header(skb
);
902 netif_receive_skb(skb
);
907 * That skb would better have come from process_responses() where we abuse
908 * ->priority and ->csum to carry our data. NB: if we get to per-arch
909 * ->csum, the things might get really interesting here.
912 static inline u32
get_hwtid(struct sk_buff
*skb
)
914 return ntohl((__force __be32
)skb
->priority
) >> 8 & 0xfffff;
917 static inline u32
get_opcode(struct sk_buff
*skb
)
919 return G_OPCODE(ntohl((__force __be32
)skb
->csum
));
922 static int do_term(struct t3cdev
*dev
, struct sk_buff
*skb
)
924 unsigned int hwtid
= get_hwtid(skb
);
925 unsigned int opcode
= get_opcode(skb
);
926 struct t3c_tid_entry
*t3c_tid
;
928 t3c_tid
= lookup_tid(&(T3C_DATA(dev
))->tid_maps
, hwtid
);
929 if (t3c_tid
&& t3c_tid
->ctx
&& t3c_tid
->client
->handlers
&&
930 t3c_tid
->client
->handlers
[opcode
]) {
931 return t3c_tid
->client
->handlers
[opcode
] (dev
, skb
,
934 printk(KERN_ERR
"%s: received clientless CPL command 0x%x\n",
936 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
940 static int nb_callback(struct notifier_block
*self
, unsigned long event
,
944 case (NETEVENT_NEIGH_UPDATE
):{
945 cxgb_neigh_update((struct neighbour
*)ctx
);
948 case (NETEVENT_PMTU_UPDATE
):
950 case (NETEVENT_REDIRECT
):{
951 struct netevent_redirect
*nr
= ctx
;
952 cxgb_redirect(nr
->old
, nr
->new);
953 cxgb_neigh_update(nr
->new->neighbour
);
962 static struct notifier_block nb
= {
963 .notifier_call
= nb_callback
967 * Process a received packet with an unknown/unexpected CPL opcode.
969 static int do_bad_cpl(struct t3cdev
*dev
, struct sk_buff
*skb
)
971 printk(KERN_ERR
"%s: received bad CPL command 0x%x\n", dev
->name
,
973 return CPL_RET_BUF_DONE
| CPL_RET_BAD_MSG
;
977 * Handlers for each CPL opcode
979 static cpl_handler_func cpl_handlers
[NUM_CPL_CMDS
];
982 * Add a new handler to the CPL dispatch table. A NULL handler may be supplied
983 * to unregister an existing handler.
985 void t3_register_cpl_handler(unsigned int opcode
, cpl_handler_func h
)
987 if (opcode
< NUM_CPL_CMDS
)
988 cpl_handlers
[opcode
] = h
? h
: do_bad_cpl
;
990 printk(KERN_ERR
"T3C: handler registration for "
991 "opcode %x failed\n", opcode
);
994 EXPORT_SYMBOL(t3_register_cpl_handler
);
997 * T3CDEV's receive method.
999 int process_rx(struct t3cdev
*dev
, struct sk_buff
**skbs
, int n
)
1002 struct sk_buff
*skb
= *skbs
++;
1003 unsigned int opcode
= get_opcode(skb
);
1004 int ret
= cpl_handlers
[opcode
] (dev
, skb
);
1007 if (ret
& CPL_RET_UNKNOWN_TID
) {
1008 union opcode_tid
*p
= cplhdr(skb
);
1010 printk(KERN_ERR
"%s: CPL message (opcode %u) had "
1011 "unknown TID %u\n", dev
->name
, opcode
,
1012 G_TID(ntohl(p
->opcode_tid
)));
1015 if (ret
& CPL_RET_BUF_DONE
)
1022 * Sends an sk_buff to a T3C driver after dealing with any active network taps.
1024 int cxgb3_ofld_send(struct t3cdev
*dev
, struct sk_buff
*skb
)
1029 r
= dev
->send(dev
, skb
);
1034 EXPORT_SYMBOL(cxgb3_ofld_send
);
1036 static int is_offloading(struct net_device
*dev
)
1038 struct adapter
*adapter
;
1041 read_lock_bh(&adapter_list_lock
);
1042 list_for_each_entry(adapter
, &adapter_list
, adapter_list
) {
1043 for_each_port(adapter
, i
) {
1044 if (dev
== adapter
->port
[i
]) {
1045 read_unlock_bh(&adapter_list_lock
);
1050 read_unlock_bh(&adapter_list_lock
);
1054 void cxgb_neigh_update(struct neighbour
*neigh
)
1056 struct net_device
*dev
= neigh
->dev
;
1058 if (dev
&& (is_offloading(dev
))) {
1059 struct t3cdev
*tdev
= dev2t3cdev(dev
);
1062 t3_l2t_update(tdev
, neigh
);
1066 static void set_l2t_ix(struct t3cdev
*tdev
, u32 tid
, struct l2t_entry
*e
)
1068 struct sk_buff
*skb
;
1069 struct cpl_set_tcb_field
*req
;
1071 skb
= alloc_skb(sizeof(*req
), GFP_ATOMIC
);
1073 printk(KERN_ERR
"%s: cannot allocate skb!\n", __func__
);
1076 skb
->priority
= CPL_PRIORITY_CONTROL
;
1077 req
= (struct cpl_set_tcb_field
*)skb_put(skb
, sizeof(*req
));
1078 req
->wr
.wr_hi
= htonl(V_WR_OP(FW_WROPCODE_FORWARD
));
1079 OPCODE_TID(req
) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD
, tid
));
1082 req
->word
= htons(W_TCB_L2T_IX
);
1083 req
->mask
= cpu_to_be64(V_TCB_L2T_IX(M_TCB_L2T_IX
));
1084 req
->val
= cpu_to_be64(V_TCB_L2T_IX(e
->idx
));
1085 tdev
->send(tdev
, skb
);
1088 void cxgb_redirect(struct dst_entry
*old
, struct dst_entry
*new)
1090 struct net_device
*olddev
, *newdev
;
1091 struct tid_info
*ti
;
1092 struct t3cdev
*tdev
;
1095 struct l2t_entry
*e
;
1096 struct t3c_tid_entry
*te
;
1098 olddev
= old
->neighbour
->dev
;
1099 newdev
= new->neighbour
->dev
;
1100 if (!is_offloading(olddev
))
1102 if (!is_offloading(newdev
)) {
1103 printk(KERN_WARNING
"%s: Redirect to non-offload "
1104 "device ignored.\n", __func__
);
1107 tdev
= dev2t3cdev(olddev
);
1109 if (tdev
!= dev2t3cdev(newdev
)) {
1110 printk(KERN_WARNING
"%s: Redirect to different "
1111 "offload device ignored.\n", __func__
);
1115 /* Add new L2T entry */
1116 e
= t3_l2t_get(tdev
, new->neighbour
, newdev
);
1118 printk(KERN_ERR
"%s: couldn't allocate new l2t entry!\n",
1123 /* Walk tid table and notify clients of dst change. */
1124 ti
= &(T3C_DATA(tdev
))->tid_maps
;
1125 for (tid
= 0; tid
< ti
->ntids
; tid
++) {
1126 te
= lookup_tid(ti
, tid
);
1128 if (te
&& te
->ctx
&& te
->client
&& te
->client
->redirect
) {
1129 update_tcb
= te
->client
->redirect(te
->ctx
, old
, new, e
);
1131 l2t_hold(L2DATA(tdev
), e
);
1132 set_l2t_ix(tdev
, tid
, e
);
1136 l2t_release(L2DATA(tdev
), e
);
1140 * Allocate a chunk of memory using kmalloc or, if that fails, vmalloc.
1141 * The allocated memory is cleared.
1143 void *cxgb_alloc_mem(unsigned long size
)
1145 void *p
= kmalloc(size
, GFP_KERNEL
);
1155 * Free memory allocated through t3_alloc_mem().
1157 void cxgb_free_mem(void *addr
)
1159 if (is_vmalloc_addr(addr
))
1166 * Allocate and initialize the TID tables. Returns 0 on success.
1168 static int init_tid_tabs(struct tid_info
*t
, unsigned int ntids
,
1169 unsigned int natids
, unsigned int nstids
,
1170 unsigned int atid_base
, unsigned int stid_base
)
1172 unsigned long size
= ntids
* sizeof(*t
->tid_tab
) +
1173 natids
* sizeof(*t
->atid_tab
) + nstids
* sizeof(*t
->stid_tab
);
1175 t
->tid_tab
= cxgb_alloc_mem(size
);
1179 t
->stid_tab
= (union listen_entry
*)&t
->tid_tab
[ntids
];
1180 t
->atid_tab
= (union active_open_entry
*)&t
->stid_tab
[nstids
];
1183 t
->stid_base
= stid_base
;
1186 t
->atid_base
= atid_base
;
1188 t
->stids_in_use
= t
->atids_in_use
= 0;
1189 atomic_set(&t
->tids_in_use
, 0);
1190 spin_lock_init(&t
->stid_lock
);
1191 spin_lock_init(&t
->atid_lock
);
1194 * Setup the free lists for stid_tab and atid_tab.
1198 t
->stid_tab
[nstids
- 1].next
= &t
->stid_tab
[nstids
];
1199 t
->sfree
= t
->stid_tab
;
1203 t
->atid_tab
[natids
- 1].next
= &t
->atid_tab
[natids
];
1204 t
->afree
= t
->atid_tab
;
1209 static void free_tid_maps(struct tid_info
*t
)
1211 cxgb_free_mem(t
->tid_tab
);
1214 static inline void add_adapter(struct adapter
*adap
)
1216 write_lock_bh(&adapter_list_lock
);
1217 list_add_tail(&adap
->adapter_list
, &adapter_list
);
1218 write_unlock_bh(&adapter_list_lock
);
1221 static inline void remove_adapter(struct adapter
*adap
)
1223 write_lock_bh(&adapter_list_lock
);
1224 list_del(&adap
->adapter_list
);
1225 write_unlock_bh(&adapter_list_lock
);
1228 int cxgb3_offload_activate(struct adapter
*adapter
)
1230 struct t3cdev
*dev
= &adapter
->tdev
;
1233 struct tid_range stid_range
, tid_range
;
1234 struct mtutab mtutab
;
1235 unsigned int l2t_capacity
;
1237 t
= kcalloc(1, sizeof(*t
), GFP_KERNEL
);
1242 if (dev
->ctl(dev
, GET_TX_MAX_CHUNK
, &t
->tx_max_chunk
) < 0 ||
1243 dev
->ctl(dev
, GET_MAX_OUTSTANDING_WR
, &t
->max_wrs
) < 0 ||
1244 dev
->ctl(dev
, GET_L2T_CAPACITY
, &l2t_capacity
) < 0 ||
1245 dev
->ctl(dev
, GET_MTUS
, &mtutab
) < 0 ||
1246 dev
->ctl(dev
, GET_TID_RANGE
, &tid_range
) < 0 ||
1247 dev
->ctl(dev
, GET_STID_RANGE
, &stid_range
) < 0)
1251 L2DATA(dev
) = t3_init_l2t(l2t_capacity
);
1255 natids
= min(tid_range
.num
/ 2, MAX_ATIDS
);
1256 err
= init_tid_tabs(&t
->tid_maps
, tid_range
.num
, natids
,
1257 stid_range
.num
, ATID_BASE
, stid_range
.base
);
1261 t
->mtus
= mtutab
.mtus
;
1262 t
->nmtus
= mtutab
.size
;
1264 INIT_WORK(&t
->tid_release_task
, t3_process_tid_release_list
);
1265 spin_lock_init(&t
->tid_release_lock
);
1266 INIT_LIST_HEAD(&t
->list_node
);
1270 dev
->recv
= process_rx
;
1271 dev
->neigh_update
= t3_l2t_update
;
1273 /* Register netevent handler once */
1274 if (list_empty(&adapter_list
))
1275 register_netevent_notifier(&nb
);
1277 add_adapter(adapter
);
1281 t3_free_l2t(L2DATA(dev
));
1288 void cxgb3_offload_deactivate(struct adapter
*adapter
)
1290 struct t3cdev
*tdev
= &adapter
->tdev
;
1291 struct t3c_data
*t
= T3C_DATA(tdev
);
1293 remove_adapter(adapter
);
1294 if (list_empty(&adapter_list
))
1295 unregister_netevent_notifier(&nb
);
1297 free_tid_maps(&t
->tid_maps
);
1298 T3C_DATA(tdev
) = NULL
;
1299 t3_free_l2t(L2DATA(tdev
));
1300 L2DATA(tdev
) = NULL
;
1304 static inline void register_tdev(struct t3cdev
*tdev
)
1308 mutex_lock(&cxgb3_db_lock
);
1309 snprintf(tdev
->name
, sizeof(tdev
->name
), "ofld_dev%d", unit
++);
1310 list_add_tail(&tdev
->ofld_dev_list
, &ofld_dev_list
);
1311 mutex_unlock(&cxgb3_db_lock
);
1314 static inline void unregister_tdev(struct t3cdev
*tdev
)
1316 mutex_lock(&cxgb3_db_lock
);
1317 list_del(&tdev
->ofld_dev_list
);
1318 mutex_unlock(&cxgb3_db_lock
);
1321 static inline int adap2type(struct adapter
*adapter
)
1325 switch (adapter
->params
.rev
) {
1340 void __devinit
cxgb3_adapter_ofld(struct adapter
*adapter
)
1342 struct t3cdev
*tdev
= &adapter
->tdev
;
1344 INIT_LIST_HEAD(&tdev
->ofld_dev_list
);
1346 cxgb3_set_dummy_ops(tdev
);
1347 tdev
->send
= t3_offload_tx
;
1348 tdev
->ctl
= cxgb_offload_ctl
;
1349 tdev
->type
= adap2type(adapter
);
1351 register_tdev(tdev
);
1354 void __devexit
cxgb3_adapter_unofld(struct adapter
*adapter
)
1356 struct t3cdev
*tdev
= &adapter
->tdev
;
1359 tdev
->neigh_update
= NULL
;
1361 unregister_tdev(tdev
);
1364 void __init
cxgb3_offload_init(void)
1368 for (i
= 0; i
< NUM_CPL_CMDS
; ++i
)
1369 cpl_handlers
[i
] = do_bad_cpl
;
1371 t3_register_cpl_handler(CPL_SMT_WRITE_RPL
, do_smt_write_rpl
);
1372 t3_register_cpl_handler(CPL_L2T_WRITE_RPL
, do_l2t_write_rpl
);
1373 t3_register_cpl_handler(CPL_RTE_WRITE_RPL
, do_rte_write_rpl
);
1374 t3_register_cpl_handler(CPL_PASS_OPEN_RPL
, do_stid_rpl
);
1375 t3_register_cpl_handler(CPL_CLOSE_LISTSRV_RPL
, do_stid_rpl
);
1376 t3_register_cpl_handler(CPL_PASS_ACCEPT_REQ
, do_cr
);
1377 t3_register_cpl_handler(CPL_PASS_ESTABLISH
, do_hwtid_rpl
);
1378 t3_register_cpl_handler(CPL_ABORT_RPL_RSS
, do_hwtid_rpl
);
1379 t3_register_cpl_handler(CPL_ABORT_RPL
, do_hwtid_rpl
);
1380 t3_register_cpl_handler(CPL_RX_URG_NOTIFY
, do_hwtid_rpl
);
1381 t3_register_cpl_handler(CPL_RX_DATA
, do_hwtid_rpl
);
1382 t3_register_cpl_handler(CPL_TX_DATA_ACK
, do_hwtid_rpl
);
1383 t3_register_cpl_handler(CPL_TX_DMA_ACK
, do_hwtid_rpl
);
1384 t3_register_cpl_handler(CPL_ACT_OPEN_RPL
, do_act_open_rpl
);
1385 t3_register_cpl_handler(CPL_PEER_CLOSE
, do_hwtid_rpl
);
1386 t3_register_cpl_handler(CPL_CLOSE_CON_RPL
, do_hwtid_rpl
);
1387 t3_register_cpl_handler(CPL_ABORT_REQ_RSS
, do_abort_req_rss
);
1388 t3_register_cpl_handler(CPL_ACT_ESTABLISH
, do_act_establish
);
1389 t3_register_cpl_handler(CPL_SET_TCB_RPL
, do_hwtid_rpl
);
1390 t3_register_cpl_handler(CPL_GET_TCB_RPL
, do_hwtid_rpl
);
1391 t3_register_cpl_handler(CPL_RDMA_TERMINATE
, do_term
);
1392 t3_register_cpl_handler(CPL_RDMA_EC_STATUS
, do_hwtid_rpl
);
1393 t3_register_cpl_handler(CPL_TRACE_PKT
, do_trace
);
1394 t3_register_cpl_handler(CPL_RX_DATA_DDP
, do_hwtid_rpl
);
1395 t3_register_cpl_handler(CPL_RX_DDP_COMPLETE
, do_hwtid_rpl
);
1396 t3_register_cpl_handler(CPL_ISCSI_HDR
, do_hwtid_rpl
);