diff options
Diffstat (limited to 'drivers/scsi/cxgbi/cxgb3i')
-rw-r--r-- | drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 56 | ||||
-rw-r--r-- | drivers/scsi/cxgbi/cxgb3i/cxgb3i.h | 19 |
2 files changed, 25 insertions, 50 deletions
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index a129a170b47b..fc2cdb62f53b 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | |||
@@ -105,7 +105,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = { | |||
105 | /* owner and name should be set already */ | 105 | /* owner and name should be set already */ |
106 | .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST | 106 | .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST |
107 | | CAP_DATADGST | CAP_DIGEST_OFFLOAD | | 107 | | CAP_DATADGST | CAP_DIGEST_OFFLOAD | |
108 | CAP_PADDING_OFFLOAD, | 108 | CAP_PADDING_OFFLOAD | CAP_TEXT_NEGO, |
109 | .param_mask = ISCSI_MAX_RECV_DLENGTH | ISCSI_MAX_XMIT_DLENGTH | | 109 | .param_mask = ISCSI_MAX_RECV_DLENGTH | ISCSI_MAX_XMIT_DLENGTH | |
110 | ISCSI_HDRDGST_EN | ISCSI_DATADGST_EN | | 110 | ISCSI_HDRDGST_EN | ISCSI_DATADGST_EN | |
111 | ISCSI_INITIAL_R2T_EN | ISCSI_MAX_R2T | | 111 | ISCSI_INITIAL_R2T_EN | ISCSI_MAX_R2T | |
@@ -137,7 +137,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = { | |||
137 | .destroy_conn = iscsi_tcp_conn_teardown, | 137 | .destroy_conn = iscsi_tcp_conn_teardown, |
138 | .start_conn = iscsi_conn_start, | 138 | .start_conn = iscsi_conn_start, |
139 | .stop_conn = iscsi_conn_stop, | 139 | .stop_conn = iscsi_conn_stop, |
140 | .get_conn_param = cxgbi_get_conn_param, | 140 | .get_conn_param = iscsi_conn_get_param, |
141 | .set_param = cxgbi_set_conn_param, | 141 | .set_param = cxgbi_set_conn_param, |
142 | .get_stats = cxgbi_get_conn_stats, | 142 | .get_stats = cxgbi_get_conn_stats, |
143 | /* pdu xmit req from user space */ | 143 | /* pdu xmit req from user space */ |
@@ -152,6 +152,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = { | |||
152 | .xmit_pdu = cxgbi_conn_xmit_pdu, | 152 | .xmit_pdu = cxgbi_conn_xmit_pdu, |
153 | .parse_pdu_itt = cxgbi_parse_pdu_itt, | 153 | .parse_pdu_itt = cxgbi_parse_pdu_itt, |
154 | /* TCP connect/disconnect */ | 154 | /* TCP connect/disconnect */ |
155 | .get_ep_param = cxgbi_get_ep_param, | ||
155 | .ep_connect = cxgbi_ep_connect, | 156 | .ep_connect = cxgbi_ep_connect, |
156 | .ep_poll = cxgbi_ep_poll, | 157 | .ep_poll = cxgbi_ep_poll, |
157 | .ep_disconnect = cxgbi_ep_disconnect, | 158 | .ep_disconnect = cxgbi_ep_disconnect, |
@@ -1108,10 +1109,11 @@ static int ddp_set_map(struct cxgbi_sock *csk, struct cxgbi_pagepod_hdr *hdr, | |||
1108 | csk, idx, npods, gl); | 1109 | csk, idx, npods, gl); |
1109 | 1110 | ||
1110 | for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) { | 1111 | for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) { |
1111 | struct sk_buff *skb = ddp->gl_skb[idx]; | 1112 | struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) + |
1113 | PPOD_SIZE, 0, GFP_ATOMIC); | ||
1112 | 1114 | ||
1113 | /* hold on to the skb until we clear the ddp mapping */ | 1115 | if (!skb) |
1114 | skb_get(skb); | 1116 | return -ENOMEM; |
1115 | 1117 | ||
1116 | ulp_mem_io_set_hdr(skb, pm_addr); | 1118 | ulp_mem_io_set_hdr(skb, pm_addr); |
1117 | cxgbi_ddp_ppod_set((struct cxgbi_pagepod *)(skb->head + | 1119 | cxgbi_ddp_ppod_set((struct cxgbi_pagepod *)(skb->head + |
@@ -1136,56 +1138,20 @@ static void ddp_clear_map(struct cxgbi_hba *chba, unsigned int tag, | |||
1136 | cdev, idx, npods, tag); | 1138 | cdev, idx, npods, tag); |
1137 | 1139 | ||
1138 | for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) { | 1140 | for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) { |
1139 | struct sk_buff *skb = ddp->gl_skb[idx]; | 1141 | struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) + |
1142 | PPOD_SIZE, 0, GFP_ATOMIC); | ||
1140 | 1143 | ||
1141 | if (!skb) { | 1144 | if (!skb) { |
1142 | pr_err("tag 0x%x, 0x%x, %d/%u, skb NULL.\n", | 1145 | pr_err("tag 0x%x, 0x%x, %d/%u, skb OOM.\n", |
1143 | tag, idx, i, npods); | 1146 | tag, idx, i, npods); |
1144 | continue; | 1147 | continue; |
1145 | } | 1148 | } |
1146 | ddp->gl_skb[idx] = NULL; | ||
1147 | memset(skb->head + sizeof(struct ulp_mem_io), 0, PPOD_SIZE); | ||
1148 | ulp_mem_io_set_hdr(skb, pm_addr); | 1149 | ulp_mem_io_set_hdr(skb, pm_addr); |
1149 | skb->priority = CPL_PRIORITY_CONTROL; | 1150 | skb->priority = CPL_PRIORITY_CONTROL; |
1150 | cxgb3_ofld_send(cdev->lldev, skb); | 1151 | cxgb3_ofld_send(cdev->lldev, skb); |
1151 | } | 1152 | } |
1152 | } | 1153 | } |
1153 | 1154 | ||
1154 | static void ddp_free_gl_skb(struct cxgbi_ddp_info *ddp, int idx, int cnt) | ||
1155 | { | ||
1156 | int i; | ||
1157 | |||
1158 | log_debug(1 << CXGBI_DBG_DDP, | ||
1159 | "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt); | ||
1160 | |||
1161 | for (i = 0; i < cnt; i++, idx++) | ||
1162 | if (ddp->gl_skb[idx]) { | ||
1163 | kfree_skb(ddp->gl_skb[idx]); | ||
1164 | ddp->gl_skb[idx] = NULL; | ||
1165 | } | ||
1166 | } | ||
1167 | |||
1168 | static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx, | ||
1169 | int cnt, gfp_t gfp) | ||
1170 | { | ||
1171 | int i; | ||
1172 | |||
1173 | log_debug(1 << CXGBI_DBG_DDP, | ||
1174 | "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt); | ||
1175 | |||
1176 | for (i = 0; i < cnt; i++) { | ||
1177 | struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) + | ||
1178 | PPOD_SIZE, 0, gfp); | ||
1179 | if (skb) | ||
1180 | ddp->gl_skb[idx + i] = skb; | ||
1181 | else { | ||
1182 | ddp_free_gl_skb(ddp, idx, i); | ||
1183 | return -ENOMEM; | ||
1184 | } | ||
1185 | } | ||
1186 | return 0; | ||
1187 | } | ||
1188 | |||
1189 | static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, | 1155 | static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, |
1190 | unsigned int tid, int pg_idx, bool reply) | 1156 | unsigned int tid, int pg_idx, bool reply) |
1191 | { | 1157 | { |
@@ -1316,8 +1282,6 @@ static int cxgb3i_ddp_init(struct cxgbi_device *cdev) | |||
1316 | } | 1282 | } |
1317 | tdev->ulp_iscsi = ddp; | 1283 | tdev->ulp_iscsi = ddp; |
1318 | 1284 | ||
1319 | cdev->csk_ddp_free_gl_skb = ddp_free_gl_skb; | ||
1320 | cdev->csk_ddp_alloc_gl_skb = ddp_alloc_gl_skb; | ||
1321 | cdev->csk_ddp_setup_digest = ddp_setup_conn_digest; | 1285 | cdev->csk_ddp_setup_digest = ddp_setup_conn_digest; |
1322 | cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx; | 1286 | cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx; |
1323 | cdev->csk_ddp_set = ddp_set_map; | 1287 | cdev->csk_ddp_set = ddp_set_map; |
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h index 5f5e3394b594..20593fd69d8f 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h | |||
@@ -24,10 +24,21 @@ | |||
24 | 24 | ||
25 | extern cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS]; | 25 | extern cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS]; |
26 | 26 | ||
27 | #define cxgb3i_get_private_ipv4addr(ndev) \ | 27 | static inline unsigned int cxgb3i_get_private_ipv4addr(struct net_device *ndev) |
28 | (((struct port_info *)(netdev_priv(ndev)))->iscsi_ipv4addr) | 28 | { |
29 | #define cxgb3i_set_private_ipv4addr(ndev, addr) \ | 29 | return ((struct port_info *)(netdev_priv(ndev)))->iscsi_ipv4addr; |
30 | (((struct port_info *)(netdev_priv(ndev)))->iscsi_ipv4addr) = addr | 30 | } |
31 | |||
32 | static inline void cxgb3i_set_private_ipv4addr(struct net_device *ndev, | ||
33 | unsigned int addr) | ||
34 | { | ||
35 | struct port_info *pi = (struct port_info *)netdev_priv(ndev); | ||
36 | |||
37 | pi->iscsic.flags = addr ? 1 : 0; | ||
38 | pi->iscsi_ipv4addr = addr; | ||
39 | if (addr) | ||
40 | memcpy(pi->iscsic.mac_addr, ndev->dev_addr, ETH_ALEN); | ||
41 | } | ||
31 | 42 | ||
32 | struct cpl_iscsi_hdr_norss { | 43 | struct cpl_iscsi_hdr_norss { |
33 | union opcode_tid ot; | 44 | union opcode_tid ot; |