2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
19 * bfa_fcs_uf.c BFA FCS UF ( Unsolicited Frames)
22 #include <fcs/bfa_fcs.h>
24 #include <fcs/bfa_fcs_fabric.h>
26 #include "fcs_trcmod.h"
27 #include "fcs_fabric.h"
30 BFA_TRC_FILE(FCS, UF);
33 * BFA callback for unsolicited frame receive handler.
35 * @param[in] cbarg callback arg for receive handler
36 * @param[in] uf unsolicited frame descriptor
41 bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
43 struct bfa_fcs_s *fcs = (struct bfa_fcs_s *) cbarg;
44 struct fchs_s *fchs = bfa_uf_get_frmbuf(uf);
45 u16 len = bfa_uf_get_frmlen(uf);
47 struct bfa_fcs_fabric_s *fabric;
50 * check for VFT header
52 if (fchs->routing == FC_RTG_EXT_HDR &&
53 fchs->cat_info == FC_CAT_VFT_HDR) {
54 bfa_stats(fcs, uf.tagged);
55 vft = bfa_uf_get_frmbuf(uf);
56 if (fcs->port_vfid == vft->vf_id)
57 fabric = &fcs->fabric;
59 fabric = bfa_fcs_vf_lookup(fcs, (u16) vft->vf_id);
62 * drop frame if vfid is unknown
66 bfa_stats(fcs, uf.vfid_unknown);
74 fchs = (struct fchs_s *) (vft + 1);
75 len -= sizeof(struct fc_vft_s);
77 bfa_trc(fcs, vft->vf_id);
79 bfa_stats(fcs, uf.untagged);
80 fabric = &fcs->fabric;
83 bfa_trc(fcs, ((u32 *) fchs)[0]);
84 bfa_trc(fcs, ((u32 *) fchs)[1]);
85 bfa_trc(fcs, ((u32 *) fchs)[2]);
86 bfa_trc(fcs, ((u32 *) fchs)[3]);
87 bfa_trc(fcs, ((u32 *) fchs)[4]);
88 bfa_trc(fcs, ((u32 *) fchs)[5]);
91 bfa_fcs_fabric_uf_recv(fabric, fchs, len);
96 bfa_fcs_uf_attach(struct bfa_fcs_s *fcs)
98 bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs);