Searched refs:fsp (Results 1 - 11 of 11) sorted by relevance

/linux-4.4.14/drivers/scsi/libfc/
H A Dfc_fcp.c149 struct fc_fcp_pkt *fsp; fc_fcp_pkt_alloc() local
151 fsp = mempool_alloc(si->scsi_pkt_pool, gfp); fc_fcp_pkt_alloc()
152 if (fsp) { fc_fcp_pkt_alloc()
153 memset(fsp, 0, sizeof(*fsp)); fc_fcp_pkt_alloc()
154 fsp->lp = lport; fc_fcp_pkt_alloc()
155 fsp->xfer_ddp = FC_XID_UNKNOWN; fc_fcp_pkt_alloc()
156 atomic_set(&fsp->ref_cnt, 1); fc_fcp_pkt_alloc()
157 init_timer(&fsp->timer); fc_fcp_pkt_alloc()
158 fsp->timer.data = (unsigned long)fsp; fc_fcp_pkt_alloc()
159 INIT_LIST_HEAD(&fsp->list); fc_fcp_pkt_alloc()
160 spin_lock_init(&fsp->scsi_pkt_lock); fc_fcp_pkt_alloc()
165 return fsp; fc_fcp_pkt_alloc()
170 * @fsp: The FCP packet to be released
175 static void fc_fcp_pkt_release(struct fc_fcp_pkt *fsp) fc_fcp_pkt_release() argument
177 if (atomic_dec_and_test(&fsp->ref_cnt)) { fc_fcp_pkt_release()
178 struct fc_fcp_internal *si = fc_get_scsi_internal(fsp->lp); fc_fcp_pkt_release()
180 mempool_free(fsp, si->scsi_pkt_pool); fc_fcp_pkt_release()
186 * @fsp: The FCP packet to be held
188 static void fc_fcp_pkt_hold(struct fc_fcp_pkt *fsp) fc_fcp_pkt_hold() argument
190 atomic_inc(&fsp->ref_cnt); fc_fcp_pkt_hold()
196 * @fsp: The FCP packet to be released
204 static void fc_fcp_pkt_destroy(struct fc_seq *seq, void *fsp) fc_fcp_pkt_destroy() argument
206 fc_fcp_pkt_release(fsp); fc_fcp_pkt_destroy()
211 * @fsp: The FCP packet to be locked and incremented
223 * have a function that they call to verify the fsp and grab a ref if
226 static inline int fc_fcp_lock_pkt(struct fc_fcp_pkt *fsp) fc_fcp_lock_pkt() argument
228 spin_lock_bh(&fsp->scsi_pkt_lock); fc_fcp_lock_pkt()
229 if (fsp->state & FC_SRB_COMPL) { fc_fcp_lock_pkt()
230 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_fcp_lock_pkt()
234 fc_fcp_pkt_hold(fsp); fc_fcp_lock_pkt()
241 * @fsp: The FCP packet to be unlocked and decremented
243 static inline void fc_fcp_unlock_pkt(struct fc_fcp_pkt *fsp) fc_fcp_unlock_pkt() argument
245 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_fcp_unlock_pkt()
246 fc_fcp_pkt_release(fsp); fc_fcp_unlock_pkt()
251 * @fsp: The FCP packet to start a timer for
254 static void fc_fcp_timer_set(struct fc_fcp_pkt *fsp, unsigned long delay) fc_fcp_timer_set() argument
256 if (!(fsp->state & FC_SRB_COMPL)) fc_fcp_timer_set()
257 mod_timer(&fsp->timer, jiffies + delay); fc_fcp_timer_set()
263 * @fsp: The FCP packet to abort exchanges on
265 static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp) fc_fcp_send_abort() argument
267 if (!fsp->seq_ptr) fc_fcp_send_abort()
270 per_cpu_ptr(fsp->lp->stats, get_cpu())->FcpPktAborts++; fc_fcp_send_abort()
273 fsp->state |= FC_SRB_ABORT_PENDING; fc_fcp_send_abort()
274 return fsp->lp->tt.seq_exch_abort(fsp->seq_ptr, 0); fc_fcp_send_abort()
279 * @fsp: The FCP packet to be retried
286 static void fc_fcp_retry_cmd(struct fc_fcp_pkt *fsp) fc_fcp_retry_cmd() argument
288 if (fsp->seq_ptr) { fc_fcp_retry_cmd()
289 fsp->lp->tt.exch_done(fsp->seq_ptr); fc_fcp_retry_cmd()
290 fsp->seq_ptr = NULL; fc_fcp_retry_cmd()
293 fsp->state &= ~FC_SRB_ABORT_PENDING; fc_fcp_retry_cmd()
294 fsp->io_status = 0; fc_fcp_retry_cmd()
295 fsp->status_code = FC_ERROR; fc_fcp_retry_cmd()
296 fc_fcp_complete_locked(fsp); fc_fcp_retry_cmd()
301 * @fsp: The FCP packet that will manage the DDP frames
304 void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid) fc_fcp_ddp_setup() argument
308 lport = fsp->lp; fc_fcp_ddp_setup()
309 if ((fsp->req_flags & FC_SRB_READ) && fc_fcp_ddp_setup()
311 if (lport->tt.ddp_setup(lport, xid, scsi_sglist(fsp->cmd), fc_fcp_ddp_setup()
312 scsi_sg_count(fsp->cmd))) fc_fcp_ddp_setup()
313 fsp->xfer_ddp = xid; fc_fcp_ddp_setup()
320 * @fsp: The FCP packet that DDP had been used on
322 void fc_fcp_ddp_done(struct fc_fcp_pkt *fsp) fc_fcp_ddp_done() argument
326 if (!fsp) fc_fcp_ddp_done()
329 if (fsp->xfer_ddp == FC_XID_UNKNOWN) fc_fcp_ddp_done()
332 lport = fsp->lp; fc_fcp_ddp_done()
334 fsp->xfer_len = lport->tt.ddp_done(lport, fsp->xfer_ddp); fc_fcp_ddp_done()
335 fsp->xfer_ddp = FC_XID_UNKNOWN; fc_fcp_ddp_done()
438 * @fsp: The FCP packet the data is on
441 static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_fcp_recv_data() argument
443 struct scsi_cmnd *sc = fsp->cmd; fc_fcp_recv_data()
444 struct fc_lport *lport = fsp->lp; fc_fcp_recv_data()
470 if (fsp->xfer_ddp != FC_XID_UNKNOWN) { fc_fcp_recv_data()
471 fc_fcp_ddp_done(fsp); fc_fcp_recv_data()
472 FC_FCP_DBG(fsp, "DDP I/O in fc_fcp_recv_data set ERROR\n"); fc_fcp_recv_data()
476 if (offset + len > fsp->data_len) { fc_fcp_recv_data()
481 FC_FCP_DBG(fsp, "data received past end. len %zx offset %zx " fc_fcp_recv_data()
482 "data_len %x\n", len, offset, fsp->data_len); fc_fcp_recv_data()
488 if (offset != fsp->xfer_len) fc_fcp_recv_data()
489 fsp->state |= FC_SRB_DISCONTIG; fc_fcp_recv_data()
522 if (fsp->state & FC_SRB_DISCONTIG) { fc_fcp_recv_data()
530 if (fsp->xfer_contig_end == start_offset) fc_fcp_recv_data()
531 fsp->xfer_contig_end += copy_len; fc_fcp_recv_data()
532 fsp->xfer_len += copy_len; fc_fcp_recv_data()
538 if (unlikely(fsp->state & FC_SRB_RCV_STATUS) && fc_fcp_recv_data()
539 fsp->xfer_len == fsp->data_len - fsp->scsi_resid) fc_fcp_recv_data()
540 fc_fcp_complete_locked(fsp); fc_fcp_recv_data()
543 fc_fcp_recovery(fsp, host_bcode); fc_fcp_recv_data()
548 * @fsp: The FCP packet the data is on
559 static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq, fc_fcp_send_data() argument
566 struct fc_lport *lport = fsp->lp; fc_fcp_send_data()
581 if (unlikely(offset + seq_blen > fsp->data_len)) { fc_fcp_send_data()
583 FC_FCP_DBG(fsp, "xfer-ready past end. seq_blen %zx " fc_fcp_send_data()
585 fc_fcp_send_abort(fsp); fc_fcp_send_data()
587 } else if (offset != fsp->xfer_len) { fc_fcp_send_data()
589 FC_FCP_DBG(fsp, "xfer-ready non-contiguous. " fc_fcp_send_data()
596 * to max FC frame payload previously set in fsp->max_payload. fc_fcp_send_data()
598 t_blen = fsp->max_payload; fc_fcp_send_data()
601 FC_FCP_DBG(fsp, "fsp=%p:lso:blen=%zx lso_max=0x%x t_blen=%zx\n", fc_fcp_send_data()
602 fsp, seq_blen, lport->lso_max, t_blen); fc_fcp_send_data()
607 sc = fsp->cmd; fc_fcp_send_data()
640 fr_max_payload(fp) = fsp->max_payload; fc_fcp_send_data()
697 fsp->xfer_len += seq_blen; /* premature count? */ fc_fcp_send_data()
703 * @fsp: The FCP packet that is being aborted
706 static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_fcp_abts_resp() argument
731 fsp->state |= FC_SRB_ABORTED; fc_fcp_abts_resp()
732 fsp->state &= ~FC_SRB_ABORT_PENDING; fc_fcp_abts_resp()
734 if (fsp->wait_for_comp) fc_fcp_abts_resp()
735 complete(&fsp->tm_done); fc_fcp_abts_resp()
737 fc_fcp_complete_locked(fsp); fc_fcp_abts_resp()
752 struct fc_fcp_pkt *fsp = (struct fc_fcp_pkt *)arg; fc_fcp_recv() local
753 struct fc_lport *lport = fsp->lp; fc_fcp_recv()
760 fc_fcp_error(fsp, fp); fc_fcp_recv()
769 if (fc_fcp_lock_pkt(fsp)) fc_fcp_recv()
773 fc_fcp_abts_resp(fsp, fp); fc_fcp_recv()
777 if (fsp->state & (FC_SRB_ABORTED | FC_SRB_ABORT_PENDING)) fc_fcp_recv()
789 rc = fc_fcp_send_data(fsp, seq, fc_fcp_recv()
793 seq->rec_data = fsp->xfer_len; fc_fcp_recv()
800 fc_fcp_recv_data(fsp, fp); fc_fcp_recv()
801 seq->rec_data = fsp->xfer_contig_end; fc_fcp_recv()
805 fc_fcp_resp(fsp, fp); fc_fcp_recv()
807 FC_FCP_DBG(fsp, "unexpected frame. r_ctl %x\n", r_ctl); fc_fcp_recv()
810 fc_fcp_unlock_pkt(fsp); fc_fcp_recv()
817 * @fsp: The FCP packet the response is for
820 static void fc_fcp_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_fcp_resp() argument
838 fsp->cdb_status = fc_rp->fr_status; fc_fcp_resp()
840 fsp->scsi_comp_flags = flags; fc_fcp_resp()
841 expected_len = fsp->data_len; fc_fcp_resp()
844 fc_fcp_ddp_done(fsp); fc_fcp_resp()
857 if (fsp->wait_for_comp) { fc_fcp_resp()
859 fsp->cdb_status = fc_rp_info->rsp_code; fc_fcp_resp()
860 complete(&fsp->tm_done); fc_fcp_resp()
872 memcpy(fsp->cmd->sense_buffer, fc_fcp_resp()
880 fsp->scsi_resid = ntohl(rp_ex->fr_resid); fc_fcp_resp()
891 (scsi_bufflen(fsp->cmd) - fc_fcp_resp()
892 fsp->scsi_resid) < fsp->cmd->underflow) fc_fcp_resp()
894 expected_len -= fsp->scsi_resid; fc_fcp_resp()
896 fsp->status_code = FC_ERROR; fc_fcp_resp()
900 fsp->state |= FC_SRB_RCV_STATUS; fc_fcp_resp()
905 if (unlikely(fsp->cdb_status == SAM_STAT_GOOD && fc_fcp_resp()
906 fsp->xfer_len != expected_len)) { fc_fcp_resp()
907 if (fsp->xfer_len < expected_len) { fc_fcp_resp()
913 fc_fcp_timer_set(fsp, 2); fc_fcp_resp()
916 fsp->status_code = FC_DATA_OVRRUN; fc_fcp_resp()
917 FC_FCP_DBG(fsp, "tgt %6.6x xfer len %zx greater than expected, " fc_fcp_resp()
919 fsp->rport->port_id, fc_fcp_resp()
920 fsp->xfer_len, expected_len, fsp->data_len); fc_fcp_resp()
922 fc_fcp_complete_locked(fsp); fc_fcp_resp()
926 FC_FCP_DBG(fsp, "short FCP response. flags 0x%x len %u respl %u " fc_fcp_resp()
929 fsp->status_code = FC_ERROR; fc_fcp_resp()
930 fc_fcp_complete_locked(fsp); fc_fcp_resp()
936 * @fsp: The FCP packet to be completed
941 static void fc_fcp_complete_locked(struct fc_fcp_pkt *fsp) fc_fcp_complete_locked() argument
943 struct fc_lport *lport = fsp->lp; fc_fcp_complete_locked()
948 if (fsp->state & FC_SRB_ABORT_PENDING) fc_fcp_complete_locked()
951 if (fsp->state & FC_SRB_ABORTED) { fc_fcp_complete_locked()
952 if (!fsp->status_code) fc_fcp_complete_locked()
953 fsp->status_code = FC_CMD_ABORTED; fc_fcp_complete_locked()
959 if (fsp->cdb_status == SAM_STAT_GOOD && fc_fcp_complete_locked()
960 fsp->xfer_len < fsp->data_len && !fsp->io_status && fc_fcp_complete_locked()
961 (!(fsp->scsi_comp_flags & FCP_RESID_UNDER) || fc_fcp_complete_locked()
962 fsp->xfer_len < fsp->data_len - fsp->scsi_resid)) fc_fcp_complete_locked()
963 fsp->status_code = FC_DATA_UNDRUN; fc_fcp_complete_locked()
966 seq = fsp->seq_ptr; fc_fcp_complete_locked()
968 fsp->seq_ptr = NULL; fc_fcp_complete_locked()
969 if (unlikely(fsp->scsi_comp_flags & FCP_CONF_REQ)) { fc_fcp_complete_locked()
974 conf_frame = fc_fcp_frame_alloc(fsp->lp, 0); fc_fcp_complete_locked()
992 if (fsp->cmd) fc_fcp_complete_locked()
993 fc_io_compl(fsp); fc_fcp_complete_locked()
998 * @fsp: The FCP packet whose exchanges should be canceled
1001 static void fc_fcp_cleanup_cmd(struct fc_fcp_pkt *fsp, int error) fc_fcp_cleanup_cmd() argument
1003 struct fc_lport *lport = fsp->lp; fc_fcp_cleanup_cmd()
1005 if (fsp->seq_ptr) { fc_fcp_cleanup_cmd()
1006 lport->tt.exch_done(fsp->seq_ptr); fc_fcp_cleanup_cmd()
1007 fsp->seq_ptr = NULL; fc_fcp_cleanup_cmd()
1009 fsp->status_code = error; fc_fcp_cleanup_cmd()
1025 struct fc_fcp_pkt *fsp; fc_fcp_cleanup_each_cmd() local
1031 list_for_each_entry(fsp, &si->scsi_pkt_queue, list) { fc_fcp_cleanup_each_cmd()
1032 sc_cmd = fsp->cmd; fc_fcp_cleanup_each_cmd()
1039 fc_fcp_pkt_hold(fsp); fc_fcp_cleanup_each_cmd()
1042 spin_lock_bh(&fsp->scsi_pkt_lock); fc_fcp_cleanup_each_cmd()
1043 if (!(fsp->state & FC_SRB_COMPL)) { fc_fcp_cleanup_each_cmd()
1044 fsp->state |= FC_SRB_COMPL; fc_fcp_cleanup_each_cmd()
1054 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_fcp_cleanup_each_cmd()
1056 fc_fcp_cleanup_cmd(fsp, error); fc_fcp_cleanup_each_cmd()
1058 spin_lock_bh(&fsp->scsi_pkt_lock); fc_fcp_cleanup_each_cmd()
1059 fc_io_compl(fsp); fc_fcp_cleanup_each_cmd()
1061 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_fcp_cleanup_each_cmd()
1063 fc_fcp_pkt_release(fsp); fc_fcp_cleanup_each_cmd()
1086 * @fsp: The FCP packet to send
1091 static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) fc_fcp_pkt_send() argument
1097 fsp->cmd->SCp.ptr = (char *)fsp; fc_fcp_pkt_send()
1098 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); fc_fcp_pkt_send()
1099 fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK; fc_fcp_pkt_send()
1101 int_to_scsilun(fsp->cmd->device->lun, &fsp->cdb_cmd.fc_lun); fc_fcp_pkt_send()
1102 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); fc_fcp_pkt_send()
1105 list_add_tail(&fsp->list, &si->scsi_pkt_queue); fc_fcp_pkt_send()
1107 rc = lport->tt.fcp_cmd_send(lport, fsp, fc_fcp_recv); fc_fcp_pkt_send()
1110 fsp->cmd->SCp.ptr = NULL; fc_fcp_pkt_send()
1111 list_del(&fsp->list); fc_fcp_pkt_send()
1120 * @fsp: the FCP packet
1124 static inline unsigned int get_fsp_rec_tov(struct fc_fcp_pkt *fsp) get_fsp_rec_tov() argument
1126 struct fc_rport_libfc_priv *rpriv = fsp->rport->dd_data; get_fsp_rec_tov()
1134 * @fsp: The FCP packet the command is on
1137 static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp, fc_fcp_cmd_send() argument
1146 const size_t len = sizeof(fsp->cdb_cmd); fc_fcp_cmd_send()
1149 if (fc_fcp_lock_pkt(fsp)) fc_fcp_cmd_send()
1152 fp = fc_fcp_frame_alloc(lport, sizeof(fsp->cdb_cmd)); fc_fcp_cmd_send()
1158 memcpy(fc_frame_payload_get(fp, len), &fsp->cdb_cmd, len); fc_fcp_cmd_send()
1159 fr_fsp(fp) = fsp; fc_fcp_cmd_send()
1160 rport = fsp->rport; fc_fcp_cmd_send()
1161 fsp->max_payload = rport->maxframe_size; fc_fcp_cmd_send()
1169 fsp, 0); fc_fcp_cmd_send()
1174 fsp->seq_ptr = seq; fc_fcp_cmd_send()
1175 fc_fcp_pkt_hold(fsp); /* hold for fc_fcp_pkt_destroy */ fc_fcp_cmd_send()
1177 setup_timer(&fsp->timer, fc_fcp_timeout, (unsigned long)fsp); fc_fcp_cmd_send()
1179 fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp)); fc_fcp_cmd_send()
1182 fc_fcp_unlock_pkt(fsp); fc_fcp_cmd_send()
1188 * @fsp: The FCP packet the error is on
1191 static void fc_fcp_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_fcp_error() argument
1195 if (fc_fcp_lock_pkt(fsp)) fc_fcp_error()
1199 fc_fcp_retry_cmd(fsp); fc_fcp_error()
1207 fsp->state &= ~FC_SRB_ABORT_PENDING; fc_fcp_error()
1208 fsp->status_code = FC_CMD_PLOGO; fc_fcp_error()
1209 fc_fcp_complete_locked(fsp); fc_fcp_error()
1211 fc_fcp_unlock_pkt(fsp); fc_fcp_error()
1216 * @fsp: The FCP packet to abort on
1220 static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp) fc_fcp_pkt_abort() argument
1225 if (fc_fcp_send_abort(fsp)) fc_fcp_pkt_abort()
1228 init_completion(&fsp->tm_done); fc_fcp_pkt_abort()
1229 fsp->wait_for_comp = 1; fc_fcp_pkt_abort()
1231 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_fcp_pkt_abort()
1232 ticks_left = wait_for_completion_timeout(&fsp->tm_done, fc_fcp_pkt_abort()
1234 spin_lock_bh(&fsp->scsi_pkt_lock); fc_fcp_pkt_abort()
1235 fsp->wait_for_comp = 0; fc_fcp_pkt_abort()
1238 FC_FCP_DBG(fsp, "target abort cmd failed\n"); fc_fcp_pkt_abort()
1239 } else if (fsp->state & FC_SRB_ABORTED) { fc_fcp_pkt_abort()
1240 FC_FCP_DBG(fsp, "target abort cmd passed\n"); fc_fcp_pkt_abort()
1242 fc_fcp_complete_locked(fsp); fc_fcp_pkt_abort()
1254 struct fc_fcp_pkt *fsp = (struct fc_fcp_pkt *)data; fc_lun_reset_send() local
1255 struct fc_lport *lport = fsp->lp; fc_lun_reset_send()
1257 if (lport->tt.fcp_cmd_send(lport, fsp, fc_tm_done)) { fc_lun_reset_send()
1258 if (fsp->recov_retry++ >= FC_MAX_RECOV_RETRY) fc_lun_reset_send()
1260 if (fc_fcp_lock_pkt(fsp)) fc_lun_reset_send()
1262 setup_timer(&fsp->timer, fc_lun_reset_send, (unsigned long)fsp); fc_lun_reset_send()
1263 fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp)); fc_lun_reset_send()
1264 fc_fcp_unlock_pkt(fsp); fc_lun_reset_send()
1272 * @fsp: The FCP packet that identifies the LUN to be reset
1276 static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp, fc_lun_reset() argument
1281 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); fc_lun_reset()
1282 fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET; fc_lun_reset()
1283 int_to_scsilun(lun, &fsp->cdb_cmd.fc_lun); fc_lun_reset()
1285 fsp->wait_for_comp = 1; fc_lun_reset()
1286 init_completion(&fsp->tm_done); fc_lun_reset()
1288 fc_lun_reset_send((unsigned long)fsp); fc_lun_reset()
1294 rc = wait_for_completion_timeout(&fsp->tm_done, FC_SCSI_TM_TOV); fc_lun_reset()
1296 spin_lock_bh(&fsp->scsi_pkt_lock); fc_lun_reset()
1297 fsp->state |= FC_SRB_COMPL; fc_lun_reset()
1298 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_lun_reset()
1300 del_timer_sync(&fsp->timer); fc_lun_reset()
1302 spin_lock_bh(&fsp->scsi_pkt_lock); fc_lun_reset()
1303 if (fsp->seq_ptr) { fc_lun_reset()
1304 lport->tt.exch_done(fsp->seq_ptr); fc_lun_reset()
1305 fsp->seq_ptr = NULL; fc_lun_reset()
1307 fsp->wait_for_comp = 0; fc_lun_reset()
1308 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_lun_reset()
1316 if (fsp->cdb_status != FCP_TMF_CMPL) fc_lun_reset()
1332 struct fc_fcp_pkt *fsp = arg; fc_tm_done() local
1345 if (fc_fcp_lock_pkt(fsp)) fc_tm_done()
1351 if (!fsp->seq_ptr || !fsp->wait_for_comp) fc_tm_done()
1356 fc_fcp_resp(fsp, fp); fc_tm_done()
1357 fsp->seq_ptr = NULL; fc_tm_done()
1358 fsp->lp->tt.exch_done(seq); fc_tm_done()
1360 fc_fcp_unlock_pkt(fsp); fc_tm_done()
1387 struct fc_fcp_pkt *fsp = (struct fc_fcp_pkt *)data; fc_fcp_timeout() local
1388 struct fc_rport *rport = fsp->rport; fc_fcp_timeout()
1391 if (fc_fcp_lock_pkt(fsp)) fc_fcp_timeout()
1394 if (fsp->cdb_cmd.fc_tm_flags) fc_fcp_timeout()
1397 fsp->state |= FC_SRB_FCP_PROCESSING_TMO; fc_fcp_timeout()
1400 fc_fcp_rec(fsp); fc_fcp_timeout()
1401 else if (fsp->state & FC_SRB_RCV_STATUS) fc_fcp_timeout()
1402 fc_fcp_complete_locked(fsp); fc_fcp_timeout()
1404 fc_fcp_recovery(fsp, FC_TIMED_OUT); fc_fcp_timeout()
1405 fsp->state &= ~FC_SRB_FCP_PROCESSING_TMO; fc_fcp_timeout()
1407 fc_fcp_unlock_pkt(fsp); fc_fcp_timeout()
1412 * @fsp: The FCP packet to send the REC request on
1414 static void fc_fcp_rec(struct fc_fcp_pkt *fsp) fc_fcp_rec() argument
1421 lport = fsp->lp; fc_fcp_rec()
1422 rport = fsp->rport; fc_fcp_rec()
1424 if (!fsp->seq_ptr || rpriv->rp_state != RPORT_ST_READY) { fc_fcp_rec()
1425 fsp->status_code = FC_HRD_ERROR; fc_fcp_rec()
1426 fsp->io_status = 0; fc_fcp_rec()
1427 fc_fcp_complete_locked(fsp); fc_fcp_rec()
1435 fr_seq(fp) = fsp->seq_ptr; fc_fcp_rec()
1440 fc_fcp_rec_resp, fsp, fc_fcp_rec()
1442 fc_fcp_pkt_hold(fsp); /* hold while REC outstanding */ fc_fcp_rec()
1446 if (fsp->recov_retry++ < FC_MAX_RECOV_RETRY) fc_fcp_rec()
1447 fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp)); fc_fcp_rec()
1449 fc_fcp_recovery(fsp, FC_TIMED_OUT); fc_fcp_rec()
1465 struct fc_fcp_pkt *fsp = (struct fc_fcp_pkt *)arg; fc_fcp_rec_resp() local
1476 fc_fcp_rec_error(fsp, fp); fc_fcp_rec_resp()
1480 if (fc_fcp_lock_pkt(fsp)) fc_fcp_rec_resp()
1483 fsp->recov_retry = 0; fc_fcp_rec_resp()
1489 FC_FCP_DBG(fsp, "device %x unexpected REC reject " fc_fcp_rec_resp()
1491 fsp->rport->port_id, rjt->er_reason, fc_fcp_rec_resp()
1495 FC_FCP_DBG(fsp, "device does not support REC\n"); fc_fcp_rec_resp()
1496 rpriv = fsp->rport->dd_data; fc_fcp_rec_resp()
1513 fsp->xfer_len == 0) { fc_fcp_rec_resp()
1514 fc_fcp_retry_cmd(fsp); fc_fcp_rec_resp()
1517 fc_fcp_recovery(fsp, FC_ERROR); fc_fcp_rec_resp()
1521 if (fsp->state & FC_SRB_ABORTED) fc_fcp_rec_resp()
1524 data_dir = fsp->cmd->sc_data_direction; fc_fcp_rec_resp()
1547 } else if (fsp->xfer_contig_end == offset) { fc_fcp_rec_resp()
1550 offset = fsp->xfer_contig_end; fc_fcp_rec_resp()
1553 fc_fcp_srr(fsp, r_ctl, offset); fc_fcp_rec_resp()
1559 fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp)); fc_fcp_rec_resp()
1580 if (offset < fsp->data_len) fc_fcp_rec_resp()
1582 } else if (offset == fsp->xfer_contig_end) { fc_fcp_rec_resp()
1584 } else if (fsp->xfer_contig_end < offset) { fc_fcp_rec_resp()
1585 offset = fsp->xfer_contig_end; fc_fcp_rec_resp()
1587 fc_fcp_srr(fsp, r_ctl, offset); fc_fcp_rec_resp()
1591 fc_fcp_unlock_pkt(fsp); fc_fcp_rec_resp()
1593 fc_fcp_pkt_release(fsp); /* drop hold for outstanding REC */ fc_fcp_rec_resp()
1599 * @fsp: The FCP packet the error is on
1602 static void fc_fcp_rec_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_fcp_rec_error() argument
1606 if (fc_fcp_lock_pkt(fsp)) fc_fcp_rec_error()
1611 fc_fcp_retry_cmd(fsp); fc_fcp_rec_error()
1615 FC_FCP_DBG(fsp, "REC %p fid %6.6x error unexpected error %d\n", fc_fcp_rec_error()
1616 fsp, fsp->rport->port_id, error); fc_fcp_rec_error()
1617 fsp->status_code = FC_CMD_PLOGO; fc_fcp_rec_error()
1625 FC_FCP_DBG(fsp, "REC fid %6.6x error error %d retry %d/%d\n", fc_fcp_rec_error()
1626 fsp->rport->port_id, error, fsp->recov_retry, fc_fcp_rec_error()
1628 if (fsp->recov_retry++ < FC_MAX_RECOV_RETRY) fc_fcp_rec_error()
1629 fc_fcp_rec(fsp); fc_fcp_rec_error()
1631 fc_fcp_recovery(fsp, FC_ERROR); fc_fcp_rec_error()
1634 fc_fcp_unlock_pkt(fsp); fc_fcp_rec_error()
1636 fc_fcp_pkt_release(fsp); /* drop hold for outstanding REC */ fc_fcp_rec_error()
1641 * @fsp: The FCP pkt that needs to be aborted
1643 static void fc_fcp_recovery(struct fc_fcp_pkt *fsp, u8 code) fc_fcp_recovery() argument
1645 fsp->status_code = code; fc_fcp_recovery()
1646 fsp->cdb_status = 0; fc_fcp_recovery()
1647 fsp->io_status = 0; fc_fcp_recovery()
1652 fc_fcp_send_abort(fsp); fc_fcp_recovery()
1657 * @fsp: The FCP packet the SRR is to be sent on
1662 static void fc_fcp_srr(struct fc_fcp_pkt *fsp, enum fc_rctl r_ctl, u32 offset) fc_fcp_srr() argument
1664 struct fc_lport *lport = fsp->lp; fc_fcp_srr()
1667 struct fc_exch *ep = fc_seq_exch(fsp->seq_ptr); fc_fcp_srr()
1673 rport = fsp->rport; fc_fcp_srr()
1695 rec_tov = get_fsp_rec_tov(fsp); fc_fcp_srr()
1698 fsp, jiffies_to_msecs(rec_tov)); fc_fcp_srr()
1702 fsp->recov_seq = seq; fc_fcp_srr()
1703 fsp->xfer_len = offset; fc_fcp_srr()
1704 fsp->xfer_contig_end = offset; fc_fcp_srr()
1705 fsp->state &= ~FC_SRB_RCV_STATUS; fc_fcp_srr()
1706 fc_fcp_pkt_hold(fsp); /* hold for outstanding SRR */ fc_fcp_srr()
1709 fc_fcp_retry_cmd(fsp); fc_fcp_srr()
1720 struct fc_fcp_pkt *fsp = arg; fc_fcp_srr_resp() local
1724 fc_fcp_srr_error(fsp, fp); fc_fcp_srr_resp()
1728 if (fc_fcp_lock_pkt(fsp)) fc_fcp_srr_resp()
1740 fc_fcp_unlock_pkt(fsp); fc_fcp_srr_resp()
1746 fsp->recov_retry = 0; fc_fcp_srr_resp()
1747 fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp)); fc_fcp_srr_resp()
1751 fc_fcp_recovery(fsp, FC_ERROR); fc_fcp_srr_resp()
1754 fc_fcp_unlock_pkt(fsp); fc_fcp_srr_resp()
1756 fsp->lp->tt.exch_done(seq); fc_fcp_srr_resp()
1762 * @fsp: The FCP packet that the SRR error is on
1765 static void fc_fcp_srr_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_fcp_srr_error() argument
1767 if (fc_fcp_lock_pkt(fsp)) fc_fcp_srr_error()
1771 if (fsp->recov_retry++ < FC_MAX_RECOV_RETRY) fc_fcp_srr_error()
1772 fc_fcp_rec(fsp); fc_fcp_srr_error()
1774 fc_fcp_recovery(fsp, FC_TIMED_OUT); fc_fcp_srr_error()
1779 fc_fcp_retry_cmd(fsp); fc_fcp_srr_error()
1782 fc_fcp_unlock_pkt(fsp); fc_fcp_srr_error()
1784 fsp->lp->tt.exch_done(fsp->recov_seq); fc_fcp_srr_error()
1809 struct fc_fcp_pkt *fsp; fc_queuecommand() local
1841 fsp = fc_fcp_pkt_alloc(lport, GFP_ATOMIC); fc_queuecommand()
1842 if (fsp == NULL) { fc_queuecommand()
1850 fsp->cmd = sc_cmd; /* save the cmd */ fc_queuecommand()
1851 fsp->rport = rport; /* set the remote port ptr */ fc_queuecommand()
1856 fsp->data_len = scsi_bufflen(sc_cmd); fc_queuecommand()
1857 fsp->xfer_len = 0; fc_queuecommand()
1864 fsp->req_flags = FC_SRB_READ; fc_queuecommand()
1866 stats->InputBytes += fsp->data_len; fc_queuecommand()
1868 fsp->req_flags = FC_SRB_WRITE; fc_queuecommand()
1870 stats->OutputBytes += fsp->data_len; fc_queuecommand()
1872 fsp->req_flags = 0; fc_queuecommand()
1882 rval = fc_fcp_pkt_send(lport, fsp); fc_queuecommand()
1884 fsp->state = FC_SRB_FREE; fc_queuecommand()
1885 fc_fcp_pkt_release(fsp); fc_queuecommand()
1895 * @fsp: The FCP packet that is complete
1900 static void fc_io_compl(struct fc_fcp_pkt *fsp) fc_io_compl() argument
1908 fc_fcp_ddp_done(fsp); fc_io_compl()
1910 fsp->state |= FC_SRB_COMPL; fc_io_compl()
1911 if (!(fsp->state & FC_SRB_FCP_PROCESSING_TMO)) { fc_io_compl()
1912 spin_unlock_bh(&fsp->scsi_pkt_lock); fc_io_compl()
1913 del_timer_sync(&fsp->timer); fc_io_compl()
1914 spin_lock_bh(&fsp->scsi_pkt_lock); fc_io_compl()
1917 lport = fsp->lp; fc_io_compl()
1927 sc_cmd = fsp->cmd; fc_io_compl()
1928 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status; fc_io_compl()
1929 switch (fsp->status_code) { fc_io_compl()
1931 if (fsp->cdb_status == 0) { fc_io_compl()
1936 if (fsp->scsi_resid) fc_io_compl()
1937 CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid; fc_io_compl()
1943 sc_cmd->result = (DID_OK << 16) | fsp->cdb_status; fc_io_compl()
1947 FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml " fc_io_compl()
1952 if ((fsp->cdb_status == 0) && !(fsp->req_flags & FC_SRB_READ)) { fc_io_compl()
1957 if (fsp->state & FC_SRB_RCV_STATUS) { fc_io_compl()
1960 FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml" fc_io_compl()
1968 FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml " fc_io_compl()
1970 CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid; fc_io_compl()
1971 sc_cmd->result = (DID_ERROR << 16) | fsp->cdb_status; fc_io_compl()
1978 FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml " fc_io_compl()
1980 sc_cmd->result = (DID_ERROR << 16) | fsp->cdb_status; fc_io_compl()
1983 FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml " fc_io_compl()
1985 sc_cmd->result = (DID_ERROR << 16) | fsp->io_status; fc_io_compl()
1988 FC_FCP_DBG(fsp, "Returning DID_RESET to scsi-ml " fc_io_compl()
1993 FC_FCP_DBG(fsp, "Returning DID_NO_CONNECT to scsi-ml " fc_io_compl()
1998 FC_FCP_DBG(fsp, "Returning DID_PARITY to scsi-ml " fc_io_compl()
2003 FC_FCP_DBG(fsp, "Returning DID_BUS_BUSY to scsi-ml " fc_io_compl()
2005 sc_cmd->result = (DID_BUS_BUSY << 16) | fsp->io_status; fc_io_compl()
2008 FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml " fc_io_compl()
2014 if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE) fc_io_compl()
2018 list_del(&fsp->list); fc_io_compl()
2024 fc_fcp_pkt_release(fsp); fc_io_compl()
2036 struct fc_fcp_pkt *fsp; fc_eh_abort() local
2055 fsp = CMD_SP(sc_cmd); fc_eh_abort()
2056 if (!fsp) { fc_eh_abort()
2061 /* grab a ref so the fsp and sc_cmd cannot be released from under us */ fc_eh_abort()
2062 fc_fcp_pkt_hold(fsp); fc_eh_abort()
2065 if (fc_fcp_lock_pkt(fsp)) { fc_eh_abort()
2071 rc = fc_fcp_pkt_abort(fsp); fc_eh_abort()
2072 fc_fcp_unlock_pkt(fsp); fc_eh_abort()
2075 fc_fcp_pkt_release(fsp); fc_eh_abort()
2090 struct fc_fcp_pkt *fsp; fc_eh_device_reset() local
2106 fsp = fc_fcp_pkt_alloc(lport, GFP_NOIO); fc_eh_device_reset()
2107 if (fsp == NULL) { fc_eh_device_reset()
2117 fsp->rport = rport; /* set the remote port ptr */ fc_eh_device_reset()
2122 rc = fc_lun_reset(lport, fsp, scmd_id(sc_cmd), sc_cmd->device->lun); fc_eh_device_reset()
2123 fsp->state = FC_SRB_FREE; fc_eh_device_reset()
2124 fc_fcp_pkt_release(fsp); fc_eh_device_reset()
H A Dfc_libfc.h110 void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid);
111 void fc_fcp_ddp_done(struct fc_fcp_pkt *fsp);
H A Dfc_exch.c2083 struct fc_fcp_pkt *fsp = NULL; fc_exch_seq_send() local
2107 fsp = fr_fsp(fp); fc_exch_seq_send()
2123 if (fsp) fc_exch_seq_send()
2124 fc_fcp_ddp_done(fsp); fc_exch_seq_send()
/linux-4.4.14/drivers/net/ethernet/cisco/enic/
H A Denic_ethtool.c361 struct ethtool_rx_flow_spec *fsp = enic_grxclsrule() local
365 n = htbl_fltr_search(enic, (u16)fsp->location); enic_grxclsrule()
370 fsp->flow_type = TCP_V4_FLOW; enic_grxclsrule()
373 fsp->flow_type = UDP_V4_FLOW; enic_grxclsrule()
380 fsp->h_u.tcp_ip4_spec.ip4src = flow_get_u32_src(&n->keys); enic_grxclsrule()
381 fsp->m_u.tcp_ip4_spec.ip4src = (__u32)~0; enic_grxclsrule()
383 fsp->h_u.tcp_ip4_spec.ip4dst = flow_get_u32_dst(&n->keys); enic_grxclsrule()
384 fsp->m_u.tcp_ip4_spec.ip4dst = (__u32)~0; enic_grxclsrule()
386 fsp->h_u.tcp_ip4_spec.psrc = n->keys.ports.src; enic_grxclsrule()
387 fsp->m_u.tcp_ip4_spec.psrc = (__u16)~0; enic_grxclsrule()
389 fsp->h_u.tcp_ip4_spec.pdst = n->keys.ports.dst; enic_grxclsrule()
390 fsp->m_u.tcp_ip4_spec.pdst = (__u16)~0; enic_grxclsrule()
392 fsp->ring_cookie = n->rq_id; enic_grxclsrule()
/linux-4.4.14/drivers/net/ethernet/intel/ixgbe/
H A Dixgbe_ethtool.c2335 struct ethtool_rx_flow_spec *fsp = ixgbe_get_ethtool_fdir_entry() local
2345 if (fsp->location <= rule->sw_idx) ixgbe_get_ethtool_fdir_entry()
2349 if (!rule || fsp->location != rule->sw_idx) ixgbe_get_ethtool_fdir_entry()
2357 fsp->flow_type = TCP_V4_FLOW; ixgbe_get_ethtool_fdir_entry()
2360 fsp->flow_type = UDP_V4_FLOW; ixgbe_get_ethtool_fdir_entry()
2363 fsp->flow_type = SCTP_V4_FLOW; ixgbe_get_ethtool_fdir_entry()
2366 fsp->flow_type = IP_USER_FLOW; ixgbe_get_ethtool_fdir_entry()
2367 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; ixgbe_get_ethtool_fdir_entry()
2368 fsp->h_u.usr_ip4_spec.proto = 0; ixgbe_get_ethtool_fdir_entry()
2369 fsp->m_u.usr_ip4_spec.proto = 0; ixgbe_get_ethtool_fdir_entry()
2375 fsp->h_u.tcp_ip4_spec.psrc = rule->filter.formatted.src_port; ixgbe_get_ethtool_fdir_entry()
2376 fsp->m_u.tcp_ip4_spec.psrc = mask->formatted.src_port; ixgbe_get_ethtool_fdir_entry()
2377 fsp->h_u.tcp_ip4_spec.pdst = rule->filter.formatted.dst_port; ixgbe_get_ethtool_fdir_entry()
2378 fsp->m_u.tcp_ip4_spec.pdst = mask->formatted.dst_port; ixgbe_get_ethtool_fdir_entry()
2379 fsp->h_u.tcp_ip4_spec.ip4src = rule->filter.formatted.src_ip[0]; ixgbe_get_ethtool_fdir_entry()
2380 fsp->m_u.tcp_ip4_spec.ip4src = mask->formatted.src_ip[0]; ixgbe_get_ethtool_fdir_entry()
2381 fsp->h_u.tcp_ip4_spec.ip4dst = rule->filter.formatted.dst_ip[0]; ixgbe_get_ethtool_fdir_entry()
2382 fsp->m_u.tcp_ip4_spec.ip4dst = mask->formatted.dst_ip[0]; ixgbe_get_ethtool_fdir_entry()
2383 fsp->h_ext.vlan_tci = rule->filter.formatted.vlan_id; ixgbe_get_ethtool_fdir_entry()
2384 fsp->m_ext.vlan_tci = mask->formatted.vlan_id; ixgbe_get_ethtool_fdir_entry()
2385 fsp->h_ext.vlan_etype = rule->filter.formatted.flex_bytes; ixgbe_get_ethtool_fdir_entry()
2386 fsp->m_ext.vlan_etype = mask->formatted.flex_bytes; ixgbe_get_ethtool_fdir_entry()
2387 fsp->h_ext.data[1] = htonl(rule->filter.formatted.vm_pool); ixgbe_get_ethtool_fdir_entry()
2388 fsp->m_ext.data[1] = htonl(mask->formatted.vm_pool); ixgbe_get_ethtool_fdir_entry()
2389 fsp->flow_type |= FLOW_EXT; ixgbe_get_ethtool_fdir_entry()
2393 fsp->ring_cookie = RX_CLS_FLOW_DISC; ixgbe_get_ethtool_fdir_entry()
2395 fsp->ring_cookie = rule->action; ixgbe_get_ethtool_fdir_entry()
2554 static int ixgbe_flowspec_to_flow_type(struct ethtool_rx_flow_spec *fsp, ixgbe_flowspec_to_flow_type() argument
2557 switch (fsp->flow_type & ~FLOW_EXT) { ixgbe_flowspec_to_flow_type()
2568 switch (fsp->h_u.usr_ip4_spec.proto) { ixgbe_flowspec_to_flow_type()
2579 if (!fsp->m_u.usr_ip4_spec.proto) { ixgbe_flowspec_to_flow_type()
2597 struct ethtool_rx_flow_spec *fsp = ixgbe_add_ethtool_fdir_entry() local
2611 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { ixgbe_add_ethtool_fdir_entry()
2614 u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); ixgbe_add_ethtool_fdir_entry()
2615 u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); ixgbe_add_ethtool_fdir_entry()
2633 if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { ixgbe_add_ethtool_fdir_entry()
2645 input->sw_idx = fsp->location; ixgbe_add_ethtool_fdir_entry()
2648 if (!ixgbe_flowspec_to_flow_type(fsp, ixgbe_add_ethtool_fdir_entry()
2661 input->filter.formatted.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; ixgbe_add_ethtool_fdir_entry()
2662 mask.formatted.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; ixgbe_add_ethtool_fdir_entry()
2663 input->filter.formatted.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; ixgbe_add_ethtool_fdir_entry()
2664 mask.formatted.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; ixgbe_add_ethtool_fdir_entry()
2665 input->filter.formatted.src_port = fsp->h_u.tcp_ip4_spec.psrc; ixgbe_add_ethtool_fdir_entry()
2666 mask.formatted.src_port = fsp->m_u.tcp_ip4_spec.psrc; ixgbe_add_ethtool_fdir_entry()
2667 input->filter.formatted.dst_port = fsp->h_u.tcp_ip4_spec.pdst; ixgbe_add_ethtool_fdir_entry()
2668 mask.formatted.dst_port = fsp->m_u.tcp_ip4_spec.pdst; ixgbe_add_ethtool_fdir_entry()
2670 if (fsp->flow_type & FLOW_EXT) { ixgbe_add_ethtool_fdir_entry()
2672 (unsigned char)ntohl(fsp->h_ext.data[1]); ixgbe_add_ethtool_fdir_entry()
2674 (unsigned char)ntohl(fsp->m_ext.data[1]); ixgbe_add_ethtool_fdir_entry()
2675 input->filter.formatted.vlan_id = fsp->h_ext.vlan_tci; ixgbe_add_ethtool_fdir_entry()
2676 mask.formatted.vlan_id = fsp->m_ext.vlan_tci; ixgbe_add_ethtool_fdir_entry()
2678 fsp->h_ext.vlan_etype; ixgbe_add_ethtool_fdir_entry()
2679 mask.formatted.flex_bytes = fsp->m_ext.vlan_etype; ixgbe_add_ethtool_fdir_entry()
2683 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) ixgbe_add_ethtool_fdir_entry()
2686 input->action = fsp->ring_cookie; ixgbe_add_ethtool_fdir_entry()
2727 struct ethtool_rx_flow_spec *fsp = ixgbe_del_ethtool_fdir_entry() local
2732 err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, fsp->location); ixgbe_del_ethtool_fdir_entry()
/linux-4.4.14/drivers/net/ethernet/intel/i40e/
H A Di40e_ethtool.c2049 struct ethtool_rx_flow_spec *fsp = i40e_get_ethtool_fdir_entry() local
2056 if (fsp->location <= rule->fd_id) i40e_get_ethtool_fdir_entry()
2060 if (!rule || fsp->location != rule->fd_id) i40e_get_ethtool_fdir_entry()
2063 fsp->flow_type = rule->flow_type; i40e_get_ethtool_fdir_entry()
2064 if (fsp->flow_type == IP_USER_FLOW) { i40e_get_ethtool_fdir_entry()
2065 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; i40e_get_ethtool_fdir_entry()
2066 fsp->h_u.usr_ip4_spec.proto = 0; i40e_get_ethtool_fdir_entry()
2067 fsp->m_u.usr_ip4_spec.proto = 0; i40e_get_ethtool_fdir_entry()
2073 fsp->h_u.tcp_ip4_spec.psrc = rule->dst_port; i40e_get_ethtool_fdir_entry()
2074 fsp->h_u.tcp_ip4_spec.pdst = rule->src_port; i40e_get_ethtool_fdir_entry()
2075 fsp->h_u.tcp_ip4_spec.ip4src = rule->dst_ip[0]; i40e_get_ethtool_fdir_entry()
2076 fsp->h_u.tcp_ip4_spec.ip4dst = rule->src_ip[0]; i40e_get_ethtool_fdir_entry()
2079 fsp->ring_cookie = RX_CLS_FLOW_DISC; i40e_get_ethtool_fdir_entry()
2081 fsp->ring_cookie = rule->q_index; i40e_get_ethtool_fdir_entry()
2088 fsp->h_ext.data[1] = htonl(vsi->vf_id); i40e_get_ethtool_fdir_entry()
2089 fsp->m_ext.data[1] = htonl(0x1); i40e_get_ethtool_fdir_entry()
2353 struct ethtool_rx_flow_spec *fsp = i40e_del_fdir_entry() local
2365 ret = i40e_update_ethtool_fdir_entry(vsi, NULL, fsp->location, cmd); i40e_del_fdir_entry()
2382 struct ethtool_rx_flow_spec *fsp; i40e_add_fdir_ethtool() local
2406 fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; i40e_add_fdir_ethtool()
2408 if (fsp->location >= (pf->hw.func_caps.fd_filters_best_effort + i40e_add_fdir_ethtool()
2413 if ((fsp->ring_cookie != RX_CLS_FLOW_DISC) && i40e_add_fdir_ethtool()
2414 (fsp->ring_cookie >= vsi->num_queue_pairs)) i40e_add_fdir_ethtool()
2422 input->fd_id = fsp->location; i40e_add_fdir_ethtool()
2424 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) i40e_add_fdir_ethtool()
2430 input->q_index = fsp->ring_cookie; i40e_add_fdir_ethtool()
2436 input->flow_type = fsp->flow_type; i40e_add_fdir_ethtool()
2437 input->ip4_proto = fsp->h_u.usr_ip4_spec.proto; i40e_add_fdir_ethtool()
2442 input->dst_port = fsp->h_u.tcp_ip4_spec.psrc; i40e_add_fdir_ethtool()
2443 input->src_port = fsp->h_u.tcp_ip4_spec.pdst; i40e_add_fdir_ethtool()
2444 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; i40e_add_fdir_ethtool()
2445 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; i40e_add_fdir_ethtool()
2447 if (ntohl(fsp->m_ext.data[1])) { i40e_add_fdir_ethtool()
2448 if (ntohl(fsp->h_ext.data[1]) >= pf->num_alloc_vfs) { i40e_add_fdir_ethtool()
2452 vf_id = ntohl(fsp->h_ext.data[1]); i40e_add_fdir_ethtool()
2466 i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL); i40e_add_fdir_ethtool()
/linux-4.4.14/tools/perf/util/
H A Dprobe-finder.c719 struct find_scope_param *fsp = data; find_best_scope_cb() local
724 if (fsp->file) { find_best_scope_cb()
726 if (!file || strcmp(fsp->file, file) != 0) find_best_scope_cb()
730 if (fsp->function) { find_best_scope_cb()
731 if (die_match_name(fn_die, fsp->function)) { find_best_scope_cb()
732 memcpy(fsp->die_mem, fn_die, sizeof(Dwarf_Die)); find_best_scope_cb()
733 fsp->found = true; find_best_scope_cb()
739 if (lno < fsp->line && fsp->diff > fsp->line - lno) { find_best_scope_cb()
741 fsp->diff = fsp->line - lno; find_best_scope_cb()
742 memcpy(fsp->die_mem, fn_die, sizeof(Dwarf_Die)); find_best_scope_cb()
743 fsp->found = true; find_best_scope_cb()
752 struct find_scope_param fsp = { find_best_scope() local
761 cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, &fsp); find_best_scope()
763 return fsp.found ? die_mem : NULL; find_best_scope()
/linux-4.4.14/drivers/net/ethernet/sun/
H A Dniu.c7101 struct ethtool_rx_flow_spec *fsp) niu_get_ip4fs_from_tcam_key()
7107 fsp->h_u.tcp_ip4_spec.ip4src = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7110 fsp->h_u.tcp_ip4_spec.ip4dst = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7113 fsp->m_u.tcp_ip4_spec.ip4src = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7116 fsp->m_u.tcp_ip4_spec.ip4dst = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7118 fsp->h_u.tcp_ip4_spec.tos = (tp->key[2] & TCAM_V4KEY2_TOS) >> niu_get_ip4fs_from_tcam_key()
7120 fsp->m_u.tcp_ip4_spec.tos = (tp->key_mask[2] & TCAM_V4KEY2_TOS) >> niu_get_ip4fs_from_tcam_key()
7123 switch (fsp->flow_type) { niu_get_ip4fs_from_tcam_key()
7129 fsp->h_u.tcp_ip4_spec.psrc = cpu_to_be16(prt); niu_get_ip4fs_from_tcam_key()
7133 fsp->h_u.tcp_ip4_spec.pdst = cpu_to_be16(prt); niu_get_ip4fs_from_tcam_key()
7137 fsp->m_u.tcp_ip4_spec.psrc = cpu_to_be16(prt); niu_get_ip4fs_from_tcam_key()
7141 fsp->m_u.tcp_ip4_spec.pdst = cpu_to_be16(prt); niu_get_ip4fs_from_tcam_key()
7147 fsp->h_u.ah_ip4_spec.spi = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7151 fsp->m_u.ah_ip4_spec.spi = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7156 fsp->h_u.usr_ip4_spec.l4_4_bytes = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7160 fsp->m_u.usr_ip4_spec.l4_4_bytes = cpu_to_be32(tmp); niu_get_ip4fs_from_tcam_key()
7162 fsp->h_u.usr_ip4_spec.proto = niu_get_ip4fs_from_tcam_key()
7165 fsp->m_u.usr_ip4_spec.proto = niu_get_ip4fs_from_tcam_key()
7169 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; niu_get_ip4fs_from_tcam_key()
7181 struct ethtool_rx_flow_spec *fsp = &nfc->fs; niu_get_ethtool_tcam_entry() local
7198 ret = niu_class_to_ethflow(class, &fsp->flow_type); niu_get_ethtool_tcam_entry()
7205 if (fsp->flow_type == AH_V4_FLOW || fsp->flow_type == AH_V6_FLOW) { niu_get_ethtool_tcam_entry()
7209 if (fsp->flow_type == AH_V4_FLOW) niu_get_ethtool_tcam_entry()
7210 fsp->flow_type = ESP_V4_FLOW; niu_get_ethtool_tcam_entry()
7212 fsp->flow_type = ESP_V6_FLOW; niu_get_ethtool_tcam_entry()
7216 switch (fsp->flow_type) { niu_get_ethtool_tcam_entry()
7222 niu_get_ip4fs_from_tcam_key(tp, fsp); niu_get_ethtool_tcam_entry()
7233 niu_get_ip4fs_from_tcam_key(tp, fsp); niu_get_ethtool_tcam_entry()
7244 fsp->ring_cookie = RX_CLS_FLOW_DISC; niu_get_ethtool_tcam_entry()
7246 fsp->ring_cookie = (tp->assoc_data & TCAM_ASSOCDATA_OFFSET) >> niu_get_ethtool_tcam_entry()
7367 static void niu_get_tcamkey_from_ip4fs(struct ethtool_rx_flow_spec *fsp, niu_get_tcamkey_from_ip4fs() argument
7375 sip = be32_to_cpu(fsp->h_u.tcp_ip4_spec.ip4src); niu_get_tcamkey_from_ip4fs()
7376 sipm = be32_to_cpu(fsp->m_u.tcp_ip4_spec.ip4src); niu_get_tcamkey_from_ip4fs()
7377 dip = be32_to_cpu(fsp->h_u.tcp_ip4_spec.ip4dst); niu_get_tcamkey_from_ip4fs()
7378 dipm = be32_to_cpu(fsp->m_u.tcp_ip4_spec.ip4dst); niu_get_tcamkey_from_ip4fs()
7391 tp->key[2] |= ((u64)fsp->h_u.tcp_ip4_spec.tos << niu_get_tcamkey_from_ip4fs()
7393 tp->key_mask[2] |= ((u64)fsp->m_u.tcp_ip4_spec.tos << niu_get_tcamkey_from_ip4fs()
7395 switch (fsp->flow_type) { niu_get_tcamkey_from_ip4fs()
7399 sport = be16_to_cpu(fsp->h_u.tcp_ip4_spec.psrc); niu_get_tcamkey_from_ip4fs()
7400 spm = be16_to_cpu(fsp->m_u.tcp_ip4_spec.psrc); niu_get_tcamkey_from_ip4fs()
7401 dport = be16_to_cpu(fsp->h_u.tcp_ip4_spec.pdst); niu_get_tcamkey_from_ip4fs()
7402 dpm = be16_to_cpu(fsp->m_u.tcp_ip4_spec.pdst); niu_get_tcamkey_from_ip4fs()
7406 niu_ethflow_to_l3proto(fsp->flow_type, &pid); niu_get_tcamkey_from_ip4fs()
7410 spi = be32_to_cpu(fsp->h_u.ah_ip4_spec.spi); niu_get_tcamkey_from_ip4fs()
7411 spim = be32_to_cpu(fsp->m_u.ah_ip4_spec.spi); niu_get_tcamkey_from_ip4fs()
7415 niu_ethflow_to_l3proto(fsp->flow_type, &pid); niu_get_tcamkey_from_ip4fs()
7418 spi = be32_to_cpu(fsp->h_u.usr_ip4_spec.l4_4_bytes); niu_get_tcamkey_from_ip4fs()
7419 spim = be32_to_cpu(fsp->m_u.usr_ip4_spec.l4_4_bytes); niu_get_tcamkey_from_ip4fs()
7423 pid = fsp->h_u.usr_ip4_spec.proto; niu_get_tcamkey_from_ip4fs()
7440 struct ethtool_rx_flow_spec *fsp = &nfc->fs; niu_add_ethtool_tcam_entry() local
7454 if (fsp->flow_type == IP_USER_FLOW) { niu_add_ethtool_tcam_entry()
7457 struct ethtool_usrip4_spec *uspec = &fsp->h_u.usr_ip4_spec; niu_add_ethtool_tcam_entry()
7458 struct ethtool_usrip4_spec *umask = &fsp->m_u.usr_ip4_spec; niu_add_ethtool_tcam_entry()
7516 if (!niu_ethflow_to_class(fsp->flow_type, &class)) { niu_add_ethtool_tcam_entry()
7529 switch (fsp->flow_type) { niu_add_ethtool_tcam_entry()
7535 niu_get_tcamkey_from_ip4fs(fsp, tp, l2_rdc_table, class); niu_add_ethtool_tcam_entry()
7544 parent->index, __func__, fsp->flow_type); niu_add_ethtool_tcam_entry()
7548 niu_get_tcamkey_from_ip4fs(fsp, tp, l2_rdc_table, class); niu_add_ethtool_tcam_entry()
7552 parent->index, __func__, fsp->flow_type); niu_add_ethtool_tcam_entry()
7558 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { niu_add_ethtool_tcam_entry()
7561 if (fsp->ring_cookie >= np->num_rx_rings) { niu_add_ethtool_tcam_entry()
7564 (long long)fsp->ring_cookie); niu_add_ethtool_tcam_entry()
7569 (fsp->ring_cookie << niu_add_ethtool_tcam_entry()
7100 niu_get_ip4fs_from_tcam_key(struct niu_tcam_entry *tp, struct ethtool_rx_flow_spec *fsp) niu_get_ip4fs_from_tcam_key() argument
/linux-4.4.14/include/scsi/
H A Dlibfc.h716 * Send a fcp cmd from fsp pkt.
1048 static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) fc_fcp_is_read() argument
1050 if (fsp && fsp->cmd) fc_fcp_is_read()
1051 return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; fc_fcp_is_read()
/linux-4.4.14/drivers/input/mouse/
H A Dpsmouse-base.c1104 .alias = "fsp",
/linux-4.4.14/fs/nfsd/
H A Dnfs4state.c6888 nfsd4_get_freestateid(struct nfsd4_compound_state *cstate, struct nfsd4_free_stateid *fsp) nfsd4_get_freestateid() argument
6890 get_stateid(cstate, &fsp->fr_stateid); nfsd4_get_freestateid()

Completed in 881 milliseconds