linux/drivers/scsi/snic/vnic_cq_fw.h
Thomas Gleixner dfb99b050e treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_168.RULE (part 2)
Based on the normalized pattern:

    this program is free software you may redistribute it and/or modify it
    under the terms of the gnu general public license as published by the
    free software foundation version 2 of the license  the software is
    provided as is without warranty of any kind express or implied
    including but not limited to the warranties of merchantability fitness
    for a particular purpose and noninfringement in no event shall the
    authors or copyright holders be liable for any claim damages or other
    liability whether in an action of contract tort or otherwise arising
    from out of or in connection with the software or the use or other
    dealings in the software

extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

has been chosen to replace the boilerplate/reference.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-10 14:51:36 +02:00

49 lines
1.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright 2014 Cisco Systems, Inc. All rights reserved. */
#ifndef _VNIC_CQ_FW_H_
#define _VNIC_CQ_FW_H_
#include "snic_fwint.h"
static inline unsigned int
vnic_cq_fw_service(struct vnic_cq *cq,
int (*q_service)(struct vnic_dev *vdev,
unsigned int index,
struct snic_fw_req *desc),
unsigned int work_to_do)
{
struct snic_fw_req *desc;
unsigned int work_done = 0;
u8 color;
desc = (struct snic_fw_req *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
snic_color_dec(desc, &color);
while (color != cq->last_color) {
if ((*q_service)(cq->vdev, cq->index, desc))
break;
cq->to_clean++;
if (cq->to_clean == cq->ring.desc_count) {
cq->to_clean = 0;
cq->last_color = cq->last_color ? 0 : 1;
}
desc = (struct snic_fw_req *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
snic_color_dec(desc, &color);
work_done++;
if (work_done >= work_to_do)
break;
}
return work_done;
}
#endif /* _VNIC_CQ_FW_H_ */