.. | .. |
---|
610 | 610 | rc = bnx2fc_initiate_els(tgt, ELS_REC, &rec, sizeof(rec), |
---|
611 | 611 | bnx2fc_rec_compl, cb_arg, |
---|
612 | 612 | r_a_tov); |
---|
613 | | -rec_err: |
---|
614 | 613 | if (rc) { |
---|
615 | 614 | BNX2FC_IO_DBG(orig_io_req, "REC failed - release\n"); |
---|
616 | 615 | spin_lock_bh(&tgt->tgt_lock); |
---|
.. | .. |
---|
618 | 617 | spin_unlock_bh(&tgt->tgt_lock); |
---|
619 | 618 | kfree(cb_arg); |
---|
620 | 619 | } |
---|
| 620 | +rec_err: |
---|
621 | 621 | return rc; |
---|
622 | 622 | } |
---|
623 | 623 | |
---|
.. | .. |
---|
654 | 654 | rc = bnx2fc_initiate_els(tgt, ELS_SRR, &srr, sizeof(srr), |
---|
655 | 655 | bnx2fc_srr_compl, cb_arg, |
---|
656 | 656 | r_a_tov); |
---|
657 | | -srr_err: |
---|
658 | 657 | if (rc) { |
---|
659 | 658 | BNX2FC_IO_DBG(orig_io_req, "SRR failed - release\n"); |
---|
660 | 659 | spin_lock_bh(&tgt->tgt_lock); |
---|
.. | .. |
---|
664 | 663 | } else |
---|
665 | 664 | set_bit(BNX2FC_FLAG_SRR_SENT, &orig_io_req->req_flags); |
---|
666 | 665 | |
---|
| 666 | +srr_err: |
---|
667 | 667 | return rc; |
---|
668 | 668 | } |
---|
669 | 669 | |
---|
.. | .. |
---|
854 | 854 | kref_put(&els_req->refcount, bnx2fc_cmd_release); |
---|
855 | 855 | } |
---|
856 | 856 | |
---|
| 857 | +#define BNX2FC_FCOE_MAC_METHOD_GRANGED_MAC 1 |
---|
| 858 | +#define BNX2FC_FCOE_MAC_METHOD_FCF_MAP 2 |
---|
| 859 | +#define BNX2FC_FCOE_MAC_METHOD_FCOE_SET_MAC 3 |
---|
857 | 860 | static void bnx2fc_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, |
---|
858 | 861 | void *arg) |
---|
859 | 862 | { |
---|
860 | 863 | struct fcoe_ctlr *fip = arg; |
---|
861 | 864 | struct fc_exch *exch = fc_seq_exch(seq); |
---|
862 | 865 | struct fc_lport *lport = exch->lp; |
---|
863 | | - u8 *mac; |
---|
864 | | - u8 op; |
---|
| 866 | + |
---|
| 867 | + struct fc_frame_header *fh; |
---|
| 868 | + u8 *granted_mac; |
---|
| 869 | + u8 fcoe_mac[6]; |
---|
| 870 | + u8 fc_map[3]; |
---|
| 871 | + int method; |
---|
865 | 872 | |
---|
866 | 873 | if (IS_ERR(fp)) |
---|
867 | 874 | goto done; |
---|
868 | 875 | |
---|
869 | | - mac = fr_cb(fp)->granted_mac; |
---|
870 | | - if (is_zero_ether_addr(mac)) { |
---|
871 | | - op = fc_frame_payload_op(fp); |
---|
872 | | - if (lport->vport) { |
---|
873 | | - if (op == ELS_LS_RJT) { |
---|
874 | | - printk(KERN_ERR PFX "bnx2fc_flogi_resp is LS_RJT\n"); |
---|
875 | | - fc_vport_terminate(lport->vport); |
---|
876 | | - fc_frame_free(fp); |
---|
877 | | - return; |
---|
878 | | - } |
---|
879 | | - } |
---|
880 | | - fcoe_ctlr_recv_flogi(fip, lport, fp); |
---|
| 876 | + fh = fc_frame_header_get(fp); |
---|
| 877 | + granted_mac = fr_cb(fp)->granted_mac; |
---|
| 878 | + |
---|
| 879 | + /* |
---|
| 880 | + * We set the source MAC for FCoE traffic based on the Granted MAC |
---|
| 881 | + * address from the switch. |
---|
| 882 | + * |
---|
| 883 | + * If granted_mac is non-zero, we use that. |
---|
| 884 | + * If the granted_mac is zeroed out, create the FCoE MAC based on |
---|
| 885 | + * the sel_fcf->fc_map and the d_id fo the FLOGI frame. |
---|
| 886 | + * If sel_fcf->fc_map is 0, then we use the default FCF-MAC plus the |
---|
| 887 | + * d_id of the FLOGI frame. |
---|
| 888 | + */ |
---|
| 889 | + if (!is_zero_ether_addr(granted_mac)) { |
---|
| 890 | + ether_addr_copy(fcoe_mac, granted_mac); |
---|
| 891 | + method = BNX2FC_FCOE_MAC_METHOD_GRANGED_MAC; |
---|
| 892 | + } else if (fip->sel_fcf && fip->sel_fcf->fc_map != 0) { |
---|
| 893 | + hton24(fc_map, fip->sel_fcf->fc_map); |
---|
| 894 | + fcoe_mac[0] = fc_map[0]; |
---|
| 895 | + fcoe_mac[1] = fc_map[1]; |
---|
| 896 | + fcoe_mac[2] = fc_map[2]; |
---|
| 897 | + fcoe_mac[3] = fh->fh_d_id[0]; |
---|
| 898 | + fcoe_mac[4] = fh->fh_d_id[1]; |
---|
| 899 | + fcoe_mac[5] = fh->fh_d_id[2]; |
---|
| 900 | + method = BNX2FC_FCOE_MAC_METHOD_FCF_MAP; |
---|
| 901 | + } else { |
---|
| 902 | + fc_fcoe_set_mac(fcoe_mac, fh->fh_d_id); |
---|
| 903 | + method = BNX2FC_FCOE_MAC_METHOD_FCOE_SET_MAC; |
---|
881 | 904 | } |
---|
882 | | - if (!is_zero_ether_addr(mac)) |
---|
883 | | - fip->update_mac(lport, mac); |
---|
| 905 | + |
---|
| 906 | + BNX2FC_HBA_DBG(lport, "fcoe_mac=%pM method=%d\n", fcoe_mac, method); |
---|
| 907 | + fip->update_mac(lport, fcoe_mac); |
---|
884 | 908 | done: |
---|
885 | 909 | fc_lport_flogi_resp(seq, fp, lport); |
---|
886 | 910 | } |
---|