diff options
author | John Soni Jose <sony.john-n@emulex.com> | 2012-10-19 19:14:35 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-11-26 23:59:40 -0500 |
commit | acb9693cb007e126fd313cb696dfbf5c214514cd (patch) | |
tree | 5d98e790384346133f81336052b3657da8f01143 /drivers/scsi/be2iscsi/be_mgmt.c | |
parent | 09a1093a292aa88af836f4fb3b604af9aa1ece3d (diff) |
[SCSI] be2iscsi: Fix session update context with V2 version.
For updating session context on adapter, V2 version is to
be used with the latest adapter. This fix checks for the adapter type
and uses correct version of session context.
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_mgmt.c')
-rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.c | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 1ec1db3a1465..b96a159b12c3 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -1152,3 +1152,142 @@ beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr, | |||
1152 | { | 1152 | { |
1153 | return snprintf(buf, PAGE_SIZE, BE_NAME "\n"); | 1153 | return snprintf(buf, PAGE_SIZE, BE_NAME "\n"); |
1154 | } | 1154 | } |
1155 | |||
1156 | void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params, | ||
1157 | struct wrb_handle *pwrb_handle, | ||
1158 | struct be_mem_descriptor *mem_descr) | ||
1159 | { | ||
1160 | struct iscsi_wrb *pwrb = pwrb_handle->pwrb; | ||
1161 | |||
1162 | memset(pwrb, 0, sizeof(*pwrb)); | ||
1163 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1164 | max_send_data_segment_length, pwrb, | ||
1165 | params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1166 | max_send_data_segment_length) / 32]); | ||
1167 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, type, pwrb, | ||
1168 | BE_TGT_CTX_UPDT_CMD); | ||
1169 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1170 | first_burst_length, | ||
1171 | pwrb, | ||
1172 | params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1173 | first_burst_length) / 32]); | ||
1174 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, erl, pwrb, | ||
1175 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1176 | erl) / 32] & OFFLD_PARAMS_ERL)); | ||
1177 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, dde, pwrb, | ||
1178 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1179 | dde) / 32] & OFFLD_PARAMS_DDE) >> 2); | ||
1180 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, hde, pwrb, | ||
1181 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1182 | hde) / 32] & OFFLD_PARAMS_HDE) >> 3); | ||
1183 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, ir2t, pwrb, | ||
1184 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1185 | ir2t) / 32] & OFFLD_PARAMS_IR2T) >> 4); | ||
1186 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, imd, pwrb, | ||
1187 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1188 | imd) / 32] & OFFLD_PARAMS_IMD) >> 5); | ||
1189 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, stat_sn, | ||
1190 | pwrb, | ||
1191 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1192 | exp_statsn) / 32] + 1)); | ||
1193 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, wrb_idx, | ||
1194 | pwrb, pwrb_handle->wrb_index); | ||
1195 | |||
1196 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1197 | max_burst_length, pwrb, params->dw[offsetof | ||
1198 | (struct amap_beiscsi_offload_params, | ||
1199 | max_burst_length) / 32]); | ||
1200 | |||
1201 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, ptr2nextwrb, | ||
1202 | pwrb, pwrb_handle->nxt_wrb_index); | ||
1203 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1204 | session_state, pwrb, 0); | ||
1205 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, compltonack, | ||
1206 | pwrb, 1); | ||
1207 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, notpredblq, | ||
1208 | pwrb, 0); | ||
1209 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, mode, pwrb, | ||
1210 | 0); | ||
1211 | |||
1212 | mem_descr += ISCSI_MEM_GLOBAL_HEADER; | ||
1213 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1214 | pad_buffer_addr_hi, pwrb, | ||
1215 | mem_descr->mem_array[0].bus_address.u.a32.address_hi); | ||
1216 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1217 | pad_buffer_addr_lo, pwrb, | ||
1218 | mem_descr->mem_array[0].bus_address.u.a32.address_lo); | ||
1219 | } | ||
1220 | |||
1221 | void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params, | ||
1222 | struct wrb_handle *pwrb_handle) | ||
1223 | { | ||
1224 | struct iscsi_wrb *pwrb = pwrb_handle->pwrb; | ||
1225 | |||
1226 | memset(pwrb, 0, sizeof(*pwrb)); | ||
1227 | |||
1228 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | ||
1229 | max_burst_length, pwrb, params->dw[offsetof | ||
1230 | (struct amap_beiscsi_offload_params, | ||
1231 | max_burst_length) / 32]); | ||
1232 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1233 | max_burst_length, pwrb, params->dw[offsetof | ||
1234 | (struct amap_beiscsi_offload_params, | ||
1235 | max_burst_length) / 32]); | ||
1236 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1237 | type, pwrb, | ||
1238 | BE_TGT_CTX_UPDT_CMD); | ||
1239 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1240 | ptr2nextwrb, | ||
1241 | pwrb, pwrb_handle->nxt_wrb_index); | ||
1242 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, wrb_idx, | ||
1243 | pwrb, pwrb_handle->wrb_index); | ||
1244 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1245 | max_send_data_segment_length, pwrb, | ||
1246 | params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1247 | max_send_data_segment_length) / 32]); | ||
1248 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1249 | first_burst_length, pwrb, | ||
1250 | params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1251 | first_burst_length) / 32]); | ||
1252 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1253 | max_recv_dataseg_len, pwrb, BEISCSI_MAX_RECV_DATASEG_LEN); | ||
1254 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1255 | max_cxns, pwrb, BEISCSI_MAX_CXNS); | ||
1256 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, erl, pwrb, | ||
1257 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1258 | erl) / 32] & OFFLD_PARAMS_ERL)); | ||
1259 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, dde, pwrb, | ||
1260 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1261 | dde) / 32] & OFFLD_PARAMS_DDE) >> 2); | ||
1262 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, hde, pwrb, | ||
1263 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1264 | hde) / 32] & OFFLD_PARAMS_HDE) >> 3); | ||
1265 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1266 | ir2t, pwrb, | ||
1267 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1268 | ir2t) / 32] & OFFLD_PARAMS_IR2T) >> 4); | ||
1269 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, imd, pwrb, | ||
1270 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1271 | imd) / 32] & OFFLD_PARAMS_IMD) >> 5); | ||
1272 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1273 | data_seq_inorder, | ||
1274 | pwrb, | ||
1275 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1276 | data_seq_inorder) / 32] & | ||
1277 | OFFLD_PARAMS_DATA_SEQ_INORDER) >> 6); | ||
1278 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, | ||
1279 | pdu_seq_inorder, | ||
1280 | pwrb, | ||
1281 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1282 | pdu_seq_inorder) / 32] & | ||
1283 | OFFLD_PARAMS_PDU_SEQ_INORDER) >> 7); | ||
1284 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, max_r2t, | ||
1285 | pwrb, | ||
1286 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1287 | max_r2t) / 32] & | ||
1288 | OFFLD_PARAMS_MAX_R2T) >> 8); | ||
1289 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2, stat_sn, | ||
1290 | pwrb, | ||
1291 | (params->dw[offsetof(struct amap_beiscsi_offload_params, | ||
1292 | exp_statsn) / 32] + 1)); | ||
1293 | } | ||