1 /**********************************************************************
4 * Contact: support@cavium.com
5 * Please include "LiquidIO" in the subject.
7 * Copyright (c) 2003-2015 Cavium, Inc.
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
19 * This file may also be available under a different license from Cavium.
20 * Contact Cavium, Inc. for more information
21 **********************************************************************/
22 #include <linux/pci.h>
23 #include <linux/netdevice.h>
24 #include <linux/vmalloc.h>
25 #include "liquidio_common.h"
26 #include "octeon_droq.h"
27 #include "octeon_iq.h"
28 #include "response_manager.h"
29 #include "octeon_device.h"
30 #include "octeon_main.h"
31 #include "octeon_network.h"
32 #include "cn66xx_device.h"
34 #define INCR_INSTRQUEUE_PKT_COUNT(octeon_dev_ptr, iq_no, field, count) \
35 (octeon_dev_ptr->instr_queue[iq_no]->stats.field += count)
37 struct iq_post_status
{
42 static void check_db_timeout(struct work_struct
*work
);
43 static void __check_db_timeout(struct octeon_device
*oct
, u64 iq_no
);
45 static void (*reqtype_free_fn
[MAX_OCTEON_DEVICES
][REQTYPE_LAST
+ 1]) (void *);
47 static inline int IQ_INSTR_MODE_64B(struct octeon_device
*oct
, int iq_no
)
49 struct octeon_instr_queue
*iq
=
50 (struct octeon_instr_queue
*)oct
->instr_queue
[iq_no
];
54 #define IQ_INSTR_MODE_32B(oct, iq_no) (!IQ_INSTR_MODE_64B(oct, iq_no))
56 /* Define this to return the request status comaptible to old code */
57 /*#define OCTEON_USE_OLD_REQ_STATUS*/
59 /* Return 0 on success, 1 on failure */
60 int octeon_init_instr_queue(struct octeon_device
*oct
,
61 union oct_txpciq txpciq
,
64 struct octeon_instr_queue
*iq
;
65 struct octeon_iq_config
*conf
= NULL
;
66 u32 iq_no
= (u32
)txpciq
.s
.q_no
;
68 struct cavium_wq
*db_wq
;
69 int orig_node
= dev_to_node(&oct
->pci_dev
->dev
);
70 int numa_node
= cpu_to_node(iq_no
% num_online_cpus());
72 if (OCTEON_CN6XXX(oct
))
73 conf
= &(CFG_GET_IQ_CFG(CHIP_FIELD(oct
, cn6xxx
, conf
)));
76 dev_err(&oct
->pci_dev
->dev
, "Unsupported Chip %x\n",
81 if (num_descs
& (num_descs
- 1)) {
82 dev_err(&oct
->pci_dev
->dev
,
83 "Number of descriptors for instr queue %d not in power of 2.\n",
88 q_size
= (u32
)conf
->instr_type
* num_descs
;
90 iq
= oct
->instr_queue
[iq_no
];
93 set_dev_node(&oct
->pci_dev
->dev
, numa_node
);
94 iq
->base_addr
= lio_dma_alloc(oct
, q_size
,
95 (dma_addr_t
*)&iq
->base_addr_dma
);
96 set_dev_node(&oct
->pci_dev
->dev
, orig_node
);
98 iq
->base_addr
= lio_dma_alloc(oct
, q_size
,
99 (dma_addr_t
*)&iq
->base_addr_dma
);
100 if (!iq
->base_addr
) {
101 dev_err(&oct
->pci_dev
->dev
, "Cannot allocate memory for instr queue %d\n",
106 iq
->max_count
= num_descs
;
108 /* Initialize a list to holds requests that have been posted to Octeon
109 * but has yet to be fetched by octeon
111 iq
->request_list
= vmalloc_node((sizeof(*iq
->request_list
) * num_descs
),
113 if (!iq
->request_list
)
114 iq
->request_list
= vmalloc(sizeof(*iq
->request_list
) *
116 if (!iq
->request_list
) {
117 lio_dma_free(oct
, q_size
, iq
->base_addr
, iq
->base_addr_dma
);
118 dev_err(&oct
->pci_dev
->dev
, "Alloc failed for IQ[%d] nr free list\n",
123 memset(iq
->request_list
, 0, sizeof(*iq
->request_list
) * num_descs
);
125 dev_dbg(&oct
->pci_dev
->dev
, "IQ[%d]: base: %p basedma: %llx count: %d\n",
126 iq_no
, iq
->base_addr
, iq
->base_addr_dma
, iq
->max_count
);
128 iq
->txpciq
.u64
= txpciq
.u64
;
129 iq
->fill_threshold
= (u32
)conf
->db_min
;
131 iq
->host_write_index
= 0;
132 iq
->octeon_read_index
= 0;
134 iq
->last_db_time
= 0;
135 iq
->do_auto_flush
= 1;
136 iq
->db_timeout
= (u32
)conf
->db_timeout
;
137 atomic_set(&iq
->instr_pending
, 0);
139 /* Initialize the spinlock for this instruction queue */
140 spin_lock_init(&iq
->lock
);
141 spin_lock_init(&iq
->post_lock
);
143 spin_lock_init(&iq
->iq_flush_running_lock
);
145 oct
->io_qmask
.iq
|= (1ULL << iq_no
);
147 /* Set the 32B/64B mode for each input queue */
148 oct
->io_qmask
.iq64B
|= ((conf
->instr_type
== 64) << iq_no
);
149 iq
->iqcmd_64B
= (conf
->instr_type
== 64);
151 oct
->fn_list
.setup_iq_regs(oct
, iq_no
);
153 oct
->check_db_wq
[iq_no
].wq
= alloc_workqueue("check_iq_db",
156 if (!oct
->check_db_wq
[iq_no
].wq
) {
157 lio_dma_free(oct
, q_size
, iq
->base_addr
, iq
->base_addr_dma
);
158 dev_err(&oct
->pci_dev
->dev
, "check db wq create failed for iq %d\n",
163 db_wq
= &oct
->check_db_wq
[iq_no
];
165 INIT_DELAYED_WORK(&db_wq
->wk
.work
, check_db_timeout
);
166 db_wq
->wk
.ctxptr
= oct
;
167 db_wq
->wk
.ctxul
= iq_no
;
168 queue_delayed_work(db_wq
->wq
, &db_wq
->wk
.work
, msecs_to_jiffies(1));
173 int octeon_delete_instr_queue(struct octeon_device
*oct
, u32 iq_no
)
175 u64 desc_size
= 0, q_size
;
176 struct octeon_instr_queue
*iq
= oct
->instr_queue
[iq_no
];
178 cancel_delayed_work_sync(&oct
->check_db_wq
[iq_no
].wk
.work
);
179 destroy_workqueue(oct
->check_db_wq
[iq_no
].wq
);
181 if (OCTEON_CN6XXX(oct
))
183 CFG_GET_IQ_INSTR_TYPE(CHIP_FIELD(oct
, cn6xxx
, conf
));
185 vfree(iq
->request_list
);
188 q_size
= iq
->max_count
* desc_size
;
189 lio_dma_free(oct
, (u32
)q_size
, iq
->base_addr
,
196 /* Return 0 on success, 1 on failure */
197 int octeon_setup_iq(struct octeon_device
*oct
,
200 union oct_txpciq txpciq
,
204 u32 iq_no
= (u32
)txpciq
.s
.q_no
;
205 int numa_node
= cpu_to_node(iq_no
% num_online_cpus());
207 if (oct
->instr_queue
[iq_no
]) {
208 dev_dbg(&oct
->pci_dev
->dev
, "IQ is in use. Cannot create the IQ: %d again\n",
210 oct
->instr_queue
[iq_no
]->txpciq
.u64
= txpciq
.u64
;
211 oct
->instr_queue
[iq_no
]->app_ctx
= app_ctx
;
214 oct
->instr_queue
[iq_no
] =
215 vmalloc_node(sizeof(struct octeon_instr_queue
), numa_node
);
216 if (!oct
->instr_queue
[iq_no
])
217 oct
->instr_queue
[iq_no
] =
218 vmalloc(sizeof(struct octeon_instr_queue
));
219 if (!oct
->instr_queue
[iq_no
])
222 memset(oct
->instr_queue
[iq_no
], 0,
223 sizeof(struct octeon_instr_queue
));
225 oct
->instr_queue
[iq_no
]->q_index
= q_index
;
226 oct
->instr_queue
[iq_no
]->app_ctx
= app_ctx
;
227 oct
->instr_queue
[iq_no
]->ifidx
= ifidx
;
229 if (octeon_init_instr_queue(oct
, txpciq
, num_descs
)) {
230 vfree(oct
->instr_queue
[iq_no
]);
231 oct
->instr_queue
[iq_no
] = NULL
;
236 oct
->fn_list
.enable_io_queues(oct
);
240 int lio_wait_for_instr_fetch(struct octeon_device
*oct
)
242 int i
, retry
= 1000, pending
, instr_cnt
= 0;
247 /*for (i = 0; i < oct->num_iqs; i++) {*/
248 for (i
= 0; i
< MAX_OCTEON_INSTR_QUEUES(oct
); i
++) {
249 if (!(oct
->io_qmask
.iq
& (1ULL << i
)))
253 instr_queue
[i
]->instr_pending
);
255 __check_db_timeout(oct
, i
);
256 instr_cnt
+= pending
;
262 schedule_timeout_uninterruptible(1);
264 } while (retry
-- && instr_cnt
);
270 ring_doorbell(struct octeon_device
*oct
, struct octeon_instr_queue
*iq
)
272 if (atomic_read(&oct
->status
) == OCT_DEV_RUNNING
) {
273 writel(iq
->fill_cnt
, iq
->doorbell_reg
);
274 /* make sure doorbell write goes through */
277 iq
->last_db_time
= jiffies
;
282 static inline void __copy_cmd_into_iq(struct octeon_instr_queue
*iq
,
287 cmdsize
= ((iq
->iqcmd_64B
) ? 64 : 32);
288 iqptr
= iq
->base_addr
+ (cmdsize
* iq
->host_write_index
);
290 memcpy(iqptr
, cmd
, cmdsize
);
293 static inline struct iq_post_status
294 __post_command2(struct octeon_instr_queue
*iq
, u8
*cmd
)
296 struct iq_post_status st
;
298 st
.status
= IQ_SEND_OK
;
300 /* This ensures that the read index does not wrap around to the same
301 * position if queue gets full before Octeon could fetch any instr.
303 if (atomic_read(&iq
->instr_pending
) >= (s32
)(iq
->max_count
- 1)) {
304 st
.status
= IQ_SEND_FAILED
;
309 if (atomic_read(&iq
->instr_pending
) >= (s32
)(iq
->max_count
- 2))
310 st
.status
= IQ_SEND_STOP
;
312 __copy_cmd_into_iq(iq
, cmd
);
314 /* "index" is returned, host_write_index is modified. */
315 st
.index
= iq
->host_write_index
;
316 INCR_INDEX_BY1(iq
->host_write_index
, iq
->max_count
);
319 /* Flush the command into memory. We need to be sure the data is in
320 * memory before indicating that the instruction is pending.
324 atomic_inc(&iq
->instr_pending
);
330 octeon_register_reqtype_free_fn(struct octeon_device
*oct
, int reqtype
,
333 if (reqtype
> REQTYPE_LAST
) {
334 dev_err(&oct
->pci_dev
->dev
, "%s: Invalid reqtype: %d\n",
339 reqtype_free_fn
[oct
->octeon_id
][reqtype
] = fn
;
345 __add_to_request_list(struct octeon_instr_queue
*iq
,
346 int idx
, void *buf
, int reqtype
)
348 iq
->request_list
[idx
].buf
= buf
;
349 iq
->request_list
[idx
].reqtype
= reqtype
;
352 /* Can only run in process context */
354 lio_process_iq_request_list(struct octeon_device
*oct
,
355 struct octeon_instr_queue
*iq
, u32 napi_budget
)
359 u32 old
= iq
->flush_index
;
361 unsigned int pkts_compl
= 0, bytes_compl
= 0;
362 struct octeon_soft_command
*sc
;
363 struct octeon_instr_irh
*irh
;
366 while (old
!= iq
->octeon_read_index
) {
367 reqtype
= iq
->request_list
[old
].reqtype
;
368 buf
= iq
->request_list
[old
].buf
;
370 if (reqtype
== REQTYPE_NONE
)
373 octeon_update_tx_completion_counters(buf
, reqtype
, &pkts_compl
,
377 case REQTYPE_NORESP_NET
:
378 case REQTYPE_NORESP_NET_SG
:
379 case REQTYPE_RESP_NET_SG
:
380 reqtype_free_fn
[oct
->octeon_id
][reqtype
](buf
);
382 case REQTYPE_RESP_NET
:
383 case REQTYPE_SOFT_COMMAND
:
386 irh
= (struct octeon_instr_irh
*)&sc
->cmd
.cmd2
.irh
;
388 /* We're expecting a response from Octeon.
389 * It's up to lio_process_ordered_list() to
390 * process sc. Add sc to the ordered soft
391 * command response list because we expect
392 * a response from Octeon.
396 [OCTEON_ORDERED_SC_LIST
].lock
,
398 atomic_inc(&oct
->response_list
399 [OCTEON_ORDERED_SC_LIST
].
401 list_add_tail(&sc
->node
, &oct
->response_list
402 [OCTEON_ORDERED_SC_LIST
].head
);
403 spin_unlock_irqrestore
405 [OCTEON_ORDERED_SC_LIST
].lock
,
409 /* This callback must not sleep */
410 sc
->callback(oct
, OCTEON_REQUEST_DONE
,
416 dev_err(&oct
->pci_dev
->dev
,
417 "%s Unknown reqtype: %d buf: %p at idx %d\n",
418 __func__
, reqtype
, buf
, old
);
421 iq
->request_list
[old
].buf
= NULL
;
422 iq
->request_list
[old
].reqtype
= 0;
426 INCR_INDEX_BY1(old
, iq
->max_count
);
428 if ((napi_budget
) && (inst_count
>= napi_budget
))
432 octeon_report_tx_completion_to_bql(iq
->app_ctx
, pkts_compl
,
434 iq
->flush_index
= old
;
439 /* Can only be called from process context */
441 octeon_flush_iq(struct octeon_device
*oct
, struct octeon_instr_queue
*iq
,
442 u32 pending_thresh
, u32 napi_budget
)
444 u32 inst_processed
= 0;
445 u32 tot_inst_processed
= 0;
448 if (!spin_trylock(&iq
->iq_flush_running_lock
))
451 spin_lock_bh(&iq
->lock
);
453 iq
->octeon_read_index
= oct
->fn_list
.update_iq_read_idx(iq
);
455 if (atomic_read(&iq
->instr_pending
) >= (s32
)pending_thresh
) {
457 /* Process any outstanding IQ packets. */
458 if (iq
->flush_index
== iq
->octeon_read_index
)
462 inst_processed
= lio_process_iq_request_list
464 napi_budget
- tot_inst_processed
);
467 lio_process_iq_request_list(oct
, iq
, 0);
469 if (inst_processed
) {
470 atomic_sub(inst_processed
, &iq
->instr_pending
);
471 iq
->stats
.instr_processed
+= inst_processed
;
474 tot_inst_processed
+= inst_processed
;
477 } while (tot_inst_processed
< napi_budget
);
479 if (napi_budget
&& (tot_inst_processed
>= napi_budget
))
483 iq
->last_db_time
= jiffies
;
485 spin_unlock_bh(&iq
->lock
);
487 spin_unlock(&iq
->iq_flush_running_lock
);
492 /* Process instruction queue after timeout.
493 * This routine gets called from a workqueue or when removing the module.
495 static void __check_db_timeout(struct octeon_device
*oct
, u64 iq_no
)
497 struct octeon_instr_queue
*iq
;
502 iq
= oct
->instr_queue
[iq_no
];
506 /* return immediately, if no work pending */
507 if (!atomic_read(&iq
->instr_pending
))
509 /* If jiffies - last_db_time < db_timeout do nothing */
510 next_time
= iq
->last_db_time
+ iq
->db_timeout
;
511 if (!time_after(jiffies
, (unsigned long)next_time
))
513 iq
->last_db_time
= jiffies
;
515 /* Flush the instruction queue */
516 octeon_flush_iq(oct
, iq
, 1, 0);
519 /* Called by the Poll thread at regular intervals to check the instruction
520 * queue for commands to be posted and for commands that were fetched by Octeon.
522 static void check_db_timeout(struct work_struct
*work
)
524 struct cavium_wk
*wk
= (struct cavium_wk
*)work
;
525 struct octeon_device
*oct
= (struct octeon_device
*)wk
->ctxptr
;
526 u64 iq_no
= wk
->ctxul
;
527 struct cavium_wq
*db_wq
= &oct
->check_db_wq
[iq_no
];
530 __check_db_timeout(oct
, iq_no
);
531 queue_delayed_work(db_wq
->wq
, &db_wq
->wk
.work
, msecs_to_jiffies(delay
));
535 octeon_send_command(struct octeon_device
*oct
, u32 iq_no
,
536 u32 force_db
, void *cmd
, void *buf
,
537 u32 datasize
, u32 reqtype
)
539 struct iq_post_status st
;
540 struct octeon_instr_queue
*iq
= oct
->instr_queue
[iq_no
];
542 /* Get the lock and prevent other tasks and tx interrupt handler from
545 spin_lock_bh(&iq
->post_lock
);
547 st
= __post_command2(iq
, cmd
);
549 if (st
.status
!= IQ_SEND_FAILED
) {
550 octeon_report_sent_bytes_to_bql(buf
, reqtype
);
551 __add_to_request_list(iq
, st
.index
, buf
, reqtype
);
552 INCR_INSTRQUEUE_PKT_COUNT(oct
, iq_no
, bytes_sent
, datasize
);
553 INCR_INSTRQUEUE_PKT_COUNT(oct
, iq_no
, instr_posted
, 1);
556 ring_doorbell(oct
, iq
);
558 INCR_INSTRQUEUE_PKT_COUNT(oct
, iq_no
, instr_dropped
, 1);
561 spin_unlock_bh(&iq
->post_lock
);
563 /* This is only done here to expedite packets being flushed
564 * for cases where there are no IQ completion interrupts.
566 /*if (iq->do_auto_flush)*/
567 /* octeon_flush_iq(oct, iq, 2, 0);*/
573 octeon_prepare_soft_command(struct octeon_device
*oct
,
574 struct octeon_soft_command
*sc
,
581 struct octeon_config
*oct_cfg
;
582 struct octeon_instr_ih2
*ih2
;
583 struct octeon_instr_irh
*irh
;
584 struct octeon_instr_rdp
*rdp
;
586 WARN_ON(opcode
> 15);
587 WARN_ON(subcode
> 127);
589 oct_cfg
= octeon_get_conf(oct
);
591 ih2
= (struct octeon_instr_ih2
*)&sc
->cmd
.cmd2
.ih2
;
592 ih2
->tagtype
= ATOMIC_TAG
;
593 ih2
->tag
= LIO_CONTROL
;
595 ih2
->grp
= CFG_GET_CTRL_Q_GRP(oct_cfg
);
598 ih2
->dlengsz
= sc
->datasize
;
602 irh
= (struct octeon_instr_irh
*)&sc
->cmd
.cmd2
.irh
;
603 irh
->opcode
= opcode
;
604 irh
->subcode
= subcode
;
606 /* opcode/subcode specific parameters (ossp) */
607 irh
->ossp
= irh_ossp
;
608 sc
->cmd
.cmd2
.ossp
[0] = ossp0
;
609 sc
->cmd
.cmd2
.ossp
[1] = ossp1
;
612 rdp
= (struct octeon_instr_rdp
*)&sc
->cmd
.cmd2
.rdp
;
613 rdp
->pcie_port
= oct
->pcie_port
;
614 rdp
->rlen
= sc
->rdatasize
;
617 ih2
->fsz
= 40; /* irh+ossp[0]+ossp[1]+rdp+rptr = 40 bytes */
620 ih2
->fsz
= 24; /* irh + ossp[0] + ossp[1] = 24 bytes */
624 int octeon_send_soft_command(struct octeon_device
*oct
,
625 struct octeon_soft_command
*sc
)
627 struct octeon_instr_ih2
*ih2
;
628 struct octeon_instr_irh
*irh
;
631 ih2
= (struct octeon_instr_ih2
*)&sc
->cmd
.cmd2
.ih2
;
633 WARN_ON(!sc
->dmadptr
);
634 sc
->cmd
.cmd2
.dptr
= sc
->dmadptr
;
636 irh
= (struct octeon_instr_irh
*)&sc
->cmd
.cmd2
.irh
;
638 WARN_ON(!sc
->dmarptr
);
639 WARN_ON(!sc
->status_word
);
640 *sc
->status_word
= COMPLETION_WORD_INIT
;
642 sc
->cmd
.cmd2
.rptr
= sc
->dmarptr
;
644 len
= (u32
)ih2
->dlengsz
;
647 sc
->timeout
= jiffies
+ sc
->wait_time
;
649 return (octeon_send_command(oct
, sc
->iq_no
, 1, &sc
->cmd
, sc
,
650 len
, REQTYPE_SOFT_COMMAND
));
653 int octeon_setup_sc_buffer_pool(struct octeon_device
*oct
)
657 struct octeon_soft_command
*sc
;
659 INIT_LIST_HEAD(&oct
->sc_buf_pool
.head
);
660 spin_lock_init(&oct
->sc_buf_pool
.lock
);
661 atomic_set(&oct
->sc_buf_pool
.alloc_buf_count
, 0);
663 for (i
= 0; i
< MAX_SOFT_COMMAND_BUFFERS
; i
++) {
664 sc
= (struct octeon_soft_command
*)
666 SOFT_COMMAND_BUFFER_SIZE
,
667 (dma_addr_t
*)&dma_addr
);
671 sc
->dma_addr
= dma_addr
;
672 sc
->size
= SOFT_COMMAND_BUFFER_SIZE
;
674 list_add_tail(&sc
->node
, &oct
->sc_buf_pool
.head
);
680 int octeon_free_sc_buffer_pool(struct octeon_device
*oct
)
682 struct list_head
*tmp
, *tmp2
;
683 struct octeon_soft_command
*sc
;
685 spin_lock_bh(&oct
->sc_buf_pool
.lock
);
687 list_for_each_safe(tmp
, tmp2
, &oct
->sc_buf_pool
.head
) {
690 sc
= (struct octeon_soft_command
*)tmp
;
692 lio_dma_free(oct
, sc
->size
, sc
, sc
->dma_addr
);
695 INIT_LIST_HEAD(&oct
->sc_buf_pool
.head
);
697 spin_unlock_bh(&oct
->sc_buf_pool
.lock
);
702 struct octeon_soft_command
*octeon_alloc_soft_command(struct octeon_device
*oct
,
709 u32 offset
= sizeof(struct octeon_soft_command
);
710 struct octeon_soft_command
*sc
= NULL
;
711 struct list_head
*tmp
;
713 WARN_ON((offset
+ datasize
+ rdatasize
+ ctxsize
) >
714 SOFT_COMMAND_BUFFER_SIZE
);
716 spin_lock_bh(&oct
->sc_buf_pool
.lock
);
718 if (list_empty(&oct
->sc_buf_pool
.head
)) {
719 spin_unlock_bh(&oct
->sc_buf_pool
.lock
);
723 list_for_each(tmp
, &oct
->sc_buf_pool
.head
)
728 atomic_inc(&oct
->sc_buf_pool
.alloc_buf_count
);
730 spin_unlock_bh(&oct
->sc_buf_pool
.lock
);
732 sc
= (struct octeon_soft_command
*)tmp
;
734 dma_addr
= sc
->dma_addr
;
737 memset(sc
, 0, sc
->size
);
739 sc
->dma_addr
= dma_addr
;
743 sc
->ctxptr
= (u8
*)sc
+ offset
;
744 sc
->ctxsize
= ctxsize
;
747 /* Start data at 128 byte boundary */
748 offset
= (offset
+ ctxsize
+ 127) & 0xffffff80;
751 sc
->virtdptr
= (u8
*)sc
+ offset
;
752 sc
->dmadptr
= dma_addr
+ offset
;
753 sc
->datasize
= datasize
;
756 /* Start rdata at 128 byte boundary */
757 offset
= (offset
+ datasize
+ 127) & 0xffffff80;
760 WARN_ON(rdatasize
< 16);
761 sc
->virtrptr
= (u8
*)sc
+ offset
;
762 sc
->dmarptr
= dma_addr
+ offset
;
763 sc
->rdatasize
= rdatasize
;
764 sc
->status_word
= (u64
*)((u8
*)(sc
->virtrptr
) + rdatasize
- 8);
770 void octeon_free_soft_command(struct octeon_device
*oct
,
771 struct octeon_soft_command
*sc
)
773 spin_lock_bh(&oct
->sc_buf_pool
.lock
);
775 list_add_tail(&sc
->node
, &oct
->sc_buf_pool
.head
);
777 atomic_dec(&oct
->sc_buf_pool
.alloc_buf_count
);
779 spin_unlock_bh(&oct
->sc_buf_pool
.lock
);