Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24d3f95a authored by kxie@chelsio.com's avatar kxie@chelsio.com Committed by James Bottomley
Browse files

[SCSI] cxgbi: rename alloc_cpl to alloc_wr

parent d24099df
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -320,7 +320,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 credits)
		"csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n",
		"csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n",
		csk, csk->state, csk->flags, csk->tid, credits, dack);
		csk, csk->state, csk->flags, csk->tid, credits, dack);


	skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC);
	skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
	if (!skb) {
	if (!skb) {
		pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits);
		pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits);
		return 0;
		return 0;
@@ -572,7 +572,7 @@ static void act_open_retry_timer(unsigned long data)


	cxgbi_sock_get(csk);
	cxgbi_sock_get(csk);
	spin_lock_bh(&csk->lock);
	spin_lock_bh(&csk->lock);
	skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
	skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
	if (!skb)
	if (!skb)
		cxgbi_sock_fail_act_open(csk, -ENOMEM);
		cxgbi_sock_fail_act_open(csk, -ENOMEM);
	else {
	else {
@@ -881,16 +881,16 @@ static int do_wr_ack(struct t3cdev *cdev, struct sk_buff *skb, void *ctx)
 */
 */
static int alloc_cpls(struct cxgbi_sock *csk)
static int alloc_cpls(struct cxgbi_sock *csk)
{
{
	csk->cpl_close = alloc_cpl(sizeof(struct cpl_close_con_req), 0,
	csk->cpl_close = alloc_wr(sizeof(struct cpl_close_con_req), 0,
					GFP_KERNEL);
					GFP_KERNEL);
	if (!csk->cpl_close)
	if (!csk->cpl_close)
		return -ENOMEM;
		return -ENOMEM;
	csk->cpl_abort_req = alloc_cpl(sizeof(struct cpl_abort_req), 0,
	csk->cpl_abort_req = alloc_wr(sizeof(struct cpl_abort_req), 0,
					GFP_KERNEL);
					GFP_KERNEL);
	if (!csk->cpl_abort_req)
	if (!csk->cpl_abort_req)
		goto free_cpl_skbs;
		goto free_cpl_skbs;


	csk->cpl_abort_rpl = alloc_cpl(sizeof(struct cpl_abort_rpl), 0,
	csk->cpl_abort_rpl = alloc_wr(sizeof(struct cpl_abort_rpl), 0,
					GFP_KERNEL);
					GFP_KERNEL);
	if (!csk->cpl_abort_rpl)
	if (!csk->cpl_abort_rpl)
		goto free_cpl_skbs;
		goto free_cpl_skbs;
@@ -972,7 +972,7 @@ static int init_act_open(struct cxgbi_sock *csk)
	cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
	cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
	cxgbi_sock_get(csk);
	cxgbi_sock_get(csk);


	skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
	skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
	if (!skb)
	if (!skb)
		goto rel_resource;
		goto rel_resource;
	skb->sk = (struct sock *)csk;
	skb->sk = (struct sock *)csk;
@@ -1141,7 +1141,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,
		"ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);
		"ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);


	for (i = 0; i < cnt; i++) {
	for (i = 0; i < cnt; i++) {
		struct sk_buff *skb = alloc_cpl(sizeof(struct ulp_mem_io) +
		struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
						PPOD_SIZE, 0, gfp);
						PPOD_SIZE, 0, gfp);
		if (skb) {
		if (skb) {
			ddp->gl_skb[idx + i] = skb;
			ddp->gl_skb[idx + i] = skb;
@@ -1156,7 +1156,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,
static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
				       unsigned int tid, int pg_idx, bool reply)
				       unsigned int tid, int pg_idx, bool reply)
{
{
	struct sk_buff *skb = alloc_cpl(sizeof(struct cpl_set_tcb_field), 0,
	struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
					GFP_KERNEL);
					GFP_KERNEL);
	struct cpl_set_tcb_field *req;
	struct cpl_set_tcb_field *req;
	u64 val = pg_idx < DDP_PGIDX_MAX ? pg_idx : 0;
	u64 val = pg_idx < DDP_PGIDX_MAX ? pg_idx : 0;
@@ -1193,7 +1193,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
			     int hcrc, int dcrc, int reply)
			     int hcrc, int dcrc, int reply)
{
{
	struct sk_buff *skb = alloc_cpl(sizeof(struct cpl_set_tcb_field), 0,
	struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
					GFP_KERNEL);
					GFP_KERNEL);
	struct cpl_set_tcb_field *req;
	struct cpl_set_tcb_field *req;
	u64 val = (hcrc ? 1 : 0) | (dcrc ? 2 : 0);
	u64 val = (hcrc ? 1 : 0) | (dcrc ? 2 : 0);
+14 −14
Original line number Original line Diff line number Diff line
@@ -332,7 +332,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 credits)
		"csk 0x%p,%u,0x%lx,%u, credit %u.\n",
		"csk 0x%p,%u,0x%lx,%u, credit %u.\n",
		csk, csk->state, csk->flags, csk->tid, credits);
		csk, csk->state, csk->flags, csk->tid, credits);


	skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC);
	skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
	if (!skb) {
	if (!skb) {
		pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits);
		pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits);
		return 0;
		return 0;
@@ -388,7 +388,7 @@ static inline void send_tx_flowc_wr(struct cxgbi_sock *csk)
	int flowclen, i;
	int flowclen, i;


	flowclen = 80;
	flowclen = 80;
	skb = alloc_cpl(flowclen, 0, GFP_ATOMIC);
	skb = alloc_wr(flowclen, 0, GFP_ATOMIC);
	flowc = (struct fw_flowc_wr *)skb->head;
	flowc = (struct fw_flowc_wr *)skb->head;
	flowc->op_to_nparams =
	flowc->op_to_nparams =
		htonl(FW_WR_OP(FW_FLOWC_WR) | FW_FLOWC_WR_NPARAMS(8));
		htonl(FW_WR_OP(FW_FLOWC_WR) | FW_FLOWC_WR_NPARAMS(8));
@@ -651,7 +651,7 @@ static void csk_act_open_retry_timer(unsigned long data)


	cxgbi_sock_get(csk);
	cxgbi_sock_get(csk);
	spin_lock_bh(&csk->lock);
	spin_lock_bh(&csk->lock);
	skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
	skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
	if (!skb)
	if (!skb)
		cxgbi_sock_fail_act_open(csk, -ENOMEM);
		cxgbi_sock_fail_act_open(csk, -ENOMEM);
	else {
	else {
@@ -1073,18 +1073,18 @@ static void do_set_tcb_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)


static int alloc_cpls(struct cxgbi_sock *csk)
static int alloc_cpls(struct cxgbi_sock *csk)
{
{
	csk->cpl_close = alloc_cpl(sizeof(struct cpl_close_con_req),
	csk->cpl_close = alloc_wr(sizeof(struct cpl_close_con_req),
					0, GFP_NOIO);
					0, GFP_KERNEL);
	if (!csk->cpl_close)
	if (!csk->cpl_close)
		return -ENOMEM;
		return -ENOMEM;


	csk->cpl_abort_req = alloc_cpl(sizeof(struct cpl_abort_req),
	csk->cpl_abort_req = alloc_wr(sizeof(struct cpl_abort_req),
					0, GFP_NOIO);
					0, GFP_KERNEL);
	if (!csk->cpl_abort_req)
	if (!csk->cpl_abort_req)
		goto free_cpls;
		goto free_cpls;


	csk->cpl_abort_rpl = alloc_cpl(sizeof(struct cpl_abort_rpl),
	csk->cpl_abort_rpl = alloc_wr(sizeof(struct cpl_abort_rpl),
					0, GFP_NOIO);
					0, GFP_KERNEL);
	if (!csk->cpl_abort_rpl)
	if (!csk->cpl_abort_rpl)
		goto free_cpls;
		goto free_cpls;
	return 0;
	return 0;
@@ -1158,7 +1158,7 @@ static int init_act_open(struct cxgbi_sock *csk)
	}
	}
	cxgbi_sock_get(csk);
	cxgbi_sock_get(csk);


	skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_NOIO);
	skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
	if (!skb)
	if (!skb)
		goto rel_resource;
		goto rel_resource;
	skb->sk = (struct sock *)csk;
	skb->sk = (struct sock *)csk;
@@ -1268,7 +1268,7 @@ static int ddp_ppod_write_sgl(struct cxgbi_device *cdev, unsigned int port_id,
	dlen = PPOD_SIZE * npods;
	dlen = PPOD_SIZE * npods;
	pm_addr = idx * PPOD_SIZE + ddp->llimit;
	pm_addr = idx * PPOD_SIZE + ddp->llimit;


	skb = alloc_cpl(sizeof(*req) + sizeof(*sgl), dlen, GFP_ATOMIC);
	skb = alloc_wr(sizeof(*req) + sizeof(*sgl), dlen, GFP_ATOMIC);
	if (!skb) {
	if (!skb) {
		pr_err("cdev 0x%p, idx %u, npods %u, OOM.\n",
		pr_err("cdev 0x%p, idx %u, npods %u, OOM.\n",
			cdev, idx, npods);
			cdev, idx, npods);
@@ -1339,7 +1339,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid,
	if (!pg_idx)
	if (!pg_idx)
		return 0;
		return 0;


	skb = alloc_cpl(sizeof(*req), 0, GFP_KERNEL);
	skb = alloc_wr(sizeof(*req), 0, GFP_KERNEL);
	if (!skb)
	if (!skb)
		return -ENOMEM;
		return -ENOMEM;


@@ -1373,7 +1373,7 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
	val = TCB_ULP_RAW(val);
	val = TCB_ULP_RAW(val);
	val |= TCB_ULP_TYPE(ULP2_MODE_ISCSI);
	val |= TCB_ULP_TYPE(ULP2_MODE_ISCSI);


	skb = alloc_cpl(sizeof(*req), 0, GFP_KERNEL);
	skb = alloc_wr(sizeof(*req), 0, GFP_KERNEL);
	if (!skb)
	if (!skb)
		return -ENOMEM;
		return -ENOMEM;


@@ -1516,7 +1516,7 @@ static int t4_uld_rx_handler(void *handle, const __be64 *rsp,
	if (pgl == NULL) {
	if (pgl == NULL) {
		unsigned int len = 64 - sizeof(struct rsp_ctrl) - 8;
		unsigned int len = 64 - sizeof(struct rsp_ctrl) - 8;


		skb = alloc_cpl(len, 0, GFP_ATOMIC);
		skb = alloc_wr(len, 0, GFP_ATOMIC);
		if (!skb)
		if (!skb)
			goto nomem;
			goto nomem;
		skb_copy_to_linear_data(skb, &rsp[1], len);
		skb_copy_to_linear_data(skb, &rsp[1], len);
+2 −3
Original line number Original line Diff line number Diff line
@@ -410,16 +410,15 @@ static inline unsigned int cxgbi_sock_compute_wscale(unsigned int win)
	return wscale;
	return wscale;
}
}


static inline struct sk_buff *alloc_cpl(int cpl_len, int dlen, gfp_t gfp)
static inline struct sk_buff *alloc_wr(int wrlen, int dlen, gfp_t gfp)
{
{
	int wrlen = roundup(cpl_len, 16);
	struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp);
	struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp);


	if (skb) {
	if (skb) {
		__skb_put(skb, wrlen);
		__skb_put(skb, wrlen);
		memset(skb->head, 0, wrlen + dlen);
		memset(skb->head, 0, wrlen + dlen);
	} else
	} else
		pr_info("alloc cpl skb %u+%u, OOM.\n", cpl_len, dlen);
		pr_info("alloc cpl wr skb %u+%u, OOM.\n", wrlen, dlen);
	return skb;
	return skb;
}
}