Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lpfc: Fix external loopback failure.

Fix external loopback failure.

Rx sequence reassembly was incorrect.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

James Smart and committed by
Martin K. Petersen
4360ca9c 01c73bbc

+13 -2
+13 -2
drivers/scsi/lpfc/lpfc_sli.c
··· 14842 14842 struct lpfc_dmabuf *h_buf; 14843 14843 struct hbq_dmabuf *seq_dmabuf = NULL; 14844 14844 struct hbq_dmabuf *temp_dmabuf = NULL; 14845 + uint8_t found = 0; 14845 14846 14846 14847 INIT_LIST_HEAD(&dmabuf->dbuf.list); 14847 14848 dmabuf->time_stamp = jiffies; 14848 14849 new_hdr = (struct fc_frame_header *)dmabuf->hbuf.virt; 14850 + 14849 14851 /* Use the hdr_buf to find the sequence that this frame belongs to */ 14850 14852 list_for_each_entry(h_buf, &vport->rcv_buffer_list, list) { 14851 14853 temp_hdr = (struct fc_frame_header *)h_buf->virt; ··· 14887 14885 return seq_dmabuf; 14888 14886 } 14889 14887 /* find the correct place in the sequence to insert this frame */ 14890 - list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) { 14888 + d_buf = list_entry(seq_dmabuf->dbuf.list.prev, typeof(*d_buf), list); 14889 + while (!found) { 14891 14890 temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); 14892 14891 temp_hdr = (struct fc_frame_header *)temp_dmabuf->hbuf.virt; 14893 14892 /* ··· 14898 14895 if (be16_to_cpu(new_hdr->fh_seq_cnt) > 14899 14896 be16_to_cpu(temp_hdr->fh_seq_cnt)) { 14900 14897 list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list); 14901 - return seq_dmabuf; 14898 + found = 1; 14899 + break; 14902 14900 } 14901 + 14902 + if (&d_buf->list == &seq_dmabuf->dbuf.list) 14903 + break; 14904 + d_buf = list_entry(d_buf->list.prev, typeof(*d_buf), list); 14903 14905 } 14906 + 14907 + if (found) 14908 + return seq_dmabuf; 14904 14909 return NULL; 14905 14910 } 14906 14911