Skip to contentSkip to conversation

Open-FCoE.org libfc and fcoe updates for scsi-misc

PATCH New Yi Zou 1 participant 7 messages Sep 28, 2011

Subsystems (2)
lore
Share & tools
lore

Yi Zou

author
#0 lore raw

cover Open-FCoE.org libfc and fcoe updates for scsi-misc

This series consists of updates for the libfc and fcoe modules. There are no features in this series and most patches are performance improvement related bug fixes.

Thanks,
yi

---

Eric Dumazet (1):
fcoe: use kthread_create_on_node

Vasu Dev (5):
fcoe: setup default initial value for DDP threshold
fcoe: use real dev in case of HW vlan acceleration
libfc: cache align fc_exch_pool
libfc: cache align struct fc_exch fields
libfc: cache align struct fc_fcp_pkt fields

 drivers/scsi/fcoe/fcoe.c     |   16 +++++++--
 drivers/scsi/fcoe/fcoe.h     |    1 +
 drivers/scsi/libfc/fc_exch.c |   11 +++---
 drivers/scsi/libfc/fc_fcp.c  |    2 -
 include/scsi/libfc.h         |   76 ++++++++++++++++++------------------------
 5 files changed, 51 insertions(+), 55 deletions(-)
Signature · 1 line
Signature: Yi Zou <[email protected]>
author
#1 lore raw

PATCH 1/6 fcoe: use kthread_create_on_node

From: Eric Dumazet <[email protected]>

Since fcoe_percpu_thread_create() creates percpu kthread, it makes sense to use kthread_create_on_node() to get proper NUMA affinity for kthread stack.

CC Neerav Parikh <[email protected]>
CC Kiran Patil <[email protected]>
CC "James E.J. Bottomley" <[email protected]>

---

 drivers/scsi/fcoe/fcoe.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe.c +3 -2
index 5d0e9a2..5a28940 100644
@@ -1135,8 +1135,9 @@ static void fcoe_percpu_thread_create(unsigned int cpu)
 
 	p = &per_cpu(fcoe_percpu, cpu);
 
-	thread = kthread_create(fcoe_percpu_receive_thread,
-				(void *)p, "fcoethread/%d", cpu);
+	thread = kthread_create_on_node(fcoe_percpu_receive_thread,
+					(void *)p, cpu_to_node(cpu),
+					"fcoethread/%d", cpu);
 
 	if (likely(!IS_ERR(thread))) {
 		kthread_bind(thread, cpu);
author
#2 lore raw

PATCH 2/6 libfc: cache align struct fc_fcp_pkt fields

In reply to Yi Zou

From: Vasu Dev <[email protected]>

Re-arrange its fields to avoid padding and have better cacheline alignments.

Removed not used start_time, end_time and last_pkt_time fields.

This all reduced this struct size to 448 from 480 and that also reduced one cacheline on x86_64 beside eliminating 8 pads. However kept logical fields together.

---

 drivers/scsi/libfc/fc_fcp.c |    2 --
 include/scsi/libfc.h        |   49 ++++++++++++++++++-------------------------
 2 files changed, 21 insertions(+), 30 deletions(-)
drivers/scsi/libfc/fc_fcp.c +0 -2
index 4c41ee8..221875e 100644
@@ -759,7 +759,6 @@ static void fc_fcp_recv(struct fc_seq *seq, struct fc_frame *fp, void *arg)
 		goto out;
 	if (fc_fcp_lock_pkt(fsp))
 		goto out;
-	fsp->last_pkt_time = jiffies;
 
 	if (fh->fh_type == FC_TYPE_BLS) {
 		fc_fcp_abts_resp(fsp, fp);
@@ -1148,7 +1147,6 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
 		rc = -1;
 		goto unlock;
 	}
-	fsp->last_pkt_time = jiffies;
 	fsp->seq_ptr = seq;
 	fc_fcp_pkt_hold(fsp);	/* hold for fc_fcp_pkt_destroy */
 
include/scsi/libfc.h +21 -28

80 lines not on this page · raw message

author
#3 lore raw

PATCH 3/6 libfc: cache align struct fc_exch fields

In reply to Yi Zou

From: Vasu Dev <[email protected]>

cache aligned xid and ex_lock beside
removing holes.

---

 include/scsi/libfc.h |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)
include/scsi/libfc.h +12 -15
index 05e2583..5d1a758 100644
@@ -406,35 +406,32 @@ struct fc_seq {
  *	sequence allocation
  */
 struct fc_exch {
+	spinlock_t	    ex_lock;
+	atomic_t	    ex_refcnt;
+	enum fc_class	    class;
 	struct fc_exch_mgr  *em;
 	struct fc_exch_pool *pool;
-	u32		    state;
-	u16		    xid;
 	struct list_head    ex_list;
-	spinlock_t	    ex_lock;
-	atomic_t	    ex_refcnt;
-	struct delayed_work timeout_work;
 	struct fc_lport	    *lp;
+	u32		    esb_stat;
+	u8		    state;
+	u8		    fh_type;
+	u8		    seq_id;
+	u8		    encaps;
+	u16		    xid;
 	u16		    oxid;
 	u16		    rxid;
 	u32		    oid;
 	u32		    sid;
 	u32		    did;
-	u32		    esb_stat;
 	u32		    r_a_tov;
-	u8		    seq_id;
-	u8		    encaps;
 	u32		    f_ctl;
-	u8		    fh_type;
-	enum fc_class	    class;
-	struct fc_seq	    seq;
-
+	struct fc_seq       seq;
 	void		    (*resp)(struct fc_seq *, struct fc_frame *, void *);
 	void		    *arg;
-
 	void		    (*destructor)(struct fc_seq *, void *);
-
-};
+	struct delayed_work timeout_work;
+} ____cacheline_aligned_in_smp;
 #define	fc_seq_exch(sp) container_of(sp, struct fc_exch, seq)
 
 
