Skip to content

Commit

Permalink
scsi: libfc: Move scsi/fc_encode.h to libfc
Browse files Browse the repository at this point in the history
Most of this file is only used inside of libfc, so move it to where it is
actually used, with only fc_fill_fc_hdr() left inside of the header.

Link: https://lore.kernel.org/r/[email protected]
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
arndb authored and martinkpetersen committed Oct 30, 2020
1 parent ae6b4e6 commit e31ac89
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 39 deletions.
1 change: 0 additions & 1 deletion drivers/scsi/bnx2fc/bnx2fc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include <scsi/scsi_tcq.h>
#include <scsi/libfc.h>
#include <scsi/libfcoe.h>
#include <scsi/fc_encode.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/fc/fc_fip.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libfc/fc_elsct.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <scsi/fc/fc_ns.h>
#include <scsi/fc/fc_els.h>
#include <scsi/libfc.h>
#include <scsi/fc_encode.h>
#include "fc_encode.h"
#include "fc_libfc.h"

/**
Expand Down
30 changes: 1 addition & 29 deletions include/scsi/fc_encode.h → drivers/scsi/libfc/fc_encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define _FC_ENCODE_H_
#include <asm/unaligned.h>
#include <linux/utsname.h>
#include <scsi/fc/fc_ms.h>

/*
* F_CTL values for simple requests and responses.
Expand Down Expand Up @@ -39,35 +40,6 @@ struct fc_ct_req {
} payload;
};

static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
enum fc_rctl r_ctl,
u32 did, u32 sid, enum fc_fh_type type,
u32 f_ctl, u32 parm_offset)
{
WARN_ON(r_ctl == 0);
fh->fh_r_ctl = r_ctl;
hton24(fh->fh_d_id, did);
hton24(fh->fh_s_id, sid);
fh->fh_type = type;
hton24(fh->fh_f_ctl, f_ctl);
fh->fh_cs_ctl = 0;
fh->fh_df_ctl = 0;
fh->fh_parm_offset = htonl(parm_offset);
}

/**
* fill FC header fields in specified fc_frame
*/
static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
u32 did, u32 sid, enum fc_fh_type type,
u32 f_ctl, u32 parm_offset)
{
struct fc_frame_header *fh;

fh = fc_frame_header_get(fp);
__fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
}

/**
* fc_adisc_fill() - Fill in adisc request frame
* @lport: local port.
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/libfc/fc_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <scsi/fc/fc_fc2.h>

#include <scsi/libfc.h>
#include <scsi/fc_encode.h>

#include "fc_libfc.h"

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libfc/fc_fcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <scsi/fc/fc_fc2.h>

#include <scsi/libfc.h>
#include <scsi/fc_encode.h>

#include "fc_encode.h"
#include "fc_libfc.h"

static struct kmem_cache *scsi_pkt_cachep;
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libfc/fc_libfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <linux/module.h>

#include <scsi/libfc.h>
#include <scsi/fc_encode.h>

#include "fc_encode.h"
#include "fc_libfc.h"

MODULE_AUTHOR("Open-FCoE.org");
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libfc/fc_lport.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
#include <scsi/fc/fc_gs.h>

#include <scsi/libfc.h>
#include <scsi/fc_encode.h>
#include <linux/scatterlist.h>

#include "fc_encode.h"
#include "fc_libfc.h"

/* Fabric IDs to use for point-to-point mode, chosen on whims. */
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libfc/fc_rport.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
#include <asm/unaligned.h>

#include <scsi/libfc.h>
#include <scsi/fc_encode.h>

#include "fc_encode.h"
#include "fc_libfc.h"

static struct workqueue_struct *rport_event_queue;
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/qedf/qedf.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <scsi/fc/fc_fip.h>
#include <scsi/fc/fc_fc2.h>
#include <scsi/scsi_tcq.h>
#include <scsi/fc_encode.h>
#include <linux/version.h>


Expand Down
1 change: 0 additions & 1 deletion drivers/target/tcm_fc/tfc_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <asm/unaligned.h>
#include <scsi/scsi_tcq.h>
#include <scsi/libfc.h>
#include <scsi/fc_encode.h>

#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/target/tcm_fc/tfc_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <linux/ratelimit.h>
#include <asm/unaligned.h>
#include <scsi/libfc.h>
#include <scsi/fc_encode.h>

#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
Expand Down
30 changes: 30 additions & 0 deletions include/scsi/fc_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,34 @@ static inline bool fc_frame_is_cmd(const struct fc_frame *fp)
*/
void fc_frame_leak_check(void);

static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
enum fc_rctl r_ctl,
u32 did, u32 sid, enum fc_fh_type type,
u32 f_ctl, u32 parm_offset)
{
WARN_ON(r_ctl == 0);
fh->fh_r_ctl = r_ctl;
hton24(fh->fh_d_id, did);
hton24(fh->fh_s_id, sid);
fh->fh_type = type;
hton24(fh->fh_f_ctl, f_ctl);
fh->fh_cs_ctl = 0;
fh->fh_df_ctl = 0;
fh->fh_parm_offset = htonl(parm_offset);
}

/**
* fill FC header fields in specified fc_frame
*/
static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
u32 did, u32 sid, enum fc_fh_type type,
u32 f_ctl, u32 parm_offset)
{
struct fc_frame_header *fh;

fh = fc_frame_header_get(fp);
__fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
}


#endif /* _FC_FRAME_H_ */

0 comments on commit e31ac89

Please sign in to comment.