Remove sa_hash_xxx:series short description
cover Remove sa_hash_xxx:series short description
The following series remove use of all sa_hash_xxx in hash table operations for fc_local_port, fc_remote_port, and fc_sess. sa_hash_kern.c and sa_hash.h are removed. All abstraction using sa_hash_xxx are removed and replaced by using hlist_head, hlist_node directly. Hash functions are in their own module now for fc_remote_port and fc_sess.
For fc_local_port, the hash is completely removed since there is always going to be just one fc_local_port per openfc/fcoe. For fc_remote_port, the hash by wwpn is removed with hash by remote port FCID already there. Hash entry counters are removed as they are used only in debugging/printting routines. All debugging/testing functions, e.g. hash table iterate, print, are removed as well.
Note that fc_virt_fab struct is still the place holder for the hash tables, which eventually will be in fcs_state struct once fc_virt_fab is merged with the fcs_state struct.
---
Yi Zou (4):
[FCoE] 4. remove sa_hash_kern.c/sa_hash.h [FCoE] 3. remove hash table for fc_local_port [FCoE] 2. hash for fc_sess: do not use sa_hash_xxx [FCoE] 1. hash for fc_remote_port: do not use sa_hash_xxx
drivers/scsi/ofc/include/fc_local_port.h | 6 drivers/scsi/ofc/include/fc_remote_port.h | 4 drivers/scsi/ofc/include/fc_sess.h | 3 drivers/scsi/ofc/include/sa_hash.h | 65 ----- drivers/scsi/ofc/libfc/fc_exch.c | 1 drivers/scsi/ofc/libfc/fc_local_port.c | 85 ------- drivers/scsi/ofc/libfc/fc_local_port_impl.h | 4 drivers/scsi/ofc/libfc/fc_remote_port.c | 325 ++++++++++++--------------- drivers/scsi/ofc/libfc/fc_sess.c | 214 +++++++++++------- drivers/scsi/ofc/libfc/fc_sess_impl.h | 3 drivers/scsi/ofc/libfc/fc_virt_fab.c | 5 drivers/scsi/ofc/libfc/fc_virt_fab_impl.h | 10 - drivers/scsi/ofc/libsa/Makefile | 4 drivers/scsi/ofc/libsa/sa_hash_kern.c | 141 ------------ 14 files changed, 298 insertions(+), 572 deletions(-) delete mode 100644 drivers/scsi/ofc/include/sa_hash.h delete mode 100644 drivers/scsi/ofc/libsa/sa_hash_kern.c
Signature · 1 line
Yi Zou <[email protected]>
PATCH 1/4 hash for fc_remote_port: do not use sa_hash_xxx
This patch removes using sa_hash_xxx and sticks to hlist_head and hlist_node struct for hashing the fc_remote_port, removing abstractions of sa_hash struct. The hash by world wide port name is redundant and thus removed. Also, all debugging rouintes are removed. The hash entry counter is removed as well as it is used only in debugging routines.
1. Added hash by fcid functions for fc_remote_port
2. Removed hash table by rport wwpn from fc_virt_fab struct
3. Removed fc_remote_port hash table entry counters
4. Removed debug iterate/print rouintes
5. Removed references to sa_hash_xxx
---
drivers/scsi/ofc/include/fc_remote_port.h | 4 drivers/scsi/ofc/libfc/fc_remote_port.c | 325 +++++++++++++---------------- drivers/scsi/ofc/libfc/fc_virt_fab_impl.h | 3 3 files changed, 146 insertions(+), 186 deletions(-)
drivers/scsi/ofc/include/fc_remote_port.h +1 -3
@@ -21,7 +21,6 @@#define _LIBFC_REMOTE_PORT_H_#include "sa_kernel.h" -#include "sa_hash.h" /* * Fibre Channel Remote Ports.
@@ -46,8 +45,7 @@ struct fc_remote_port {void *rp_client_priv;/* HBA driver private data */ void *rp_fcs_priv;/* FCS driver private data */ struct sa_event_list *rp_events;/* event list */ -struct sa_hash_link rp_fid_hash_link; -struct sa_hash_link rp_wwpn_hash_link; +struct hlist_node rp_fid_hash_link;/* * For now, there's just one session per remote port.
drivers/scsi/ofc/libfc/fc_remote_port.c +144 -181
428 lines not on this page · raw message
drivers/scsi/ofc/libfc/fc_virt_fab_impl.h +1 -2
@@ -23,8 +23,7 @@struct fc_virt_fab {uint vf_tag;/* virtual fabric tag (or zero) */ struct list_head vf_remote_ports;/* remote ports */ -struct sa_hash *vf_rport_by_fid;/* remote ports by FCID */ -struct sa_hash *vf_rport_by_wwpn;/* remote ports by WWPN */ +struct hlist_head *vf_rport_by_fid;/* remote ports by FCID */ struct sa_hash *vf_lport_by_fid;/* local ports by FCID */ struct sa_hash *vf_sess_by_fids;/* sessions by FCID pairs */ struct list_head vf_local_ports;/* list of local ports */
PATCH 2/4 hash for fc_sess: do not use sa_hash_xxx
In reply to Yi ZouThis patch removes using sa_hash_xxx and sticks to hlist_head and hlist_node struct for hashing the fc_sess struct, removing the use of the sa_hash struct. Also, the hash entry counter is removed as it's only used for debugging.
1. Added hash table funcs for fc_sess
2. Removed the fc_sess hash table entry counter
3. Removed refrences to sa_hash_xxx
---
drivers/scsi/ofc/include/fc_sess.h | 3 drivers/scsi/ofc/libfc/fc_sess.c | 214 +++++++++++++++++++---------- drivers/scsi/ofc/libfc/fc_sess_impl.h | 3 drivers/scsi/ofc/libfc/fc_virt_fab_impl.h | 2 4 files changed, 143 insertions(+), 79 deletions(-)
drivers/scsi/ofc/include/fc_sess.h +3 -0
@@ -81,6 +81,9 @@ static inline u_int64_t fc_sess_key(fc_fid_t local, fc_fid_t remote)int fc_sess_table_create (struct fc_virt_fab *);void fc_sess_table_destroy (struct fc_virt_fab *); +struct fc_sess *fc_sess_hash_lookup (const struct fc_virt_fab *vf, +uint64_t key); +/* * Lookup or create a new session. */
drivers/scsi/ofc/libfc/fc_sess.c +138 -76
284 lines not on this page · raw message
drivers/scsi/ofc/libfc/fc_sess_impl.h +1 -2
@@ -22,7 +22,6 @@#include <linux/timer.h> #include "fc_exch.h" -#include "sa_hash.h" #include <linux/rcupdate.h>
@@ -61,7 +60,7 @@ struct fc_sess { uint8_t fs_plogi_held : 1; /* sess held by remote login */struct sa_event_list *fs_events;/* event list */ enum fc_event fs_last_event;/* last reported event to clients */ -struct sa_hash_link fs_hash_link;/* link in hash by port pair */ +struct hlist_node fs_hash_link;/* link in hash by port pair */ struct fc_lun_disc *fs_lun_disc;/* active LUN discovery if any */ spinlock_t fs_lock;/* lock on state changes */ struct rcu_head fs_rcu;/* element for call_rcu() */
drivers/scsi/ofc/libfc/fc_virt_fab_impl.h +1 -1
@@ -25,7 +25,7 @@ struct fc_virt_fab {struct list_head vf_remote_ports;/* remote ports */ struct hlist_head *vf_rport_by_fid;/* remote ports by FCID */ struct sa_hash *vf_lport_by_fid;/* local ports by FCID */ -struct sa_hash *vf_sess_by_fids;/* sessions by FCID pairs */ +struct hlist_head *vf_sess_by_fids;/* sessions by FCID pairs */ struct list_head vf_local_ports;/* list of local ports */ struct fc_exch_mgr *vf_exch_mgr;/* exchange mgr for fabric */ spinlock_t vf_lock;/* lock for all tables and lists */
PATCH 3/4 remove hash table for fc_local_port
In reply to Yi ZouThis patch removes hash table for fc_local_port. The fc_local_port is always created per openfc/fcoe instance, no need to have the hash table. This also removes any use or references to sa_hash_xxx, as well as the abstraction of the sa_hash struct.
1. Removed local port hash by fid from struct fc_virt_fab
2. Remmoed local port hash functions from fc_local_port.c
3. Removed fl_hash_link from struct fc_local_port
4. Removed local port hash table create/destroy from fc_virt_fab.c
5. Removed all references to sa_hash_xxx
---
drivers/scsi/ofc/include/fc_local_port.h | 6 -- drivers/scsi/ofc/libfc/fc_local_port.c | 85 ++------------------------- drivers/scsi/ofc/libfc/fc_local_port_impl.h | 4 - drivers/scsi/ofc/libfc/fc_virt_fab.c | 5 -- drivers/scsi/ofc/libfc/fc_virt_fab_impl.h | 7 +- 5 files changed, 9 insertions(+), 98 deletions(-)
drivers/scsi/ofc/include/fc_local_port.h +0 -6
@@ -99,12 +99,6 @@ u_int fc_local_port_get_payload_size(struct fc_els_flogi *, u_int maxval);int fc_local_port_test_ready (struct fc_local_port *);/* -* Initialize local port lookups in virtual fabric. -*/ -int fc_local_port_table_create (struct fc_virt_fab *); -void fc_local_port_table_destroy (struct fc_virt_fab *); - -/* * For debugging and /sys only - return state name. */ const char *fc_local_port_state (struct fc_local_port *lp);
drivers/scsi/ofc/libfc/fc_local_port.c +5 -80
142 lines not on this page · raw message
drivers/scsi/ofc/libfc/fc_local_port_impl.h +1 -3
@@ -23,7 +23,6 @@#include <linux/timer.h> #include "fc_sess.h" #include "fc_sess_impl.h" -#include "sa_hash.h" #include "fc_ns.h" struct fc_els_rscn_page ;
@@ -47,7 +46,7 @@ enum fc_local_port_state {* * Locking notes: * Most of these fields are protected by fl_lock, with the exception that; -* fl_list, fl_hash_link, fl_sess_list, are protected by the virtual fabric +* fl_list, fl_sess_list, are protected by the virtual fabric * lock. The event list is protected by a lock in the sa_event facility. * The refcnt is atomic, and release doesn't acquire fl_lock, just vf_lock. */
@@ -82,7 +81,6 @@ struct fc_local_port { void *); /* callback for incoming PRLI */void *fl_prli_cb_arg;/* arg for PRLI callback */ struct sa_event_list *fl_events;/* event list head */ -struct sa_hash_link fl_hash_link;/* hash list linkage */ struct timer_list fl_timer;/* timer for state events */ /*
drivers/scsi/ofc/libfc/fc_virt_fab.c +0 -5
@@ -63,12 +63,8 @@ struct fc_virt_fab *fc_virt_fab_alloc(u_int tag, enum fc_class class, goto out_sp;if (fc_remote_port_table_create (vp)) goto out_rp; -if (fc_local_port_table_create (vp)) - goto out_lp;return vp; -out_lp: -fc_remote_port_table_destroy (vp); out_rp:fc_sess_table_destroy (vp); out_sp:
@@ -83,7 +79,6 @@ void fc_virt_fab_free(struct fc_virt_fab *vp) {fc_sess_table_destroy (vp);fc_remote_port_table_destroy (vp); -fc_local_port_table_destroy (vp);if (vp->vf_exch_mgr)fc_exch_mgr_free (vp->vf_exch_mgr);sa_free (vp);
drivers/scsi/ofc/libfc/fc_virt_fab_impl.h +3 -4
@@ -21,14 +21,13 @@#define _LIBFC_FC_VIRT_FAB_IMPL_H_struct fc_virt_fab { -uint vf_tag;/* virtual fabric tag (or zero) */ +uint32_t vf_tag;/* virtual fabric tag (or zero) */ +spinlock_t vf_lock;/* lock for all tables and lists */ struct list_head vf_remote_ports;/* remote ports */ +struct list_head vf_local_ports;/* list of local ports */ struct hlist_head *vf_rport_by_fid;/* remote ports by FCID */ -struct sa_hash *vf_lport_by_fid;/* local ports by FCID */ struct hlist_head *vf_sess_by_fids;/* sessions by FCID pairs */ -struct list_head vf_local_ports;/* list of local ports */ struct fc_exch_mgr *vf_exch_mgr;/* exchange mgr for fabric */ -spinlock_t vf_lock;/* lock for all tables and lists */ };/*
PATCH 4/4 remove sa_hash_kern.c/sa_hash.h
In reply to Yi ZouThis patch removes using sa_hash_kern.c and sa_hash.h files. All references to the sa_hash.h are also removed.
1. Removed libsa/sa_hash_kern.c
2. Removed include/sa_hash.h
3. Removed all references to sa_hash_xxx
4. Updated Makefile accordingly in libsa
---
drivers/scsi/ofc/include/sa_hash.h | 65 --------------- drivers/scsi/ofc/libfc/fc_exch.c | 1 drivers/scsi/ofc/libsa/Makefile | 4 - drivers/scsi/ofc/libsa/sa_hash_kern.c | 141 --------------------------------- 4 files changed, 1 insertions(+), 210 deletions(-) delete mode 100644 drivers/scsi/ofc/include/sa_hash.h delete mode 100644 drivers/scsi/ofc/libsa/sa_hash_kern.c
drivers/scsi/ofc/include/sa_hash.h deleted +0 -65
@@ -1,65 +0,0 @@ -/* -* Copyright(c) 2007 Intel Corporation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. -* -* Maintained at www.Open-FCoE.org -*/ - -#ifndef _LIBSA_HASH_H_ -#define _LIBSA_HASH_H_ - -#include <linux/list.h> - -/* -* Hash table facility. -*/ -struct sa_hash ; - -/* -* Hash key value. -*/ -typedef void *sa_hash_key_t ;/* pointer hash key */ -typedef u_int32_t sa_hash_key32_t ;/* fixed-size 32-bit hash key */ - -struct sa_hash_type { -u_int16_t st_link_offset;/* offset of linkage in the element */ -int (*st_match)(const sa_hash_key_t ,void *elem); -u_int32_t (*st_hash)(const sa_hash_key_t ); -}; - -/* -* Element linkage on the hash. -* The collision list is circular. -*/ -#define sa_hash_link hlist_node - -struct sa_hash *sa_hash_create (const struct sa_hash_type *,u_int32_t size); - -void sa_hash_destroy (struct sa_hash *); - -void *sa_hash_lookup (struct sa_hash *,const sa_hash_key_t ); - -void sa_hash_insert (struct sa_hash *,const sa_hash_key_t ,void *elem); - -void sa_hash_insert_next (struct sa_hash *,sa_hash_key32_t *, -sa_hash_key32_t min_key,sa_hash_key32_t max_key, -void *elem); - -void *sa_hash_lookup_delete (struct sa_hash *,const sa_hash_key_t ); - -void sa_hash_iterate (struct sa_hash *, -void (*callback)(void *entry,void *arg),void *arg); - -#endif /* _LIBSA_HASH_H_ */
drivers/scsi/ofc/libfc/fc_exch.c +0 -1
@@ -27,7 +27,6 @@#include "sa_kernel.h" #include "net_types.h" #include "ofc_dbg.h" -#include "sa_hash.h" #include "fc_fcip.h" #include "fc_fc2.h"
drivers/scsi/ofc/libsa/Makefile +1 -3
@@ -4,6 +4,4 @@ EXTRA_CFLAGS += -I$(OFC_DIR)/include obj-y += libsa.o -libsa-y := \ - sa_event.o \ - sa_hash_kern.o +libsa-y := sa_event.o
drivers/scsi/ofc/libsa/sa_hash_kern.c deleted +0 -141
141 lines not on this page · raw message