ehea updates v2
Subsystems (2)
cover ehea updates v2
Ben, Jesse, Michael: thanks for the review. Here is an updated set of patches based on the comments.
Anton
PATCH 2/15 ehea: Update multiqueue support
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.
---
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.
drivers/net/ehea/ehea_main.c +38 -53
@@ -60,7 +60,7 @@ static int rq1_entries = EHEA_DEF_ENTRIEstatic 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(sint 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(sehea_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_anetif_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_acase 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 *sdev_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_bufehea_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_portint 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_portif (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;
drivers/net/ehea/ehea.h +0 -2
@@ -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;
drivers/net/ehea/ehea_ethtool.c +9 -6
@@ -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++)
PATCH 5/15 ehea: Dont check NETIF_F_TSO in TX path
In reply to Anton BlanchardIt 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.
---
drivers/net/ehea/ehea_main.c +1 -1
@@ -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);
PATCH 7/15 ehea: Allocate large enough skbs to avoid partial cacheline DMA writes
In reply to Anton BlanchardThe 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.
---
drivers/net/ehea/ehea.h +2 -2
@@ -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
PATCH 14/15 ehea: Add GRO support
In reply to Anton BlanchardAdd GRO support to the ehea driver.
---
v2:
- Removed use of vlan_gro_receive as suggested by Jesse Gross
drivers/net/ehea/ehea_main.c +7 -14
@@ -637,18 +637,6 @@ static int ehea_treat_poll_error(structreturn 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
PATCH 4/15 ehea: Remove num_tx_qps module option
In reply to Anton BlanchardThe 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.
---
drivers/net/ehea/ehea.h +0 -3
@@ -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;
drivers/net/ehea/ehea_main.c +18 -33
178 lines not on this page · raw message
PATCH 15/15 ehea: Remove unused tcp_end field in send WQ
In reply to Anton BlanchardThe tcp_end field is not actually used by the hardware, so there is no need to set it.
---
drivers/net/ehea/ehea_main.c +0 -2
@@ -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 ; } }
drivers/net/ehea/ehea_qmr.h +1 -1
@@ -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;
PATCH 1/15 ehea: Remove NETIF_F_LLTX
In reply to Anton BlanchardRemove the deprecated NETIF_F_LLTX feature. Since the network stack now provides the locking we can remove the driver specific pr->xmit_lock.
---
drivers/net/ehea/ehea_main.c +2 -10
@@ -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)
drivers/net/ehea/ehea.h +0 -1
@@ -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 ];
PATCH 3/15 ehea: Remove force_irq logic in napi poll routine
In reply to Anton Blanchardcommit 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.
---
drivers/net/ehea/ehea_main.c +3 -10
@@ -927,7 +927,6 @@ static struct ehea_cqe *ehea_proc_cqes(sreturn cqe; } -#define EHEA_NAPI_POLL_NUM_BEFORE_IRQ 16#define EHEA_POLL_MAX_CQES 65535static int ehea_poll (struct napi_struct *napi,int budget)
@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_structstruct 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; }
drivers/net/ehea/ehea.h +0 -1
@@ -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;
PATCH 8/15 ehea: Simplify ehea_xmit2 and ehea_xmit3
In reply to Anton BlanchardBased 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.
---
drivers/net/ehea/ehea_main.c +38 -103
@@ -1677,37 +1677,6 @@ static int ehea_clean_portres(struct ehereturn 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_dereturn 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 *sskb_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
PATCH 10/15 ehea: Simplify type 3 transmit routine
In reply to Anton BlanchardIf a nonlinear skb fits within the immediate area, use skb_copy_bits instead of copying the frags by hand.
---
drivers/net/ehea/ehea_main.c +3 -18
@@ -2091,29 +2091,14 @@ static void ehea_xmit2(struct sk_buff *sstatic 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);
PATCH 12/15 ehea: Add 64bit statistics
In reply to Anton BlanchardSwitch to using ndo_get_stats64 to get 64bit statistics.
---
drivers/net/ehea/ehea_main.c +3 -3
@@ -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,
PATCH 13/15 ehea: Remove LRO support
In reply to Anton BlanchardIn preparation for adding GRO to ehea, remove LRO.
---
drivers/net/ehea/ehea_main.c +4 -71
@@ -61,8 +61,6 @@ static int rq2_entries = EHEA_DEF_ENTRIEstatic 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(structreturn 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 ehenetif_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_portNETIF_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" );
drivers/net/ehea/ehea.h +0 -7
@@ -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;
drivers/net/ehea/ehea_ethtool.c +0 -16
@@ -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(strucfor (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 = {
PATCH 6/15 ehea: Add vlan_features
In reply to Anton BlanchardWe weren't enabling any VLAN features so we missed out on checksum offload and TSO when using VLANs. Enable them.
---
drivers/net/ehea/ehea_main.c +2 -0
@@ -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)
PATCH 9/15 ehea: Merge swqe2 TSO and non TSO paths
In reply to Anton Blanchardwrite_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.
---
drivers/net/ehea/ehea_main.c +21 -55
@@ -1677,65 +1677,35 @@ static int ehea_clean_portres(struct ehereturn 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 ) {
PATCH 11/15 ehea: Remove some unused definitions
In reply to Anton BlanchardThe 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.
---
drivers/net/ehea/ehea_hw.h +0 -25
@@ -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;
Re: [PATCH 02/15] ehea: Update multiqueue support
In reply to Anton BlanchardQuoted 2 lines · Anton Blanchard
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... []
Quoted 1 line
Signed-off-by Anton Blanchard <[email protected]>
[]
Quoted 1 line
+++
linux-net/drivers/net/ehea/ehea_main.c2011-05-12 07:47:49.640116670 +1000
[]
drivers/net/ehea/ehea_main.c MODULE_PARM_DESC(rq1_entries, "Number of · line 96
Quoted 6 lines
drivers/net/ehea/ehea_main.c +1
-1@@ -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
Review static char ehea_ethtool_stats_keys[][ET
Quoted 2 lines
(quoted diff) +1
-0+++ 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?
Re: [PATCH 03/15] ehea: Remove force_irq logic in napi poll routine
In reply to Anton BlanchardReview static int ehea_poll(struct napi_struct
Quoted 8 lines · Anton Blanchard
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 <[email protected]>+++
linux-net/drivers/net/ehea/ehea_main.c2011-05-12 07:47:51.960153456 +1000(quoted diff) +0
-0@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_struct
[]
drivers/net/ehea/ehea_main.c static int ehea_poll(struct napi_struct · line 945
Quoted 1 line
drivers/net/ehea/ehea_main.c +1
-0+while ((rx != budget)) {
one level of parentheses is enough.
Re: [PATCH 15/15] ehea: Remove unused tcp_end field in send WQ
In reply to Anton Blancharddrivers/net/ehea/ehea_qmr.h struct ehea_swqe { · line 112
Quoted 13 lines · Anton Blanchard
plain text document attachment (ehea_22.patch)
Thetcp_endfield is not actually used by the hardware, so there is no need to set it.
+++linux-net/drivers/net/ehea/ehea_qmr.h2011-05-12 07:48:06.380382084 +1000drivers/net/ehea/ehea_qmr.h +1
-1@@ -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?
Re: [PATCH 03/15] ehea: Remove force_irq logic in napi poll routine
In reply to Anton BlanchardQuoted 4 lines · Anton Blanchard
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.
Signature · 3 lines
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.
Re: [PATCH 07/15] ehea: Allocate large enough skbs to avoid partial cacheline DMA writes
In reply to Anton BlanchardQuoted 5 lines · Anton Blanchard
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.
Quoted 7 lines
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.
Signature · 3 lines
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.
Re: [PATCH 02/15] ehea: Update multiqueue support
In reply to Anton BlanchardQuoted 2 lines · Anton Blanchard
The ehea driver had some multiqueue support but was missing the last few years of networking stack improvements:
[...]
Quoted 12 lines
drivers/net/ehea/ehea_main.c +1
-1@@ -60,7 +60,7 @@ static int rq1_entries = EHEA_DEF_ENTRIEstatic 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 ;
drivers/net/ehea/ehea_main.c MODULE_PARM_DESC(rq1_entries, "Number of · line 96
Quoted 5 lines
drivers/net/ehea/ehea_main.c +1
-1@@ -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.
Signature · 3 lines
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.
David Miller
maintainerRe: [PATCH 15/15] ehea: Remove unused tcp_end field in send WQ
In reply to Joe PerchesFrom: Joe Perches <[email protected]>
Date: Wed, 11 May 2011 19:31:13 -0700
Quoted 8 lines · Anton Blanchard
Quoted 7 lines
plain text document attachment (ehea_22.patch)
Thetcp_endfield is not actually used by the hardware, so there is no need to set it.
+++linux-net/drivers/net/ehea/ehea_qmr.h2011-05-12 07:48:06.380382084 +1000drivers/net/ehea/ehea_qmr.h +0
-0@@ -106,7 +106,7 @@ struct ehea_swqe {u8 immediate_data_length;u8 tcp_offset;
Quoted 8 lines
drivers/net/ehea/ehea_qmr.h struct ehea_swqe { · line 112
Quoted 6 lines
drivers/net/ehea/ehea_qmr.h +1
-1u8 reserved2; -u16 tcp_end; +u16 reserved2b;u8 wrap_tag;u8 descriptors;/* number of valid descriptors in WQE */ u16 reserved3;struct
ehea_swqeisn't__packed. Shouldn't it be?
Please don't mark it __packed unless absolutely necessary :-)
David Miller
maintainerRe: [PATCH 03/15] ehea: Remove force_irq logic in napi poll routine
In reply to Joe PerchesFrom: Joe Perches <[email protected]>
Date: Wed, 11 May 2011 19:31:10 -0700
Quoted 7 lines · Anton Blanchard
Quoted 5 lines
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 <[email protected]>
Quoted 6 lines
Review static int ehea_poll(struct napi_struct
Quoted 2 lines
+++
linux-net/drivers/net/ehea/ehea_main.c2011-05-12 07:47:51.960153456 +1000(quoted diff) +0
-0@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_struct[]
drivers/net/ehea/ehea_main.c static int ehea_poll(struct napi_struct · line 945
Quoted 1 line
drivers/net/ehea/ehea_main.c +1
-0+while ((rx != budget)) {one level of parentheses is enough.
Agreed.
Re: [PATCH 15/15] ehea: Remove unused tcp_end field in send WQ
In reply to David MillerQuoted 17 lines · David Miller
From: Joe Perches <[email protected]>
Date: Wed, 11 May 2011 19:31:13 -0700Quoted 7 lines · Anton Blanchard
Quoted 6 lines
plain text document attachment (ehea_22.patch)
Thetcp_endfield is not actually used by the hardware, so there is no need to set it.
+++linux-net/drivers/net/ehea/ehea_qmr.h2011-05-12 07:48:06.380382084 +1000drivers/net/ehea/ehea_qmr.h +0
-0@@ -106,7 +106,7 @@ struct ehea_swqe {u8 immediate_data_length;Quoted 8 lines
drivers/net/ehea/ehea_qmr.h struct ehea_swqe { · line 112
Quoted 7 lines
drivers/net/ehea/ehea_qmr.h +1
-1u8 tcp_offset;u8 reserved2; -u16 tcp_end; +u16 reserved2b;u8 wrap_tag;u8 descriptors;/* number of valid descriptors in WQE */ u16 reserved3;struct
ehea_swqeisn't__packed. Shouldn't it be?
Quoted 1 line
Please don't mark it
__packedunless absolutely necessary :-)
Isn't it read from hardware.
If not, why reserve anything?
Re: [PATCH 14/15] ehea: Add GRO support
In reply to Anton Blanchard2011/5/12 Anton Blanchard <[email protected]>:
Quoted 1 line
Add GRO support to the ehea driver.
[...]
Quoted 2 lines
drivers/net/ehea/ehea_main.c 2011-05-12 07:48:05.100361788 +1000 renamed from drivers/net/ehea/ehea_main.c 2011-05-12 07:48:03.810341336 +1000 +0
-0
[...]
Quoted 9 lines
drivers/net/ehea/ehea_main.c 2011-05-12 07:48:05.100361788 +1000 renamed from drivers/net/ehea/ehea_main.c 2011-05-12 07:48:03.810341336 +1000 +1
-1@@ -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
GRO is now enabled by default, so no need to put it in hw_features or features.
Best Regards,
Michał Mirosław
Re: [PATCH 03/15] ehea: Remove force_irq logic in napi poll routine
In reply to Anton BlanchardQuoted 5 lines · Anton Blanchard
plain text document attachment (ehea_3.patch)
commit18604c548545(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.
Quoted 63 lines
Signed-off-by Anton Blanchard <[email protected]>---
Index:
linux-net/drivers/net/ehea/ehea_main.c
===================================================================drivers/net/ehea/ehea_main.c +3
-10@@ -927,7 +927,6 @@ static struct ehea_cqe *ehea_proc_cqes(sreturn cqe; } -#define EHEA_NAPI_POLL_NUM_BEFORE_IRQ 16#define EHEA_POLL_MAX_CQES 65535static int ehea_poll (struct napi_struct *napi,int budget)@@ -937,18 +936,13 @@ static int ehea_poll(struct napi_structstruct 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
===================================================================drivers/net/ehea/ehea.h +0
-2@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/15] ehea: Remove unused tcp_end field in send WQ
In reply to Joe PerchesQuoted 18 lines · Joe Perches
Quoted 17 lines · David Miller
From: Joe Perches <[email protected]>
Date: Wed, 11 May 2011 19:31:13 -0700Quoted 15 lines · Anton Blanchard
drivers/net/ehea/ehea_qmr.h struct ehea_swqe { · line 112
Quoted 13 lines
plain text document attachment (ehea_22.patch)
Thetcp_endfield is not actually used by the hardware, so there is no need to set it.
+++linux-net/drivers/net/ehea/ehea_qmr.h2011-05-12 07:48:06.380382084 +1000drivers/net/ehea/ehea_qmr.h +1
-1@@ -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_swqeisn't__packed. Shouldn't it be?
Quoted 4 lines
Quoted 1 line
Please don't mark it
__packedunless 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.