Skip to content

Commit

Permalink
[SCSI] cxgbi: get rid of gl_skb in cxgbi_ddp_info
Browse files Browse the repository at this point in the history
Remove gl_skb from cxgbi_ddp_info as it is only used by cxgb3i.

Signed-off-by: Karen Xie <kxie@chelsio.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
kxie@chelsio.com authored and James Bottomley committed Jan 24, 2011
1 parent c343a01 commit b8ce8b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 63 deletions.
51 changes: 7 additions & 44 deletions drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,10 +1108,11 @@ static int ddp_set_map(struct cxgbi_sock *csk, struct cxgbi_pagepod_hdr *hdr,
csk, idx, npods, gl);

for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) {
struct sk_buff *skb = ddp->gl_skb[idx];
struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
PPOD_SIZE, 0, GFP_ATOMIC);

/* hold on to the skb until we clear the ddp mapping */
skb_get(skb);
if (!skb)
return -ENOMEM;

ulp_mem_io_set_hdr(skb, pm_addr);
cxgbi_ddp_ppod_set((struct cxgbi_pagepod *)(skb->head +
Expand All @@ -1136,56 +1137,20 @@ static void ddp_clear_map(struct cxgbi_hba *chba, unsigned int tag,
cdev, idx, npods, tag);

for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) {
struct sk_buff *skb = ddp->gl_skb[idx];
struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
PPOD_SIZE, 0, GFP_ATOMIC);

if (!skb) {
pr_err("tag 0x%x, 0x%x, %d/%u, skb NULL.\n",
pr_err("tag 0x%x, 0x%x, %d/%u, skb OOM.\n",
tag, idx, i, npods);
continue;
}
ddp->gl_skb[idx] = NULL;
memset(skb->head + sizeof(struct ulp_mem_io), 0, PPOD_SIZE);
ulp_mem_io_set_hdr(skb, pm_addr);
skb->priority = CPL_PRIORITY_CONTROL;
cxgb3_ofld_send(cdev->lldev, skb);
}
}

static void ddp_free_gl_skb(struct cxgbi_ddp_info *ddp, int idx, int cnt)
{
int i;

log_debug(1 << CXGBI_DBG_DDP,
"ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);

for (i = 0; i < cnt; i++, idx++)
if (ddp->gl_skb[idx]) {
kfree_skb(ddp->gl_skb[idx]);
ddp->gl_skb[idx] = NULL;
}
}

static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,
int cnt, gfp_t gfp)
{
int i;

log_debug(1 << CXGBI_DBG_DDP,
"ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);

for (i = 0; i < cnt; i++) {
struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
PPOD_SIZE, 0, gfp);
if (skb)
ddp->gl_skb[idx + i] = skb;
else {
ddp_free_gl_skb(ddp, idx, i);
return -ENOMEM;
}
}
return 0;
}

static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
unsigned int tid, int pg_idx, bool reply)
{
Expand Down Expand Up @@ -1316,8 +1281,6 @@ static int cxgb3i_ddp_init(struct cxgbi_device *cdev)
}
tdev->ulp_iscsi = ddp;

cdev->csk_ddp_free_gl_skb = ddp_free_gl_skb;
cdev->csk_ddp_alloc_gl_skb = ddp_alloc_gl_skb;
cdev->csk_ddp_setup_digest = ddp_setup_conn_digest;
cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx;
cdev->csk_ddp_set = ddp_set_map;
Expand Down
2 changes: 0 additions & 2 deletions drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,6 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev)
cxgbi_ddp_page_size_factor(pgsz_factor);
cxgb4_iscsi_init(lldi->ports[0], tagmask, pgsz_factor);

cdev->csk_ddp_free_gl_skb = NULL;
cdev->csk_ddp_alloc_gl_skb = NULL;
cdev->csk_ddp_setup_digest = ddp_setup_conn_digest;
cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx;
cdev->csk_ddp_set = ddp_set_map;
Expand Down
15 changes: 1 addition & 14 deletions drivers/scsi/cxgbi/libcxgbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,12 +1277,6 @@ static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid,
return idx;
}

if (cdev->csk_ddp_alloc_gl_skb) {
err = cdev->csk_ddp_alloc_gl_skb(ddp, idx, npods, gfp);
if (err < 0)
goto unmark_entries;
}

tag = cxgbi_ddp_tag_base(tformat, sw_tag);
tag |= idx << PPOD_IDX_SHIFT;

Expand All @@ -1293,11 +1287,8 @@ static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid,
hdr.page_offset = htonl(gl->offset);

err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl);
if (err < 0) {
if (cdev->csk_ddp_free_gl_skb)
cdev->csk_ddp_free_gl_skb(ddp, idx, npods);
if (err < 0)
goto unmark_entries;
}

ddp->idx_last = idx;
log_debug(1 << CXGBI_DBG_DDP,
Expand Down Expand Up @@ -1363,8 +1354,6 @@ static void ddp_destroy(struct kref *kref)
>> PPOD_PAGES_SHIFT;
pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods);
kfree(gl);
if (cdev->csk_ddp_free_gl_skb)
cdev->csk_ddp_free_gl_skb(ddp, i, npods);
i += npods;
} else
i++;
Expand Down Expand Up @@ -1407,8 +1396,6 @@ int cxgbi_ddp_init(struct cxgbi_device *cdev,
return -ENOMEM;
}
ddp->gl_map = (struct cxgbi_gather_list **)(ddp + 1);
ddp->gl_skb = (struct sk_buff **)(((char *)ddp->gl_map) +
ppmax * sizeof(struct cxgbi_gather_list *));
cdev->ddp = ddp;

spin_lock_init(&ddp->map_lock);
Expand Down
3 changes: 0 additions & 3 deletions drivers/scsi/cxgbi/libcxgbi.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ struct cxgbi_ddp_info {
unsigned int rsvd_tag_mask;
spinlock_t map_lock;
struct cxgbi_gather_list **gl_map;
struct sk_buff **gl_skb;
};

#define DDP_PGIDX_MAX 4
Expand Down Expand Up @@ -536,8 +535,6 @@ struct cxgbi_device {
struct cxgbi_ddp_info *ddp;

void (*dev_ddp_cleanup)(struct cxgbi_device *);
void (*csk_ddp_free_gl_skb)(struct cxgbi_ddp_info *, int, int);
int (*csk_ddp_alloc_gl_skb)(struct cxgbi_ddp_info *, int, int, gfp_t);
int (*csk_ddp_set)(struct cxgbi_sock *, struct cxgbi_pagepod_hdr *,
unsigned int, unsigned int,
struct cxgbi_gather_list *);
Expand Down

0 comments on commit b8ce8b5

Please sign in to comment.