Skip to content

Commit c8806b6

Browse files
Narsimhulu MusiniJames Bottomley
authored andcommitted
snic: driver for Cisco SCSI HBA
Cisco has developed a new PCI HBA interface called sNIC, which stands for SCSI NIC. This is a new storage feature supported on specialized network adapter. The new PCI function provides a uniform host interface and abstracts backend storage. [jejb: fix up checkpatch errors] Signed-off-by: Narsimhulu Musini <[email protected]> Signed-off-by: Sesidhar Baddela <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent 8d2b21d commit c8806b6

37 files changed

+10263
-0
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,6 +2590,13 @@ L: [email protected]
25902590
S: Supported
25912591
F: drivers/scsi/fnic/
25922592

2593+
CISCO SCSI HBA DRIVER
2594+
M: Narsimhulu Musini <[email protected]>
2595+
M: Sesidhar Baddela <[email protected]>
2596+
2597+
S: Supported
2598+
F: drivers/scsi/snic/
2599+
25932600
CMPC ACPI DRIVER
25942601
M: Thadeu Lima de Souza Cascardo <[email protected]>
25952602
M: Daniel Oliveira Nascimento <[email protected]>

drivers/scsi/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,23 @@ config FCOE_FNIC
634634
<file:Documentation/scsi/scsi.txt>.
635635
The module will be called fnic.
636636

637+
config SCSI_SNIC
638+
tristate "Cisco SNIC Driver"
639+
depends on PCI && SCSI
640+
help
641+
This is support for the Cisco PCI-Express SCSI HBA.
642+
643+
To compile this driver as a module, choose M here and read
644+
<file:Documentation/scsi/scsi.txt>.
645+
The module will be called snic.
646+
647+
config SCSI_SNIC_DEBUG_FS
648+
bool "Cisco SNIC Driver Debugfs Support"
649+
depends on SCSI_SNIC && DEBUG_FS
650+
help
651+
This enables to list debugging information from SNIC Driver
652+
available via debugfs file system
653+
637654
config SCSI_DMX3191D
638655
tristate "DMX3191D SCSI support"
639656
depends on PCI && SCSI

drivers/scsi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ obj-$(CONFIG_LIBFC) += libfc/
3939
obj-$(CONFIG_LIBFCOE) += fcoe/
4040
obj-$(CONFIG_FCOE) += fcoe/
4141
obj-$(CONFIG_FCOE_FNIC) += fnic/
42+
obj-$(CONFIG_SCSI_SNIC) += snic/
4243
obj-$(CONFIG_SCSI_BNX2X_FCOE) += libfc/ fcoe/ bnx2fc/
4344
obj-$(CONFIG_ISCSI_TCP) += libiscsi.o libiscsi_tcp.o iscsi_tcp.o
4445
obj-$(CONFIG_INFINIBAND_ISER) += libiscsi.o

drivers/scsi/snic/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
obj-$(CONFIG_SCSI_SNIC) += snic.o
2+
3+
snic-y := \
4+
snic_attrs.o \
5+
snic_main.o \
6+
snic_res.o \
7+
snic_isr.o \
8+
snic_ctl.o \
9+
snic_io.o \
10+
snic_scsi.o \
11+
snic_disc.o \
12+
vnic_cq.o \
13+
vnic_intr.o \
14+
vnic_dev.o \
15+
vnic_wq.o
16+
17+
snic-$(CONFIG_SCSI_SNIC_DEBUG_FS) += snic_debugfs.o snic_trc.o

drivers/scsi/snic/cq_desc.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright 2014 Cisco Systems, Inc. All rights reserved.
3+
*
4+
* This program is free software; you may redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; version 2 of the License.
7+
*
8+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15+
* SOFTWARE.
16+
*/
17+
18+
#ifndef _CQ_DESC_H_
19+
#define _CQ_DESC_H_
20+
21+
/*
22+
* Completion queue descriptor types
23+
*/
24+
enum cq_desc_types {
25+
CQ_DESC_TYPE_WQ_ENET = 0,
26+
CQ_DESC_TYPE_DESC_COPY = 1,
27+
CQ_DESC_TYPE_WQ_EXCH = 2,
28+
CQ_DESC_TYPE_RQ_ENET = 3,
29+
CQ_DESC_TYPE_RQ_FCP = 4,
30+
};
31+
32+
/* Completion queue descriptor: 16B
33+
*
34+
* All completion queues have this basic layout. The
35+
* type_specific area is unique for each completion
36+
* queue type.
37+
*/
38+
struct cq_desc {
39+
__le16 completed_index;
40+
__le16 q_number;
41+
u8 type_specific[11];
42+
u8 type_color;
43+
};
44+
45+
#define CQ_DESC_TYPE_BITS 4
46+
#define CQ_DESC_TYPE_MASK ((1 << CQ_DESC_TYPE_BITS) - 1)
47+
#define CQ_DESC_COLOR_MASK 1
48+
#define CQ_DESC_COLOR_SHIFT 7
49+
#define CQ_DESC_Q_NUM_BITS 10
50+
#define CQ_DESC_Q_NUM_MASK ((1 << CQ_DESC_Q_NUM_BITS) - 1)
51+
#define CQ_DESC_COMP_NDX_BITS 12
52+
#define CQ_DESC_COMP_NDX_MASK ((1 << CQ_DESC_COMP_NDX_BITS) - 1)
53+
54+
static inline void cq_desc_dec(const struct cq_desc *desc_arg,
55+
u8 *type, u8 *color, u16 *q_number, u16 *completed_index)
56+
{
57+
const struct cq_desc *desc = desc_arg;
58+
const u8 type_color = desc->type_color;
59+
60+
*color = (type_color >> CQ_DESC_COLOR_SHIFT) & CQ_DESC_COLOR_MASK;
61+
62+
/*
63+
* Make sure color bit is read from desc *before* other fields
64+
* are read from desc. Hardware guarantees color bit is last
65+
* bit (byte) written. Adding the rmb() prevents the compiler
66+
* and/or CPU from reordering the reads which would potentially
67+
* result in reading stale values.
68+
*/
69+
rmb();
70+
71+
*type = type_color & CQ_DESC_TYPE_MASK;
72+
*q_number = le16_to_cpu(desc->q_number) & CQ_DESC_Q_NUM_MASK;
73+
*completed_index = le16_to_cpu(desc->completed_index) &
74+
CQ_DESC_COMP_NDX_MASK;
75+
}
76+
77+
#endif /* _CQ_DESC_H_ */

drivers/scsi/snic/cq_enet_desc.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2014 Cisco Systems, Inc. All rights reserved.
3+
*
4+
* This program is free software; you may redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; version 2 of the License.
7+
*
8+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15+
* SOFTWARE.
16+
*/
17+
18+
#ifndef _CQ_ENET_DESC_H_
19+
#define _CQ_ENET_DESC_H_
20+
21+
#include "cq_desc.h"
22+
23+
/* Ethernet completion queue descriptor: 16B */
24+
struct cq_enet_wq_desc {
25+
__le16 completed_index;
26+
__le16 q_number;
27+
u8 reserved[11];
28+
u8 type_color;
29+
};
30+
31+
static inline void cq_enet_wq_desc_dec(struct cq_enet_wq_desc *desc,
32+
u8 *type, u8 *color, u16 *q_number, u16 *completed_index)
33+
{
34+
cq_desc_dec((struct cq_desc *)desc, type,
35+
color, q_number, completed_index);
36+
}
37+
38+
#endif /* _CQ_ENET_DESC_H_ */

0 commit comments

Comments
 (0)