author
#4 lore raw

PATCH 4/6 libfc: cache align fc_exch_pool

In reply to Yi Zou

From: Vasu Dev <[email protected]>

fix holes and better cache aligned fields.

---

 drivers/scsi/libfc/fc_exch.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/scsi/libfc/fc_exch.c +5 -6
index d261e98..7c055fd 100644
@@ -65,16 +65,15 @@ static struct workqueue_struct *fc_exch_workqueue;
  * assigned range of exchanges to per cpu pool.
  */
 struct fc_exch_pool {
+	spinlock_t	 lock;
+	struct list_head ex_list;
 	u16		 next_index;
 	u16		 total_exches;
 
 	/* two cache of free slot in exch array */
 	u16		 left;
 	u16		 right;
-
-	spinlock_t	 lock;
-	struct list_head ex_list;
-};
+} ____cacheline_aligned_in_smp;
 
 /**
  * struct fc_exch_mgr - The Exchange Manager (EM).
@@ -91,13 +90,13 @@ struct fc_exch_pool {
  * It manages the allocation of exchange IDs.
  */
 struct fc_exch_mgr {
+	struct fc_exch_pool *pool;
+	mempool_t	*ep_pool;
 	enum fc_class	class;
 	struct kref	kref;
 	u16		min_xid;
 	u16		max_xid;
-	mempool_t	*ep_pool;
 	u16		pool_max_index;
-	struct fc_exch_pool *pool;
 
 	/*
 	 * currently exchange mgr stats are updated but not used.
author
#6 lore raw

PATCH 6/6 fcoe: setup default initial value for DDP threshold

In reply to Yi Zou

From: Vasu Dev <[email protected]>

Currently fcoe_ddp_min doesn't have default value so by default not used, so setting up default value as 4k as this works better by avoiding overhead of programing DDP for small IOs.

---

 drivers/scsi/fcoe/fcoe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/fcoe/fcoe.c +1 -1
index cd203d7..430b2cd 100644
@@ -52,7 +52,7 @@ MODULE_DESCRIPTION("FCoE");
 MODULE_LICENSE("GPL v2");
 
 /* Performance tuning parameters for fcoe */
-static unsigned int fcoe_ddp_min;
+static unsigned int fcoe_ddp_min = 4096;
 module_param_named(ddp_min, fcoe_ddp_min, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(ddp_min, "Minimum I/O size in bytes for "	\
 		 "Direct Data Placement (DDP).");
author
#5 lore raw

PATCH 5/6 fcoe: use real dev in case of HW vlan acceleration

In reply to Yi Zou

From: Vasu Dev <[email protected]>

Use real dev in case it has HW vlan acceleration support since in this case the real dev would do needed vlan processing, this way unnecessary vlan layer processing avoided and it gives slightly better IOPS with 512B size IOs.

---

 drivers/scsi/fcoe/fcoe.c |    9 ++++++++-
 drivers/scsi/fcoe/fcoe.h |    1 +
 2 files changed, 9 insertions(+), 1 deletions(-)
drivers/scsi/fcoe/fcoe.c +8 -1
index 5a28940..cd203d7 100644
@@ -281,6 +281,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
 	 * use the first one for SPMA */
 	real_dev = (netdev->priv_flags & IFF_802_1Q_VLAN) ?
 		vlan_dev_real_dev(netdev) : netdev;
+	fcoe->realdev = real_dev;
 	rcu_read_lock();
 	for_each_dev_addr(real_dev, ha) {
 		if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
@@ -1540,7 +1541,13 @@ int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp)
 	skb_reset_network_header(skb);
 	skb->mac_len = elen;
 	skb->protocol = htons(ETH_P_FCOE);
-	skb->dev = fcoe->netdev;
+	if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN &&
+	    fcoe->realdev->features & NETIF_F_HW_VLAN_TX) {
+		skb->vlan_tci = VLAN_TAG_PRESENT |
+				vlan_dev_vlan_id(fcoe->netdev);
+		skb->dev = fcoe->realdev;
+	} else
+		skb->dev = fcoe->netdev;
 
 	/* fill up mac and fcoe headers */
 	eh = eth_hdr(skb);
drivers/scsi/fcoe/fcoe.h +1 -0
index c4a9399..e4c9afe 100644
@@ -80,6 +80,7 @@ do {                                                            	\
 struct fcoe_interface {
 	struct list_head   list;
 	struct net_device  *netdev;
+	struct net_device  *realdev;
 	struct packet_type fcoe_packet_type;
 	struct packet_type fip_packet_type;
 	struct fcoe_ctlr   ctlr;