[PATCH 00/15] ehea updates v2
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:17:20
Ben, Jesse, Michael: thanks for the review. Here is an updated set of patches based on the comments. Anton
28 messages, 6 authors, 2011-05-31 · open the first message on its own page
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:17:20
Ben, Jesse, Michael: thanks for the review. Here is an updated set of patches based on the comments. Anton
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:17:23
The ehea driver had some multiqueue support but was missing the last
few years of networking stack improvements:
- Use skb_record_rx_queue to record which queue an skb came in on.
- Remove the driver specific netif_queue lock and use the networking
stack transmit lock instead.
- Remove the driver specific transmit queue hashing and use
skb_get_queue_mapping instead.
- Use netif_tx_{start|stop|wake}_queue where appropriate. We can also
remove pr->queue_stopped and just check the queue status directly.
- Print all 16 queues in the ethtool stats.
We now enable multiqueue by default since it is a clear win on all my
testing so far.
Signed-off-by: Anton Blanchard <redacted>
---
v2: Review from Michael Ellerman:
- Move skb_record_rx_queue into ehea_fill_skb
- Fix unlock issue when stopping a transmit queue in ehea_proc_cqes.
For my penance I cut the queue down to force the stop/start logic
to be exercised. Over a million queue stop/start operations completed
successfully while running a TCP RR benchmark.
Index: linux-net/drivers/net/ehea/ehea_main.c
===================================================================--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:48.840103988 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:49.640116670 +1000@@ -60,7 +60,7 @@ static int rq1_entries = EHEA_DEF_ENTRIE static int rq2_entries = EHEA_DEF_ENTRIES_RQ2; static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; static int sq_entries = EHEA_DEF_ENTRIES_SQ; -static int use_mcs; +static int use_mcs = 1; static int use_lro; static int lro_max_aggr = EHEA_LRO_MAX_AGGR; static int num_tx_qps = EHEA_NUM_TX_QP;
@@ -93,7 +93,7 @@ MODULE_PARM_DESC(rq1_entries, "Number of MODULE_PARM_DESC(sq_entries, " Number of entries for the Send Queue " "[2^x - 1], x = [6..14]. Default = " __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); -MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 0 "); +MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 "); MODULE_PARM_DESC(lro_max_aggr, " LRO: Max packets to be aggregated. Default = " __MODULE_STRING(EHEA_LRO_MAX_AGGR));
@@ -542,7 +542,8 @@ static inline int ehea_check_cqe(struct } static inline void ehea_fill_skb(struct net_device *dev, - struct sk_buff *skb, struct ehea_cqe *cqe) + struct sk_buff *skb, struct ehea_cqe *cqe, + struct ehea_port_res *pr) { int length = cqe->num_bytes_transfered - 4; /*remove CRC */
@@ -556,6 +557,8 @@ static inline void ehea_fill_skb(struct skb->csum = csum_unfold(~cqe->inet_checksum_value); } else skb->ip_summed = CHECKSUM_UNNECESSARY; + + skb_record_rx_queue(skb, pr - &pr->port->port_res[0]); } static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
@@ -752,7 +755,7 @@ static int ehea_proc_rwqes(struct net_de } skb_copy_to_linear_data(skb, ((char *)cqe) + 64, cqe->num_bytes_transfered - 4); - ehea_fill_skb(dev, skb, cqe); + ehea_fill_skb(dev, skb, cqe, pr); } else if (rq == 2) { /* RQ2 */ skb = get_skb_by_index(skb_arr_rq2,
@@ -762,7 +765,7 @@ static int ehea_proc_rwqes(struct net_de "rq2: skb=NULL\n"); break; } - ehea_fill_skb(dev, skb, cqe); + ehea_fill_skb(dev, skb, cqe, pr); processed_rq2++; } else { /* RQ3 */
@@ -773,7 +776,7 @@ static int ehea_proc_rwqes(struct net_de "rq3: skb=NULL\n"); break; } - ehea_fill_skb(dev, skb, cqe); + ehea_fill_skb(dev, skb, cqe, pr); processed_rq3++; }
@@ -859,7 +862,8 @@ static struct ehea_cqe *ehea_proc_cqes(s int cqe_counter = 0; int swqe_av = 0; int index; - unsigned long flags; + struct netdev_queue *txq = netdev_get_tx_queue(pr->port->netdev, + pr - &pr->port->port_res[0]); cqe = ehea_poll_cq(send_cq); while (cqe && (quota > 0)) {
@@ -909,14 +913,15 @@ static struct ehea_cqe *ehea_proc_cqes(s ehea_update_feca(send_cq, cqe_counter); atomic_add(swqe_av, &pr->swqe_avail); - spin_lock_irqsave(&pr->netif_queue, flags); - - if (pr->queue_stopped && (atomic_read(&pr->swqe_avail) - >= pr->swqe_refill_th)) { - netif_wake_queue(pr->port->netdev); - pr->queue_stopped = 0; + if (unlikely(netif_tx_queue_stopped(txq) && + (atomic_read(&pr->swqe_avail) >= pr->swqe_refill_th))) { + __netif_tx_lock(txq, smp_processor_id()); + if (netif_tx_queue_stopped(txq) && + (atomic_read(&pr->swqe_avail) >= pr->swqe_refill_th)) + netif_tx_wake_queue(txq); + __netif_tx_unlock(txq); } - spin_unlock_irqrestore(&pr->netif_queue, flags); + wake_up(&pr->port->swqe_avail_wq); return cqe;
@@ -1253,7 +1258,7 @@ static void ehea_parse_eqe(struct ehea_a netif_info(port, link, dev, "Logical port down\n"); netif_carrier_off(dev); - netif_stop_queue(dev); + netif_tx_disable(dev); } if (EHEA_BMASK_GET(NEQE_EXTSWITCH_PORT_UP, eqe)) {
@@ -1284,7 +1289,7 @@ static void ehea_parse_eqe(struct ehea_a case EHEA_EC_PORT_MALFUNC: netdev_info(dev, "Port malfunction\n"); netif_carrier_off(dev); - netif_stop_queue(dev); + netif_tx_disable(dev); break; default: netdev_err(dev, "unknown event code %x, eqe=0x%llX\n", ec, eqe);
@@ -1536,7 +1541,6 @@ static int ehea_init_port_res(struct ehe pr->rx_packets = rx_packets; pr->port = port; - spin_lock_init(&pr->netif_queue); pr->eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0); if (!pr->eq) {
@@ -2233,35 +2237,17 @@ static void ehea_xmit3(struct sk_buff *s dev_kfree_skb(skb); } -static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps) -{ - struct tcphdr *tcp; - u32 tmp; - - if ((skb->protocol == htons(ETH_P_IP)) && - (ip_hdr(skb)->protocol == IPPROTO_TCP)) { - tcp = (struct tcphdr *)(skb_network_header(skb) + - (ip_hdr(skb)->ihl * 4)); - tmp = (tcp->source + (tcp->dest << 16)) % 31; - tmp += ip_hdr(skb)->daddr % 31; - return tmp % num_qps; - } else - return 0; -} - static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ehea_port *port = netdev_priv(dev); struct ehea_swqe *swqe; - unsigned long flags; u32 lkey; int swqe_index; struct ehea_port_res *pr; + struct netdev_queue *txq; - pr = &port->port_res[ehea_hash_skb(skb, port->num_tx_qps)]; - - if (pr->queue_stopped) - return NETDEV_TX_BUSY; + pr = &port->port_res[skb_get_queue_mapping(skb)]; + txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); swqe = ehea_get_swqe(pr->qp, &swqe_index); memset(swqe, 0, SWQE_HEADER_SIZE);
@@ -2311,20 +2297,15 @@ static int ehea_start_xmit(struct sk_buf ehea_dump(swqe, 512, "swqe"); if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) { - netif_stop_queue(dev); + netif_tx_stop_queue(txq); swqe->tx_control |= EHEA_SWQE_PURGE; } ehea_post_swqe(pr->qp, swqe); if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { - spin_lock_irqsave(&pr->netif_queue, flags); - if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { - pr->p_stats.queue_stopped++; - netif_stop_queue(dev); - pr->queue_stopped = 1; - } - spin_unlock_irqrestore(&pr->netif_queue, flags); + pr->p_stats.queue_stopped++; + netif_tx_stop_queue(txq); } return NETDEV_TX_OK;
@@ -2677,7 +2658,7 @@ static int ehea_open(struct net_device * ret = ehea_up(dev); if (!ret) { port_napi_enable(port); - netif_start_queue(dev); + netif_tx_start_all_queues(dev); } mutex_unlock(&port->port_lock);
@@ -2721,7 +2702,7 @@ static int ehea_stop(struct net_device * set_bit(__EHEA_DISABLE_PORT_RESET, &port->flags); cancel_work_sync(&port->reset_task); mutex_lock(&port->port_lock); - netif_stop_queue(dev); + netif_tx_stop_all_queues(dev); port_napi_disable(port); ret = ehea_down(dev); mutex_unlock(&port->port_lock);
@@ -2945,7 +2926,7 @@ static void ehea_reset_port(struct work_ mutex_lock(&dlpar_mem_lock); port->resets++; mutex_lock(&port->port_lock); - netif_stop_queue(dev); + netif_tx_disable(dev); port_napi_disable(port);
@@ -2961,7 +2942,7 @@ static void ehea_reset_port(struct work_ port_napi_enable(port); - netif_wake_queue(dev); + netif_tx_wake_all_queues(dev); out: mutex_unlock(&port->port_lock); mutex_unlock(&dlpar_mem_lock);
@@ -2988,7 +2969,7 @@ static void ehea_rereg_mrs(void) if (dev->flags & IFF_UP) { mutex_lock(&port->port_lock); - netif_stop_queue(dev); + netif_tx_disable(dev); ehea_flush_sq(port); ret = ehea_stop_qps(dev); if (ret) {
@@ -3033,7 +3014,7 @@ static void ehea_rereg_mrs(void) if (!ret) { check_sqs(port); port_napi_enable(port); - netif_wake_queue(dev); + netif_tx_wake_all_queues(dev); } else { netdev_err(dev, "Unable to restart QPS\n"); }
@@ -3210,7 +3191,7 @@ struct ehea_port *ehea_setup_single_port int jumbo; /* allocate memory for the port structures */ - dev = alloc_etherdev(sizeof(struct ehea_port)); + dev = alloc_etherdev_mq(sizeof(struct ehea_port), EHEA_MAX_PORT_RES); if (!dev) { pr_err("no mem for net_device\n");
@@ -3242,6 +3223,10 @@ struct ehea_port *ehea_setup_single_port if (ret) goto out_free_mc_list; + netif_set_real_num_rx_queues(dev, port->num_def_qps); + netif_set_real_num_tx_queues(dev, port->num_def_qps + + port->num_add_tx_qps); + port_dev = ehea_register_port(port, dn); if (!port_dev) goto out_free_mc_list;
Index: linux-net/drivers/net/ehea/ehea.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-12 07:47:48.840103988 +1000
+++ linux-net/drivers/net/ehea/ehea.h 2011-05-12 07:47:49.640116670 +1000@@ -375,8 +375,6 @@ struct ehea_port_res { struct ehea_q_skb_arr rq3_skba; struct ehea_q_skb_arr sq_skba; int sq_skba_size; - spinlock_t netif_queue; - int queue_stopped; int swqe_refill_th; atomic_t swqe_avail; int swqe_ll_count;
Index: linux-net/drivers/net/ehea/ehea_ethtool.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_ethtool.c 2011-05-12 07:47:10.869501966 +1000
+++ linux-net/drivers/net/ehea/ehea_ethtool.c 2011-05-12 07:47:49.640116670 +1000@@ -189,7 +189,6 @@ static char ehea_ethtool_stats_keys[][ET {"IP cksum errors"}, {"Frame cksum errors"}, {"num SQ stopped"}, - {"SQ stopped"}, {"PR0 free_swqes"}, {"PR1 free_swqes"}, {"PR2 free_swqes"},
@@ -198,6 +197,14 @@ static char ehea_ethtool_stats_keys[][ET {"PR5 free_swqes"}, {"PR6 free_swqes"}, {"PR7 free_swqes"}, + {"PR8 free_swqes"}, + {"PR9 free_swqes"}, + {"PR10 free_swqes"}, + {"PR11 free_swqes"}, + {"PR12 free_swqes"}, + {"PR13 free_swqes"}, + {"PR14 free_swqes"}, + {"PR15 free_swqes"}, {"LRO aggregated"}, {"LRO flushed"}, {"LRO no_desc"},
@@ -255,11 +262,7 @@ static void ehea_get_ethtool_stats(struc tmp += port->port_res[k].p_stats.queue_stopped; data[i++] = tmp; - for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) - tmp |= port->port_res[k].queue_stopped; - data[i++] = tmp; - - for (k = 0; k < 8; k++) + for (k = 0; k < 16; k++) data[i++] = atomic_read(&port->port_res[k].swqe_avail); for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:27:58
The ehea adapter has a mode where it will avoid partial cacheline DMA writes on receive by always padding packets to fall on a cacheline boundary. Unfortunately we currently aren't allocating enough space for a full ethernet MTU packet to be rounded up, so this optimisation doesn't hit. It's unfortunate that the next largest packet size exposed by the hypervisor interface is 2kB, meaning our skb allocation comes out of a 4kB SLAB. However the performance increase due to this optimisation is quite large and my TCP stream numbers increase from 900MB to 1000MB/sec. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-12 07:47:53.490177714 +1000
+++ linux-net/drivers/net/ehea/ehea.h 2011-05-12 07:47:56.980233047 +1000@@ -82,7 +82,7 @@ #define EHEA_SG_RQ3 0 #define EHEA_MAX_PACKET_SIZE 9022 /* for jumbo frames */ -#define EHEA_RQ2_PKT_SIZE 1522 +#define EHEA_RQ2_PKT_SIZE 2048 #define EHEA_L_PKT_SIZE 256 /* low latency */ #define MAX_LRO_DESCRIPTORS 8
@@ -93,7 +93,7 @@ #define EHEA_PD_ID 0xaabcdeff #define EHEA_RQ2_THRESHOLD 1 -#define EHEA_RQ3_THRESHOLD 9 /* use RQ3 threshold of 1522 bytes */ +#define EHEA_RQ3_THRESHOLD 4 /* use RQ3 threshold of 2048 bytes */ #define EHEA_SPEED_10G 10000 #define EHEA_SPEED_1G 1000
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:27:58
It seems like the ehea xmit routine and an ethtool change of TSO mode could race, resulting in corrupt packets. Checking gso_size is enough and we can use the helper function. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:53.490177714 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:54.730197374 +1000@@ -1788,7 +1788,7 @@ static inline void write_swqe2_data(stru swqe->descriptors = 0; sg1entry_contains_frag_data = 0; - if ((dev->features & NETIF_F_TSO) && skb_shinfo(skb)->gso_size) + if (skb_is_gso(skb)) write_swqe2_TSO(skb, swqe, lkey); else write_swqe2_nonTSO(skb, swqe, lkey);
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:27:58
Add GRO support to the ehea driver. Signed-off-by: Anton Blanchard <redacted> --- v2: - Removed use of vlan_gro_receive as suggested by Jesse Gross Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:03.810341336 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:05.100361788 +1000@@ -637,18 +637,6 @@ static int ehea_treat_poll_error(struct return 0; } -static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe, - struct sk_buff *skb) -{ - int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && - pr->port->vgrp); - - if (vlan_extracted) - vlan_hwaccel_receive_skb(skb, pr->port->vgrp, cqe->vlan_tag); - else - netif_receive_skb(skb); -} - static int ehea_proc_rwqes(struct net_device *dev, struct ehea_port_res *pr, int budget)
@@ -725,7 +713,12 @@ static int ehea_proc_rwqes(struct net_de } processed_bytes += skb->len; - ehea_proc_skb(pr, cqe, skb); + + if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && + pr->port->vgrp) + __vlan_hwaccel_put_tag(skb, cqe->vlan_tag); + + napi_gro_receive(&pr->napi, skb); } else { pr->p_stats.poll_receive_errors++; port_reset = ehea_treat_poll_error(pr, rq, cqe,
@@ -3041,7 +3034,7 @@ struct ehea_port *ehea_setup_single_port dev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev); - dev->hw_features = NETIF_F_SG | NETIF_F_TSO + dev->hw_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_GRO | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_LRO; dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:27:59
The tcp_end field is not actually used by the hardware, so there is no need to set it. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:05.100361788 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:06.380382084 +1000@@ -1995,7 +1995,6 @@ static void xmit_common(struct sk_buff * swqe->tcp_offset = swqe->ip_end + 1 + offsetof(struct udphdr, check); - swqe->tcp_end = skb->len - 1; break; case IPPROTO_TCP:
@@ -2004,7 +2003,6 @@ static void xmit_common(struct sk_buff * swqe->tcp_offset = swqe->ip_end + 1 + offsetof(struct tcphdr, check); - swqe->tcp_end = skb->len - 1; break; } }
Index: linux-net/drivers/net/ehea/ehea_qmr.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_qmr.h 2011-05-12 07:47:05.399415238 +1000
+++ linux-net/drivers/net/ehea/ehea_qmr.h 2011-05-12 07:48:06.380382084 +1000@@ -106,7 +106,7 @@ struct ehea_swqe { u8 immediate_data_length; u8 tcp_offset; u8 reserved2; - u16 tcp_end; + u16 reserved2b; u8 wrap_tag; u8 descriptors; /* number of valid descriptors in WQE */ u16 reserved3;
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:27:59
The num_tx_qps module option allows a user to configure a different number of tx and rx queues. Now the networking stack is multiqueue aware it makes little sense just to enable the tx queues and not the rx queues so remove the option. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-12 07:47:51.960153456 +1000
+++ linux-net/drivers/net/ehea/ehea.h 2011-05-12 07:47:53.490177714 +1000@@ -58,7 +58,6 @@ #define EHEA_MIN_ENTRIES_QP 127 #define EHEA_SMALL_QUEUES -#define EHEA_NUM_TX_QP 1 #define EHEA_LRO_MAX_AGGR 64 #ifdef EHEA_SMALL_QUEUES
@@ -460,8 +459,6 @@ struct ehea_port { char int_aff_name[EHEA_IRQ_NAME_SIZE]; int allmulti; /* Indicates IFF_ALLMULTI state */ int promisc; /* Indicates IFF_PROMISC state */ - int num_tx_qps; - int num_add_tx_qps; int num_mcs; int resets; unsigned long flags;
Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:51.960153456 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:53.490177714 +1000@@ -63,7 +63,6 @@ static int sq_entries = EHEA_DEF_ENTRIES static int use_mcs = 1; static int use_lro; static int lro_max_aggr = EHEA_LRO_MAX_AGGR; -static int num_tx_qps = EHEA_NUM_TX_QP; static int prop_carrier_state; module_param(msg_level, int, 0);
@@ -75,9 +74,7 @@ module_param(prop_carrier_state, int, 0) module_param(use_mcs, int, 0); module_param(use_lro, int, 0); module_param(lro_max_aggr, int, 0); -module_param(num_tx_qps, int, 0); -MODULE_PARM_DESC(num_tx_qps, "Number of TX-QPS"); MODULE_PARM_DESC(msg_level, "msg_level"); MODULE_PARM_DESC(prop_carrier_state, "Propagate carrier state of physical " "port to stack. 1:yes, 0:no. Default = 0 ");
@@ -172,7 +169,7 @@ static void ehea_update_firmware_handles continue; num_ports++; - num_portres += port->num_def_qps + port->num_add_tx_qps; + num_portres += port->num_def_qps; } }
@@ -198,9 +195,7 @@ static void ehea_update_firmware_handles (num_ports == 0)) continue; - for (l = 0; - l < port->num_def_qps + port->num_add_tx_qps; - l++) { + for (l = 0; l < port->num_def_qps; l++) { struct ehea_port_res *pr = &port->port_res[l]; arr[i].adh = adapter->handle;
@@ -360,7 +355,7 @@ static struct net_device_stats *ehea_get } tx_packets = 0; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { tx_packets += port->port_res[i].tx_packets; tx_bytes += port->port_res[i].tx_bytes; }
@@ -811,7 +806,7 @@ static void reset_sq_restart_flag(struct { int i; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { struct ehea_port_res *pr = &port->port_res[i]; pr->sq_restart_flag = 0; }
@@ -824,7 +819,7 @@ static void check_sqs(struct ehea_port * int swqe_index; int i, k; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { struct ehea_port_res *pr = &port->port_res[i]; int ret; k = 0;
@@ -1113,13 +1108,6 @@ int ehea_sense_port_attr(struct ehea_por goto out_free; } - port->num_tx_qps = num_tx_qps; - - if (port->num_def_qps >= port->num_tx_qps) - port->num_add_tx_qps = 0; - else - port->num_add_tx_qps = port->num_tx_qps - port->num_def_qps; - ret = 0; out_free: if (ret || netif_msg_probe(port))
@@ -1360,7 +1348,7 @@ static int ehea_reg_interrupts(struct ne port->qp_eq->attr.ist1); - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { pr = &port->port_res[i]; snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1, "%s-queue%d", dev->name, i);
@@ -1403,7 +1391,7 @@ static void ehea_free_interrupts(struct /* send */ - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { pr = &port->port_res[i]; ibmebus_free_irq(pr->eq->attr.ist1, pr); netif_info(port, intr, dev,
@@ -2472,8 +2460,7 @@ out: return ret; } -static int ehea_port_res_setup(struct ehea_port *port, int def_qps, - int add_tx_qps) +static int ehea_port_res_setup(struct ehea_port *port, int def_qps) { int ret, i; struct port_res_cfg pr_cfg, pr_cfg_small_rx;
@@ -2506,7 +2493,7 @@ static int ehea_port_res_setup(struct eh if (ret) goto out_clean_pr; } - for (i = def_qps; i < def_qps + add_tx_qps; i++) { + for (i = def_qps; i < def_qps; i++) { ret = ehea_init_port_res(port, &port->port_res[i], &pr_cfg_small_rx, i); if (ret)
@@ -2529,7 +2516,7 @@ static int ehea_clean_all_portres(struct int ret = 0; int i; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) + for (i = 0; i < port->num_def_qps; i++) ret |= ehea_clean_portres(port, &port->port_res[i]); ret |= ehea_destroy_eq(port->qp_eq);
@@ -2561,8 +2548,7 @@ static int ehea_up(struct net_device *de if (port->state == EHEA_PORT_UP) return 0; - ret = ehea_port_res_setup(port, port->num_def_qps, - port->num_add_tx_qps); + ret = ehea_port_res_setup(port, port->num_def_qps); if (ret) { netdev_err(dev, "port_res_failed\n"); goto out;
@@ -2581,7 +2567,7 @@ static int ehea_up(struct net_device *de goto out_clean_pr; } - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { ret = ehea_activate_qp(port->adapter, port->port_res[i].qp); if (ret) { netdev_err(dev, "activate_qp failed\n");
@@ -2627,7 +2613,7 @@ static void port_napi_disable(struct ehe { int i; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) + for (i = 0; i < port->num_def_qps; i++) napi_disable(&port->port_res[i].napi); }
@@ -2635,7 +2621,7 @@ static void port_napi_enable(struct ehea { int i; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) + for (i = 0; i < port->num_def_qps; i++) napi_enable(&port->port_res[i].napi); }
@@ -2721,7 +2707,7 @@ static void ehea_flush_sq(struct ehea_po { int i; - for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { + for (i = 0; i < port->num_def_qps; i++) { struct ehea_port_res *pr = &port->port_res[i]; int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count; int ret;
@@ -2755,7 +2741,7 @@ int ehea_stop_qps(struct net_device *dev goto out; } - for (i = 0; i < (port->num_def_qps + port->num_add_tx_qps); i++) { + for (i = 0; i < (port->num_def_qps); i++) { struct ehea_port_res *pr = &port->port_res[i]; struct ehea_qp *qp = pr->qp;
@@ -2857,7 +2843,7 @@ int ehea_restart_qps(struct net_device * goto out; } - for (i = 0; i < (port->num_def_qps + port->num_add_tx_qps); i++) { + for (i = 0; i < (port->num_def_qps); i++) { struct ehea_port_res *pr = &port->port_res[i]; struct ehea_qp *qp = pr->qp;
@@ -3217,8 +3203,7 @@ struct ehea_port *ehea_setup_single_port goto out_free_mc_list; netif_set_real_num_rx_queues(dev, port->num_def_qps); - netif_set_real_num_tx_queues(dev, port->num_def_qps + - port->num_add_tx_qps); + netif_set_real_num_tx_queues(dev, port->num_def_qps); port_dev = ehea_register_port(port, dn); if (!port_dev)
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:28:00
commit 18604c548545 (ehea: NAPI multi queue TX/RX path for SMP) added driver specific logic for exiting napi mode. I'm not sure what it was trying to solve and it should be up to the network stack to decide when we are done polling so remove it. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:49.640116670 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:51.960153456 +1000@@ -927,7 +927,6 @@ static struct ehea_cqe *ehea_proc_cqes(s return cqe; } -#define EHEA_NAPI_POLL_NUM_BEFORE_IRQ 16 #define EHEA_POLL_MAX_CQES 65535 static int ehea_poll(struct napi_struct *napi, int budget)
@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_struct struct net_device *dev = pr->port->netdev; struct ehea_cqe *cqe; struct ehea_cqe *cqe_skb = NULL; - int force_irq, wqe_index; + int wqe_index; int rx = 0; - force_irq = (pr->poll_counter > EHEA_NAPI_POLL_NUM_BEFORE_IRQ); cqe_skb = ehea_proc_cqes(pr, EHEA_POLL_MAX_CQES); + rx += ehea_proc_rwqes(dev, pr, budget - rx); - if (!force_irq) - rx += ehea_proc_rwqes(dev, pr, budget - rx); - - while ((rx != budget) || force_irq) { - pr->poll_counter = 0; - force_irq = 0; + while ((rx != budget)) { napi_complete(napi); ehea_reset_cq_ep(pr->recv_cq); ehea_reset_cq_ep(pr->send_cq);
@@ -968,7 +962,6 @@ static int ehea_poll(struct napi_struct rx += ehea_proc_rwqes(dev, pr, budget - rx); } - pr->poll_counter++; return rx; }
Index: linux-net/drivers/net/ehea/ehea.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-12 07:47:49.640116670 +1000
+++ linux-net/drivers/net/ehea/ehea.h 2011-05-12 07:47:51.960153456 +1000@@ -383,7 +383,6 @@ struct ehea_port_res { u64 tx_bytes; u64 rx_packets; u64 rx_bytes; - u32 poll_counter; struct net_lro_mgr lro_mgr; struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; int sq_restart_flag;
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:28:00
In preparation for adding GRO to ehea, remove LRO. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:02.700323737 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:03.810341336 +1000@@ -61,8 +61,6 @@ static int rq2_entries = EHEA_DEF_ENTRIE static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; static int sq_entries = EHEA_DEF_ENTRIES_SQ; static int use_mcs = 1; -static int use_lro; -static int lro_max_aggr = EHEA_LRO_MAX_AGGR; static int prop_carrier_state; module_param(msg_level, int, 0);
@@ -72,8 +70,6 @@ module_param(rq3_entries, int, 0); module_param(sq_entries, int, 0); module_param(prop_carrier_state, int, 0); module_param(use_mcs, int, 0); -module_param(use_lro, int, 0); -module_param(lro_max_aggr, int, 0); MODULE_PARM_DESC(msg_level, "msg_level"); MODULE_PARM_DESC(prop_carrier_state, "Propagate carrier state of physical "
@@ -92,11 +88,6 @@ MODULE_PARM_DESC(sq_entries, " Number of __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 "); -MODULE_PARM_DESC(lro_max_aggr, " LRO: Max packets to be aggregated. Default = " - __MODULE_STRING(EHEA_LRO_MAX_AGGR)); -MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, " - "Default = 0"); - static int port_name_cnt; static LIST_HEAD(adapter_list); static unsigned long ehea_driver_flags;
@@ -646,58 +637,16 @@ static int ehea_treat_poll_error(struct return 0; } -static int get_skb_hdr(struct sk_buff *skb, void **iphdr, - void **tcph, u64 *hdr_flags, void *priv) -{ - struct ehea_cqe *cqe = priv; - unsigned int ip_len; - struct iphdr *iph; - - /* non tcp/udp packets */ - if (!cqe->header_length) - return -1; - - /* non tcp packet */ - skb_reset_network_header(skb); - iph = ip_hdr(skb); - if (iph->protocol != IPPROTO_TCP) - return -1; - - ip_len = ip_hdrlen(skb); - skb_set_transport_header(skb, ip_len); - *tcph = tcp_hdr(skb); - - /* check if ip header and tcp header are complete */ - if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb)) - return -1; - - *hdr_flags = LRO_IPV4 | LRO_TCP; - *iphdr = iph; - - return 0; -} - static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe, struct sk_buff *skb) { int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && pr->port->vgrp); - if (skb->dev->features & NETIF_F_LRO) { - if (vlan_extracted) - lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, - pr->port->vgrp, - cqe->vlan_tag, - cqe); - else - lro_receive_skb(&pr->lro_mgr, skb, cqe); - } else { - if (vlan_extracted) - vlan_hwaccel_receive_skb(skb, pr->port->vgrp, - cqe->vlan_tag); - else - netif_receive_skb(skb); - } + if (vlan_extracted) + vlan_hwaccel_receive_skb(skb, pr->port->vgrp, cqe->vlan_tag); + else + netif_receive_skb(skb); } static int ehea_proc_rwqes(struct net_device *dev,
@@ -787,8 +736,6 @@ static int ehea_proc_rwqes(struct net_de } cqe = ehea_poll_rq1(qp, &wqe_index); } - if (dev->features & NETIF_F_LRO) - lro_flush_all(&pr->lro_mgr); pr->rx_packets += processed; pr->rx_bytes += processed_bytes;
@@ -1612,15 +1559,6 @@ static int ehea_init_port_res(struct ehe netif_napi_add(pr->port->netdev, &pr->napi, ehea_poll, 64); - pr->lro_mgr.max_aggr = pr->port->lro_max_aggr; - pr->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS; - pr->lro_mgr.lro_arr = pr->lro_desc; - pr->lro_mgr.get_skb_header = get_skb_hdr; - pr->lro_mgr.features = LRO_F_NAPI | LRO_F_EXTRACT_VLAN_ID; - pr->lro_mgr.dev = port->netdev; - pr->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY; - pr->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY; - ret = 0; goto out;
@@ -3113,9 +3051,6 @@ struct ehea_port *ehea_setup_single_port NETIF_F_IP_CSUM; dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; - if (use_lro) - dev->features |= NETIF_F_LRO; - INIT_WORK(&port->reset_task, ehea_reset_port); init_waitqueue_head(&port->swqe_avail_wq);
@@ -3127,8 +3062,6 @@ struct ehea_port *ehea_setup_single_port goto out_unreg_port; } - port->lro_max_aggr = lro_max_aggr; - ret = ehea_get_jumboframe_status(port, &jumbo); if (ret) netdev_err(dev, "failed determining jumbo frame status\n");
Index: linux-net/drivers/net/ehea/ehea.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-12 07:47:56.980233047 +1000
+++ linux-net/drivers/net/ehea/ehea.h 2011-05-12 07:48:03.810341336 +1000@@ -33,7 +33,6 @@ #include <linux/ethtool.h> #include <linux/vmalloc.h> #include <linux/if_vlan.h> -#include <linux/inet_lro.h> #include <asm/ibmebus.h> #include <asm/abs_addr.h>
@@ -58,7 +57,6 @@ #define EHEA_MIN_ENTRIES_QP 127 #define EHEA_SMALL_QUEUES -#define EHEA_LRO_MAX_AGGR 64 #ifdef EHEA_SMALL_QUEUES #define EHEA_MAX_CQE_COUNT 1023
@@ -85,8 +83,6 @@ #define EHEA_RQ2_PKT_SIZE 2048 #define EHEA_L_PKT_SIZE 256 /* low latency */ -#define MAX_LRO_DESCRIPTORS 8 - /* Send completion signaling */ /* Protection Domain Identifier */
@@ -382,8 +378,6 @@ struct ehea_port_res { u64 tx_bytes; u64 rx_packets; u64 rx_bytes; - struct net_lro_mgr lro_mgr; - struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; int sq_restart_flag; };
@@ -468,7 +462,6 @@ struct ehea_port { u32 msg_enable; u32 sig_comp_iv; u32 state; - u32 lro_max_aggr; u8 phy_link; u8 full_duplex; u8 autoneg;
Index: linux-net/drivers/net/ehea/ehea_ethtool.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_ethtool.c 2011-05-12 07:47:49.640116670 +1000
+++ linux-net/drivers/net/ehea/ehea_ethtool.c 2011-05-12 07:48:03.810341336 +1000@@ -205,9 +205,6 @@ static char ehea_ethtool_stats_keys[][ET {"PR13 free_swqes"}, {"PR14 free_swqes"}, {"PR15 free_swqes"}, - {"LRO aggregated"}, - {"LRO flushed"}, - {"LRO no_desc"}, }; static void ehea_get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -264,19 +261,6 @@ static void ehea_get_ethtool_stats(struc for (k = 0; k < 16; k++) data[i++] = atomic_read(&port->port_res[k].swqe_avail); - - for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) - tmp |= port->port_res[k].lro_mgr.stats.aggregated; - data[i++] = tmp; - - for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) - tmp |= port->port_res[k].lro_mgr.stats.flushed; - data[i++] = tmp; - - for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) - tmp |= port->port_res[k].lro_mgr.stats.no_desc; - data[i++] = tmp; - } const struct ethtool_ops ehea_ethtool_ops = {
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:28:00
Based on a patch from Michael Ellerman, clean up a significant portion of the transmit path. There was a lot of duplication here. Even worse, we were always checksumming tx packets and ignoring the skb->ip_summed field. Also remove NETIF_F_FRAGLIST from dev->features, I'm not sure why it was enabled. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:55.870215448 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:58.020249537 +1000@@ -1677,37 +1677,6 @@ static int ehea_clean_portres(struct ehe return ret; } -/* - * The write_* functions store information in swqe which is used by - * the hardware to calculate the ip/tcp/udp checksum - */ - -static inline void write_ip_start_end(struct ehea_swqe *swqe, - const struct sk_buff *skb) -{ - swqe->ip_start = skb_network_offset(skb); - swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1); -} - -static inline void write_tcp_offset_end(struct ehea_swqe *swqe, - const struct sk_buff *skb) -{ - swqe->tcp_offset = - (u8)(swqe->ip_end + 1 + offsetof(struct tcphdr, check)); - - swqe->tcp_end = (u16)skb->len - 1; -} - -static inline void write_udp_offset_end(struct ehea_swqe *swqe, - const struct sk_buff *skb) -{ - swqe->tcp_offset = - (u8)(swqe->ip_end + 1 + offsetof(struct udphdr, check)); - - swqe->tcp_end = (u16)skb->len - 1; -} - - static void write_swqe2_TSO(struct sk_buff *skb, struct ehea_swqe *swqe, u32 lkey) {
@@ -2109,41 +2078,46 @@ static int ehea_change_mtu(struct net_de return 0; } -static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, - struct ehea_swqe *swqe, u32 lkey) +static void xmit_common(struct sk_buff *skb, struct ehea_swqe *swqe) { - if (skb->protocol == htons(ETH_P_IP)) { - const struct iphdr *iph = ip_hdr(skb); + swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC; - /* IPv4 */ - swqe->tx_control |= EHEA_SWQE_CRC - | EHEA_SWQE_IP_CHECKSUM - | EHEA_SWQE_TCP_CHECKSUM - | EHEA_SWQE_IMM_DATA_PRESENT - | EHEA_SWQE_DESCRIPTORS_PRESENT; - - write_ip_start_end(swqe, skb); - - if (iph->protocol == IPPROTO_UDP) { - if ((iph->frag_off & IP_MF) || - (iph->frag_off & IP_OFFSET)) - /* IP fragment, so don't change cs */ - swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; - else - write_udp_offset_end(swqe, skb); - } else if (iph->protocol == IPPROTO_TCP) { - write_tcp_offset_end(swqe, skb); - } + if (skb->protocol != htons(ETH_P_IP)) + return; - /* icmp (big data) and ip segmentation packets (all other ip - packets) do not require any special handling */ + if (skb->ip_summed == CHECKSUM_PARTIAL) + swqe->tx_control |= EHEA_SWQE_IP_CHECKSUM; - } else { - /* Other Ethernet Protocol */ - swqe->tx_control |= EHEA_SWQE_CRC - | EHEA_SWQE_IMM_DATA_PRESENT - | EHEA_SWQE_DESCRIPTORS_PRESENT; + swqe->ip_start = skb_network_offset(skb); + swqe->ip_end = swqe->ip_start + ip_hdrlen(skb) - 1; + + switch (ip_hdr(skb)->protocol) { + case IPPROTO_UDP: + if (skb->ip_summed == CHECKSUM_PARTIAL) + swqe->tx_control |= EHEA_SWQE_TCP_CHECKSUM; + + swqe->tcp_offset = swqe->ip_end + 1 + + offsetof(struct udphdr, check); + swqe->tcp_end = skb->len - 1; + break; + + case IPPROTO_TCP: + if (skb->ip_summed == CHECKSUM_PARTIAL) + swqe->tx_control |= EHEA_SWQE_TCP_CHECKSUM; + + swqe->tcp_offset = swqe->ip_end + 1 + + offsetof(struct tcphdr, check); + swqe->tcp_end = skb->len - 1; + break; } +} + +static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, + struct ehea_swqe *swqe, u32 lkey) +{ + swqe->tx_control |= EHEA_SWQE_DESCRIPTORS_PRESENT; + + xmit_common(skb, swqe); write_swqe2_data(skb, dev, swqe, lkey); }
@@ -2156,51 +2130,11 @@ static void ehea_xmit3(struct sk_buff *s skb_frag_t *frag; int i; - if (skb->protocol == htons(ETH_P_IP)) { - const struct iphdr *iph = ip_hdr(skb); - - /* IPv4 */ - write_ip_start_end(swqe, skb); + xmit_common(skb, swqe); - if (iph->protocol == IPPROTO_TCP) { - swqe->tx_control |= EHEA_SWQE_CRC - | EHEA_SWQE_IP_CHECKSUM - | EHEA_SWQE_TCP_CHECKSUM - | EHEA_SWQE_IMM_DATA_PRESENT; - - write_tcp_offset_end(swqe, skb); - - } else if (iph->protocol == IPPROTO_UDP) { - if ((iph->frag_off & IP_MF) || - (iph->frag_off & IP_OFFSET)) - /* IP fragment, so don't change cs */ - swqe->tx_control |= EHEA_SWQE_CRC - | EHEA_SWQE_IMM_DATA_PRESENT; - else { - swqe->tx_control |= EHEA_SWQE_CRC - | EHEA_SWQE_IP_CHECKSUM - | EHEA_SWQE_TCP_CHECKSUM - | EHEA_SWQE_IMM_DATA_PRESENT; - - write_udp_offset_end(swqe, skb); - } - } else { - /* icmp (big data) and - ip segmentation packets (all other ip packets) */ - swqe->tx_control |= EHEA_SWQE_CRC - | EHEA_SWQE_IP_CHECKSUM - | EHEA_SWQE_IMM_DATA_PRESENT; - } - } else { - /* Other Ethernet Protocol */ - swqe->tx_control |= EHEA_SWQE_CRC | EHEA_SWQE_IMM_DATA_PRESENT; - } - /* copy (immediate) data */ if (nfrags == 0) { - /* data is in a single piece */ skb_copy_from_linear_data(skb, imm_data, skb->len); } else { - /* first copy data from the skb->data buffer ... */ skb_copy_from_linear_data(skb, imm_data, skb_headlen(skb)); imm_data += skb_headlen(skb);
@@ -2214,6 +2148,7 @@ static void ehea_xmit3(struct sk_buff *s imm_data += frag->size; } } + swqe->immediate_data_length = skb->len; dev_kfree_skb(skb); }
@@ -3217,7 +3152,7 @@ struct ehea_port *ehea_setup_single_port dev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev); - dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO + dev->hw_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_LRO; dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:28:00
If a nonlinear skb fits within the immediate area, use skb_copy_bits instead of copying the frags by hand. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:59.140267294 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:00.220284417 +1000@@ -2091,29 +2091,14 @@ static void ehea_xmit2(struct sk_buff *s static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, struct ehea_swqe *swqe) { - int nfrags = skb_shinfo(skb)->nr_frags; u8 *imm_data = &swqe->u.immdata_nodesc.immediate_data[0]; - skb_frag_t *frag; - int i; xmit_common(skb, swqe); - if (nfrags == 0) { + if (!skb->data_len) skb_copy_from_linear_data(skb, imm_data, skb->len); - } else { - skb_copy_from_linear_data(skb, imm_data, - skb_headlen(skb)); - imm_data += skb_headlen(skb); - - /* ... then copy data from the fragments */ - for (i = 0; i < nfrags; i++) { - frag = &skb_shinfo(skb)->frags[i]; - memcpy(imm_data, - page_address(frag->page) + frag->page_offset, - frag->size); - imm_data += frag->size; - } - } + else + skb_copy_bits(skb, 0, imm_data, skb->len); swqe->immediate_data_length = skb->len; dev_kfree_skb(skb);
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:28:00
Remove the deprecated NETIF_F_LLTX feature. Since the network stack now provides the locking we can remove the driver specific pr->xmit_lock. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-11 14:39:08.443817605 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-11 14:39:10.113846069 +1000@@ -1536,7 +1536,6 @@ static int ehea_init_port_res(struct ehe pr->rx_packets = rx_packets; pr->port = port; - spin_lock_init(&pr->xmit_lock); spin_lock_init(&pr->netif_queue); pr->eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0);
@@ -2261,14 +2260,9 @@ static int ehea_start_xmit(struct sk_buf pr = &port->port_res[ehea_hash_skb(skb, port->num_tx_qps)]; - if (!spin_trylock(&pr->xmit_lock)) + if (pr->queue_stopped) return NETDEV_TX_BUSY; - if (pr->queue_stopped) { - spin_unlock(&pr->xmit_lock); - return NETDEV_TX_BUSY; - } - swqe = ehea_get_swqe(pr->qp, &swqe_index); memset(swqe, 0, SWQE_HEADER_SIZE); atomic_dec(&pr->swqe_avail);
@@ -2332,8 +2326,6 @@ static int ehea_start_xmit(struct sk_buf } spin_unlock_irqrestore(&pr->netif_queue, flags); } - dev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */ - spin_unlock(&pr->xmit_lock); return NETDEV_TX_OK; }
@@ -3267,7 +3259,7 @@ struct ehea_port *ehea_setup_single_port dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER - | NETIF_F_LLTX | NETIF_F_RXCSUM; + | NETIF_F_RXCSUM; dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; if (use_lro)
Index: linux-net/drivers/net/ehea/ehea.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-11 14:39:08.433817435 +1000
+++ linux-net/drivers/net/ehea/ehea.h 2011-05-11 14:39:10.113846069 +1000@@ -363,7 +363,6 @@ struct ehea_port_res { struct port_stats p_stats; struct ehea_mr send_mr; /* send memory region */ struct ehea_mr recv_mr; /* receive memory region */ - spinlock_t xmit_lock; struct ehea_port *port; char int_recv_name[EHEA_IRQ_NAME_SIZE]; char int_send_name[EHEA_IRQ_NAME_SIZE];
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:28:00
Switch to using ndo_get_stats64 to get 64bit statistics. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:00.220284417 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:02.700323737 +1000@@ -321,10 +321,10 @@ out: spin_unlock_irqrestore(&ehea_bcmc_regs.lock, flags); } -static struct net_device_stats *ehea_get_stats(struct net_device *dev) +static struct rtnl_link_stats64 *ehea_get_stats64(struct net_device *dev, + struct rtnl_link_stats64 *stats) { struct ehea_port *port = netdev_priv(dev); - struct net_device_stats *stats = &port->stats; struct hcp_ehea_port_cb2 *cb2; u64 hret, rx_packets, tx_packets, rx_bytes = 0, tx_bytes = 0; int i;
@@ -3034,7 +3034,7 @@ static const struct net_device_ops ehea_ #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = ehea_netpoll, #endif - .ndo_get_stats = ehea_get_stats, + .ndo_get_stats64 = ehea_get_stats64, .ndo_set_mac_address = ehea_set_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_set_multicast_list = ehea_set_multicast_list,
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:42:58
write_swqe2_TSO and write_swqe2_nonTSO are almost identical. For TSO we have to set the TSO and mss bits in the wqe and we only put the header in the immediate area, no data. Collapse both functions into write_swqe2_immediate. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:58.020249537 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:59.140267294 +1000@@ -1677,65 +1677,35 @@ static int ehea_clean_portres(struct ehe return ret; } -static void write_swqe2_TSO(struct sk_buff *skb, - struct ehea_swqe *swqe, u32 lkey) -{ - struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry; - u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; - int skb_data_size = skb_headlen(skb); - int headersize; - - /* Packet is TCP with TSO enabled */ - swqe->tx_control |= EHEA_SWQE_TSO; - swqe->mss = skb_shinfo(skb)->gso_size; - /* copy only eth/ip/tcp headers to immediate data and - * the rest of skb->data to sg1entry - */ - headersize = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb); - - skb_data_size = skb_headlen(skb); - - if (skb_data_size >= headersize) { - /* copy immediate data */ - skb_copy_from_linear_data(skb, imm_data, headersize); - swqe->immediate_data_length = headersize; - - if (skb_data_size > headersize) { - /* set sg1entry data */ - sg1entry->l_key = lkey; - sg1entry->len = skb_data_size - headersize; - sg1entry->vaddr = - ehea_map_vaddr(skb->data + headersize); - swqe->descriptors++; - } - } else - pr_err("cannot handle fragmented headers\n"); -} - -static void write_swqe2_nonTSO(struct sk_buff *skb, - struct ehea_swqe *swqe, u32 lkey) +static void write_swqe2_immediate(struct sk_buff *skb, struct ehea_swqe *swqe, + u32 lkey) { int skb_data_size = skb_headlen(skb); u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry; + unsigned int immediate_len = SWQE2_MAX_IMM; - /* Packet is any nonTSO type - * - * Copy as much as possible skb->data to immediate data and - * the rest to sg1entry - */ - if (skb_data_size >= SWQE2_MAX_IMM) { - /* copy immediate data */ - skb_copy_from_linear_data(skb, imm_data, SWQE2_MAX_IMM); + swqe->descriptors = 0; + + if (skb_is_gso(skb)) { + swqe->tx_control |= EHEA_SWQE_TSO; + swqe->mss = skb_shinfo(skb)->gso_size; + /* + * For TSO packets we only copy the headers into the + * immediate area. + */ + immediate_len = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb); + } - swqe->immediate_data_length = SWQE2_MAX_IMM; + if (skb_is_gso(skb) || skb_data_size >= SWQE2_MAX_IMM) { + skb_copy_from_linear_data(skb, imm_data, immediate_len); + swqe->immediate_data_length = immediate_len; - if (skb_data_size > SWQE2_MAX_IMM) { - /* copy sg1entry data */ + if (skb_data_size > immediate_len) { sg1entry->l_key = lkey; - sg1entry->len = skb_data_size - SWQE2_MAX_IMM; + sg1entry->len = skb_data_size - immediate_len; sg1entry->vaddr = - ehea_map_vaddr(skb->data + SWQE2_MAX_IMM); + ehea_map_vaddr(skb->data + immediate_len); swqe->descriptors++; } } else {
@@ -1754,13 +1724,9 @@ static inline void write_swqe2_data(stru nfrags = skb_shinfo(skb)->nr_frags; sg1entry = &swqe->u.immdata_desc.sg_entry; sg_list = (struct ehea_vsgentry *)&swqe->u.immdata_desc.sg_list; - swqe->descriptors = 0; sg1entry_contains_frag_data = 0; - if (skb_is_gso(skb)) - write_swqe2_TSO(skb, swqe, lkey); - else - write_swqe2_nonTSO(skb, swqe, lkey); + write_swqe2_immediate(skb, swqe, lkey); /* write descriptors */ if (nfrags > 0) {
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:42:58
We weren't enabling any VLAN features so we missed out on checksum offload and TSO when using VLANs. Enable them. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:54.730197374 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:55.870215448 +1000@@ -3223,6 +3223,8 @@ struct ehea_port *ehea_setup_single_port | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER | NETIF_F_RXCSUM; + dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | + NETIF_F_IP_CSUM; dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; if (use_lro)
From: Anton Blanchard <hidden>
Date: 2011-05-12 01:42:58
The queue macros are many levels deep and it makes it harder to work your way through them when many of the versions are unused. Remove the unused versions. Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_hw.h ===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_hw.h 2011-05-12 07:47:05.769421104 +1000
+++ linux-net/drivers/net/ehea/ehea_hw.h 2011-05-12 07:48:01.630306772 +1000@@ -210,36 +210,11 @@ static inline void epa_store_acc(struct __raw_writeq(value, (void __iomem *)(epa.addr + offset)); } -#define epa_store_eq(epa, offset, value)\ - epa_store(epa, EQTEMM_OFFSET(offset), value) -#define epa_load_eq(epa, offset)\ - epa_load(epa, EQTEMM_OFFSET(offset)) - #define epa_store_cq(epa, offset, value)\ epa_store(epa, CQTEMM_OFFSET(offset), value) #define epa_load_cq(epa, offset)\ epa_load(epa, CQTEMM_OFFSET(offset)) -#define epa_store_qp(epa, offset, value)\ - epa_store(epa, QPTEMM_OFFSET(offset), value) -#define epa_load_qp(epa, offset)\ - epa_load(epa, QPTEMM_OFFSET(offset)) - -#define epa_store_qped(epa, offset, value)\ - epa_store(epa, QPEDMM_OFFSET(offset), value) -#define epa_load_qped(epa, offset)\ - epa_load(epa, QPEDMM_OFFSET(offset)) - -#define epa_store_mrmw(epa, offset, value)\ - epa_store(epa, MRMWMM_OFFSET(offset), value) -#define epa_load_mrmw(epa, offset)\ - epa_load(epa, MRMWMM_OFFSET(offset)) - -#define epa_store_base(epa, offset, value)\ - epa_store(epa, HCAGR_OFFSET(offset), value) -#define epa_load_base(epa, offset)\ - epa_load(epa, HCAGR_OFFSET(offset)) - static inline void ehea_update_sqa(struct ehea_qp *qp, u16 nr_wqes) { struct h_epa epa = qp->epas.kernel;
From: Joe Perches <joe@perches.com>
Date: 2011-05-12 02:31:05
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
The ehea driver had some multiqueue support but was missing the last few years of networking stack improvements:
Hi Anton, all comments to follow on all patches are trivia only... []
Signed-off-by: Anton Blanchard <redacted>
[]
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:49.640116670 +1000
[]
@@ -93,7 +93,7 @@ MODULE_PARM_DESC(rq1_entries, "Number of MODULE_PARM_DESC(sq_entries, " Number of entries for the Send Queue " "[2^x - 1], x = [6..14]. Default = " __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); -MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 0 "); +MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 ");
trailing space
+++ linux-net/drivers/net/ehea/ehea_ethtool.c 2011-05-12 07:47:49.640116670 +1000@@ -189,7 +189,6 @@ static char ehea_ethtool_stats_keys[][ET
static const?
From: Joe Perches <joe@perches.com>
Date: 2011-05-12 02:31:11
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
commit 18604c548545 (ehea: NAPI multi queue TX/RX path for SMP) added driver specific logic for exiting napi mode. I'm not sure what it was trying to solve and it should be up to the network stack to decide when we are done polling so remove it. Signed-off-by: Anton Blanchard <redacted>
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:51.960153456 +1000@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_struct
[]
+ while ((rx != budget)) {one level of parentheses is enough.
From: Joe Perches <joe@perches.com>
Date: 2011-05-12 02:31:14
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
plain text document attachment (ehea_22.patch) The tcp_end field is not actually used by the hardware, so there is no need to set it.+++ linux-net/drivers/net/ehea/ehea_qmr.h 2011-05-12 07:48:06.380382084 +1000@@ -106,7 +106,7 @@ struct ehea_swqe { u8 immediate_data_length; u8 tcp_offset; u8 reserved2; - u16 tcp_end; + u16 reserved2b; u8 wrap_tag; u8 descriptors; /* number of valid descriptors in WQE */ u16 reserved3;
struct ehea_swqe isn't __packed. Shouldn't it be?
From: Ben Hutchings <hidden>
Date: 2011-05-12 02:47:41
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
commit 18604c548545 (ehea: NAPI multi queue TX/RX path for SMP) added driver specific logic for exiting napi mode. I'm not sure what it was trying to solve and it should be up to the network stack to decide when we are done polling so remove it.
[...] I don't know. But I'd really like to know why you are calling napi_reschedule() and napi_complete() in a loop, inside the poll function. Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
From: Ben Hutchings <hidden>
Date: 2011-05-12 02:52:52
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
plain text document attachment (ehea_8.patch) The ehea adapter has a mode where it will avoid partial cacheline DMA writes on receive by always padding packets to fall on a cacheline boundary. Unfortunately we currently aren't allocating enough space for a full ethernet MTU packet to be rounded up, so this optimisation doesn't hit. It's unfortunate that the next largest packet size exposed by the hypervisor interface is 2kB, meaning our skb allocation comes out of a 4kB SLAB. However the performance increase due to this optimisation is quite large and my TCP stream numbers increase from 900MB to 1000MB/sec.
You can allocate page buffers and then split them into exactly 2K segments. If you switch from inet_lro to GRO then GRO will handle the eventual skb allocation for you (even for non-mergeable packets). Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
From: Ben Hutchings <hidden>
Date: 2011-05-12 02:57:08
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
The ehea driver had some multiqueue support but was missing the last few years of networking stack improvements:
[...]
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:48.840103988 +1000 +++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:49.640116670 +1000@@ -60,7 +60,7 @@ static int rq1_entries = EHEA_DEF_ENTRIE static int rq2_entries = EHEA_DEF_ENTRIES_RQ2; static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; static int sq_entries = EHEA_DEF_ENTRIES_SQ; -static int use_mcs; +static int use_mcs = 1; static int use_lro; static int lro_max_aggr = EHEA_LRO_MAX_AGGR; static int num_tx_qps = EHEA_NUM_TX_QP;@@ -93,7 +93,7 @@ MODULE_PARM_DESC(rq1_entries, "Number of MODULE_PARM_DESC(sq_entries, " Number of entries for the Send Queue " "[2^x - 1], x = [6..14]. Default = " __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); -MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 0 "); +MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 ");
[...] You're using NAPI whether or not there are multiple receive queues, so this description is wrong. Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
From: David Miller <davem@davemloft.net>
Date: 2011-05-12 03:09:22
From: Joe Perches <joe@perches.com> Date: Wed, 11 May 2011 19:31:13 -0700
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:quoted
plain text document attachment (ehea_22.patch) The tcp_end field is not actually used by the hardware, so there is no need to set it.+++ linux-net/drivers/net/ehea/ehea_qmr.h 2011-05-12 07:48:06.380382084 +1000@@ -106,7 +106,7 @@ struct ehea_swqe { u8 immediate_data_length; u8 tcp_offset; u8 reserved2; - u16 tcp_end; + u16 reserved2b; u8 wrap_tag; u8 descriptors; /* number of valid descriptors in WQE */ u16 reserved3;struct ehea_swqe isn't __packed. Shouldn't it be?
Please don't mark it __packed unless absolutely necessary :-)
From: David Miller <davem@davemloft.net>
Date: 2011-05-12 03:09:23
From: Joe Perches <joe@perches.com> Date: Wed, 11 May 2011 19:31:10 -0700
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:quoted
commit 18604c548545 (ehea: NAPI multi queue TX/RX path for SMP) added driver specific logic for exiting napi mode. I'm not sure what it was trying to solve and it should be up to the network stack to decide when we are done polling so remove it. Signed-off-by: Anton Blanchard <redacted>quoted
+++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:51.960153456 +1000@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_struct[]quoted
+ while ((rx != budget)) {one level of parentheses is enough.
Agreed.
From: Joe Perches <joe@perches.com>
Date: 2011-05-12 03:12:10
On Wed, 2011-05-11 at 23:06 -0400, David Miller wrote:
From: Joe Perches <joe@perches.com> Date: Wed, 11 May 2011 19:31:13 -0700quoted
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:quoted
plain text document attachment (ehea_22.patch) The tcp_end field is not actually used by the hardware, so there is no need to set it.+++ linux-net/drivers/net/ehea/ehea_qmr.h 2011-05-12 07:48:06.380382084 +1000@@ -106,7 +106,7 @@ struct ehea_swqe { u8 immediate_data_length; u8 tcp_offset; u8 reserved2; - u16 tcp_end; + u16 reserved2b; u8 wrap_tag; u8 descriptors; /* number of valid descriptors in WQE */ u16 reserved3;struct ehea_swqe isn't __packed. Shouldn't it be?Please don't mark it __packed unless absolutely necessary :-)
Isn't it read from hardware. If not, why reserve anything?
From: Michał Mirosław <hidden>
Date: 2011-05-12 06:04:06
2011/5/12 Anton Blanchard [off-list ref]:
Add GRO support to the ehea driver.
[...]
--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:03.810341336 +1000 +++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:48:05.100361788 +1000
[...]
@@ -3041,7 +3034,7 @@ struct ehea_port *ehea_setup_single_portdev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev); - dev->hw_features = NETIF_F_SG | NETIF_F_TSO + dev->hw_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_GRO | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_LRO; dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
GRO is now enabled by default, so no need to put it in hw_features or features. Best Regards, Michał Mirosław
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2011-05-24 03:37:15
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:
plain text document attachment (ehea_3.patch) commit 18604c548545 (ehea: NAPI multi queue TX/RX path for SMP) added driver specific logic for exiting napi mode. I'm not sure what it was trying to solve and it should be up to the network stack to decide when we are done polling so remove it.
I -think- the force_irq trick was meant to allow migration of the workload if the interrupt moved. IE. Without it, continuous traffic would cause NAPI to always happen on the same CPU, regardless of the affinity of the corresponding queue IRQ. I suspect all of that is obsoleted by the newer generic infrastructure. Cheers, Ben.
Signed-off-by: Anton Blanchard <redacted> --- Index: linux-net/drivers/net/ehea/ehea_main.c ===================================================================--- linux-net.orig/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:49.640116670 +1000 +++ linux-net/drivers/net/ehea/ehea_main.c 2011-05-12 07:47:51.960153456 +1000@@ -927,7 +927,6 @@ static struct ehea_cqe *ehea_proc_cqes(s return cqe; } -#define EHEA_NAPI_POLL_NUM_BEFORE_IRQ 16 #define EHEA_POLL_MAX_CQES 65535 static int ehea_poll(struct napi_struct *napi, int budget)@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_struct struct net_device *dev = pr->port->netdev; struct ehea_cqe *cqe; struct ehea_cqe *cqe_skb = NULL; - int force_irq, wqe_index; + int wqe_index; int rx = 0; - force_irq = (pr->poll_counter > EHEA_NAPI_POLL_NUM_BEFORE_IRQ); cqe_skb = ehea_proc_cqes(pr, EHEA_POLL_MAX_CQES); + rx += ehea_proc_rwqes(dev, pr, budget - rx); - if (!force_irq) - rx += ehea_proc_rwqes(dev, pr, budget - rx); - - while ((rx != budget) || force_irq) { - pr->poll_counter = 0; - force_irq = 0; + while ((rx != budget)) { napi_complete(napi); ehea_reset_cq_ep(pr->recv_cq); ehea_reset_cq_ep(pr->send_cq);@@ -968,7 +962,6 @@ static int ehea_poll(struct napi_struct rx += ehea_proc_rwqes(dev, pr, budget - rx); } - pr->poll_counter++; return rx; }Index: linux-net/drivers/net/ehea/ehea.h ===================================================================--- linux-net.orig/drivers/net/ehea/ehea.h 2011-05-12 07:47:49.640116670 +1000 +++ linux-net/drivers/net/ehea/ehea.h 2011-05-12 07:47:51.960153456 +1000@@ -383,7 +383,6 @@ struct ehea_port_res { u64 tx_bytes; u64 rx_packets; u64 rx_bytes; - u32 poll_counter; struct net_lro_mgr lro_mgr; struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; int sq_restart_flag; --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2011-05-31 01:16:57
On Wed, 2011-05-11 at 20:12 -0700, Joe Perches wrote:
On Wed, 2011-05-11 at 23:06 -0400, David Miller wrote:quoted
From: Joe Perches <joe@perches.com> Date: Wed, 11 May 2011 19:31:13 -0700quoted
On Thu, 2011-05-12 at 10:52 +1000, Anton Blanchard wrote:quoted
plain text document attachment (ehea_22.patch) The tcp_end field is not actually used by the hardware, so there is no need to set it.+++ linux-net/drivers/net/ehea/ehea_qmr.h 2011-05-12 07:48:06.380382084 +1000@@ -106,7 +106,7 @@ struct ehea_swqe { u8 immediate_data_length; u8 tcp_offset; u8 reserved2; - u16 tcp_end; + u16 reserved2b; u8 wrap_tag; u8 descriptors; /* number of valid descriptors in WQE */ u16 reserved3;struct ehea_swqe isn't __packed. Shouldn't it be?Please don't mark it __packed unless absolutely necessary :-)Isn't it read from hardware. If not, why reserve anything?
All the fields have the required alignment, so __packed shouldn't be necessary but won't hurt either. Yes, it's a HW accessed structure. Cheers, Ben.