drivers/scsi/bnx2i/bnx2i_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bnx2i/bnx2i_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bnx2i/bnx2i_sysfs.c- Extension
.c- Size
- 4126 bytes
- Lines
- 159
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bnx2i.h
Detected Declarations
function bnx2i_show_sq_infofunction bnx2i_set_sq_infofunction bnx2i_show_ccell_infofunction bnx2i_set_ccell_info
Annotated Snippet
#include "bnx2i.h"
/**
* bnx2i_dev_to_hba - maps dev pointer to adapter struct
* @dev: device pointer
*
* Map device to hba structure
*/
static inline struct bnx2i_hba *bnx2i_dev_to_hba(struct device *dev)
{
struct Scsi_Host *shost = class_to_shost(dev);
return iscsi_host_priv(shost);
}
/**
* bnx2i_show_sq_info - return(s currently configured send queue (SQ) size
* @dev: device pointer
* @attr: device attribute (unused)
* @buf: buffer to return current SQ size parameter
*
* Returns current SQ size parameter, this paramater determines the number
* outstanding iSCSI commands supported on a connection
*/
static ssize_t bnx2i_show_sq_info(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba = bnx2i_dev_to_hba(dev);
return sprintf(buf, "0x%x\n", hba->max_sqes);
}
/**
* bnx2i_set_sq_info - update send queue (SQ) size parameter
* @dev: device pointer
* @attr: device attribute (unused)
* @buf: buffer to return current SQ size parameter
* @count: parameter buffer size
*
* Interface for user to change shared queue size allocated for each conn
* Must be within SQ limits and a power of 2. For the latter this is needed
* because of how libiscsi preallocates tasks.
*/
static ssize_t bnx2i_set_sq_info(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct bnx2i_hba *hba = bnx2i_dev_to_hba(dev);
u32 val;
int max_sq_size;
if (hba->ofld_conns_active)
goto skip_config;
if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type))
max_sq_size = BNX2I_5770X_SQ_WQES_MAX;
else
max_sq_size = BNX2I_570X_SQ_WQES_MAX;
if (sscanf(buf, " 0x%x ", &val) > 0) {
if ((val >= BNX2I_SQ_WQES_MIN) && (val <= max_sq_size) &&
(is_power_of_2(val)))
hba->max_sqes = val;
}
return count;
skip_config:
printk(KERN_ERR "bnx2i: device busy, cannot change SQ size\n");
return 0;
}
/**
* bnx2i_show_ccell_info - returns command cell (HQ) size
* @dev: device pointer
* @attr: device attribute (unused)
* @buf: buffer to return current SQ size parameter
*
* returns per-connection TCP history queue size parameter
*/
static ssize_t bnx2i_show_ccell_info(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba = bnx2i_dev_to_hba(dev);
return sprintf(buf, "0x%x\n", hba->num_ccell);
}
Annotation
- Immediate include surface: `bnx2i.h`.
- Detected declarations: `function bnx2i_show_sq_info`, `function bnx2i_set_sq_info`, `function bnx2i_show_ccell_info`, `function bnx2i_set_ccell_info`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.