s390/qeth: updates 2019-04-17
Subsystems (4)
cover s390/qeth: updates 2019-04-17
Hi Dave,
please apply some additional qeth patches to net-next. This patchset converts the driver to use the kernel's multiqueue model.
Thanks,
Julian
Julian Wiedmann (8):
s390/qeth: clarify naming for some QDIO helpers s390/qeth: handle error from qeth_update_from_chp_desc() s390/qeth: don't bother updating the last-tx time s390/qeth: don't keep statistics for tx timeout s390/qeth: add TX multiqueue support for IQD devices s390/qeth: add TX multiqueue support for OSA devices s390/qeth: simplify QoS code
s390/qeth: stop/wake TX queues based on their fill level
drivers/s390/net/qeth_core.h | 36 +++--- drivers/s390/net/qeth_core_main.c | 234 ++++++++++++++++++++++---------------- drivers/s390/net/qeth_core_sys.c | 7 +- drivers/s390/net/qeth_ethtool.c | 17 +++ drivers/s390/net/qeth_l2_main.c | 38 ++++--- drivers/s390/net/qeth_l3_main.c | 53 +++++---- 6 files changed, 233 insertions(+), 152 deletions(-)
Signature · 1 line
2.16.4
PATCH 1/8 s390/qeth: clarify naming for some QDIO helpers
The naming of several QDIO helpers doesn't match their actual functionality, or the structures they operate on. Clean this up.
s/qeth_alloc_qdio_buffers/qeth_alloc_qdio_queues s/qeth_free_qdio_buffers/qeth_free_qdio_queues s/qeth_alloc_qdio_out_buf/qeth_alloc_output_queue s/qeth_clear_outq_buffers/qeth_drain_output_queue s/qeth_clear_qdio_buffers/qeth_drain_output_queues
--- drivers/s390/net/qeth_core.h | 2 +- drivers/s390/net/qeth_core_main.c | 39 +++++++++++++++++++-------------------- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- 4 files changed, 22 insertions(+), 23 deletions(-)
drivers/s390/net/qeth_core.h +1 -1
@@ -988,7 +988,7 @@ void qeth_clear_ipacmd_list(struct qeth_card *);int qeth_qdio_clear_card (struct qeth_card *,int );void qeth_clear_working_pool_list (struct qeth_card *);void qeth_clear_cmd_buffers (struct qeth_channel *); -void qeth_clear_qdio_buffers (struct qeth_card *); +void qeth_drain_output_queues (struct qeth_card *card);void qeth_setadp_promisc_mode (struct qeth_card *);int qeth_setadpparms_change_macaddr (struct qeth_card *);void qeth_tx_timeout (struct net_device *);
drivers/s390/net/qeth_core_main.c +19 -20
@@ -67,7 +67,7 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,static struct qeth_cmd_buffer *qeth_get_buffer (struct qeth_channel *);static void qeth_free_buffer_pool (struct qeth_card *);static int qeth_qdio_establish (struct qeth_card *); -static void qeth_free_qdio_buffers (struct qeth_card *); +static void qeth_free_qdio_queues (struct qeth_card *card);static void qeth_notify_skbs (struct qeth_qdio_out_q *queue,struct qeth_qdio_out_buffer *buf,enum iucv_tx_notify notification);
@@ -1178,7 +1178,7 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,atomic_set (&buf->state,QETH_QDIO_BUF_EMPTY ); } -static void qeth_clear_outq_buffers (struct qeth_qdio_out_q *q,int free) +static void qeth_drain_output_queue (struct qeth_qdio_out_q *q,bool free) {int j;
@@ -1194,19 +1194,18 @@ static void qeth_clear_outq_buffers(struct qeth_qdio_out_q *q, int free) } } -void qeth_clear_qdio_buffers (struct qeth_card *card) +void qeth_drain_output_queues (struct qeth_card *card) {int i;QETH_CARD_TEXT (card,2 ,"clearqdbf" );/* clear outbound buffers to free skbs */ for (i =0 ; i < card->qdio.no_out_queues; ++i) { -if (card->qdio.out_qs[i]) { -qeth_clear_outq_buffers (card->qdio.out_qs[i],0 ); - } +if (card->qdio.out_qs[i]) +qeth_drain_output_queue (card->qdio.out_qs[i], false); } } -EXPORT_SYMBOL_GPL (qeth_clear_qdio_buffers); +EXPORT_SYMBOL_GPL (qeth_drain_output_queues);static void qeth_free_buffer_pool (struct qeth_card *card) {
@@ -1280,7 +1279,7 @@ static void qeth_set_single_write_queues(struct qeth_card *card) {if ((atomic_read (&card->qdio.state) !=QETH_QDIO_UNINITIALIZED ) && (card->qdio.no_out_queues ==4 )) -qeth_free_qdio_buffers (card); +qeth_free_qdio_queues (card); card->qdio.no_out_queues =1 ;if (card->qdio.default_out_queue !=0 )
@@ -1293,7 +1292,7 @@ static void qeth_set_multiple_write_queues(struct qeth_card *card) {if ((atomic_read (&card->qdio.state) !=QETH_QDIO_UNINITIALIZED ) && (card->qdio.no_out_queues ==1 )) { -qeth_free_qdio_buffers (card); +qeth_free_qdio_queues (card); card->qdio.default_out_queue =2 ; } card->qdio.no_out_queues =4 ;
@@ -2177,7 +2176,7 @@ static int qeth_update_max_mtu(struct qeth_card *card, unsigned int max_mtu)/* adjust RX buffer size to new max MTU: */ card->qdio.in_buf_size = max_mtu +2 *PAGE_SIZE ;if (dev->max_mtu && dev->max_mtu != max_mtu) -qeth_free_qdio_buffers (card); +qeth_free_qdio_queues (card); }else {if (dev->mtu) new_mtu = dev->mtu;
@@ -2350,12 +2349,12 @@ static void qeth_free_output_queue(struct qeth_qdio_out_q *q)if (!q)return ; -qeth_clear_outq_buffers (q,1 ); +qeth_drain_output_queue (q, true);qdio_free_buffers (q->qdio_bufs,QDIO_MAX_BUFFERS_PER_Q );kfree (q); } -static struct qeth_qdio_out_q *qeth_alloc_qdio_out_buf (void ) +static struct qeth_qdio_out_q *qeth_alloc_output_queue (void ) {struct qeth_qdio_out_q *q =kzalloc (sizeof (*q),GFP_KERNEL );
@@ -2369,7 +2368,7 @@ static struct qeth_qdio_out_q *qeth_alloc_qdio_out_buf(void)return q; } -static int qeth_alloc_qdio_buffers (struct qeth_card *card) +static int qeth_alloc_qdio_queues (struct qeth_card *card) {int i, j;
@@ -2390,7 +2389,7 @@ static int qeth_alloc_qdio_buffers(struct qeth_card *card)/* outbound */ for (i =0 ; i < card->qdio.no_out_queues; ++i) { - card->qdio.out_qs[i] =qeth_alloc_qdio_out_buf (); + card->qdio.out_qs[i] =qeth_alloc_output_queue ();if (!card->qdio.out_qs[i]) goto out_freeoutq;QETH_DBF_TEXT_ (SETUP ,2 ,"outq %i" , i);
@@ -2431,7 +2430,7 @@ static int qeth_alloc_qdio_buffers(struct qeth_card *card)return -ENOMEM ; } -static void qeth_free_qdio_buffers (struct qeth_card *card) +static void qeth_free_qdio_queues (struct qeth_card *card) {int i, j;
@@ -2538,7 +2537,7 @@ static int qeth_mpc_initialize(struct qeth_card *card)QETH_DBF_TEXT_ (SETUP ,2 ,"5err%d" , rc); goto out_qdio; } - rc =qeth_alloc_qdio_buffers (card); + rc =qeth_alloc_qdio_queues (card);if (rc) {QETH_DBF_TEXT_ (SETUP ,2 ,"5err%d" , rc); goto out_qdio;
@@ -2546,7 +2545,7 @@ static int qeth_mpc_initialize(struct qeth_card *card) rc =qeth_qdio_establish (card);if (rc) {QETH_DBF_TEXT_ (SETUP ,2 ,"6err%d" , rc); -qeth_free_qdio_buffers (card); +qeth_free_qdio_queues (card); goto out_qdio; } rc =qeth_qdio_activate (card);
@@ -3460,7 +3459,7 @@ int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq) goto out; } -qeth_free_qdio_buffers (card); +qeth_free_qdio_queues (card); card->options.cq = cq; rc =0 ; }
@@ -4930,7 +4929,7 @@ static void qeth_core_free_card(struct qeth_card *card)qeth_clean_channel (&card->write);qeth_clean_channel (&card->data);destroy_workqueue (card->event_wq); -qeth_free_qdio_buffers (card); +qeth_free_qdio_queues (card);unregister_service_level (&card->qeth_service_level);dev_set_drvdata (&card->gdev->dev,NULL );kfree (card);
@@ -5732,7 +5731,7 @@ static void qeth_core_shutdown(struct ccwgroup_device *gdev)if ((gdev->state ==CCWGROUP_ONLINE ) && card->info.hwtrap)qeth_hw_trap (card,QETH_DIAGS_TRAP_DISARM );qeth_qdio_clear_card (card,0 ); -qeth_clear_qdio_buffers (card); +qeth_drain_output_queues (card);qdio_free (CARD_DDEV (card)); }
drivers/s390/net/qeth_l2_main.c +1 -1
@@ -299,7 +299,7 @@ static void qeth_l2_stop_card(struct qeth_card *card) }if (card->state ==CARD_STATE_HARDSETUP ) {qeth_qdio_clear_card (card,0 ); -qeth_clear_qdio_buffers (card); +qeth_drain_output_queues (card);qeth_clear_working_pool_list (card); card->state =CARD_STATE_DOWN ; }
drivers/s390/net/qeth_l3_main.c +1 -1
@@ -1433,7 +1433,7 @@ static void qeth_l3_stop_card(struct qeth_card *card) }if (card->state ==CARD_STATE_HARDSETUP ) {qeth_qdio_clear_card (card,0 ); -qeth_clear_qdio_buffers (card); +qeth_drain_output_queues (card);qeth_clear_working_pool_list (card); card->state =CARD_STATE_DOWN ; }
Signature · 1 line
2.16.4
PATCH 2/8 s390/qeth: handle error from qeth_update_from_chp_desc()
In reply to Julian WiedmannSubsequent code relies on the values that qeth_update_from_chp_desc() reads from the CHP descriptor. Rather than dealing with weird errors later on, just handle it properly here.
--- drivers/s390/net/qeth_core_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_core_main.c +10 -4
@@ -1298,7 +1298,7 @@ static void qeth_set_multiple_write_queues(struct qeth_card *card) card->qdio.no_out_queues =4 ; } -static void qeth_update_from_chp_desc (struct qeth_card *card) +static int qeth_update_from_chp_desc (struct qeth_card *card) {struct ccw_device *ccwdev;struct channel_path_desc_fmt0 *chp_dsc;
@@ -1308,7 +1308,7 @@ static void qeth_update_from_chp_desc(struct qeth_card *card) ccwdev = card->data.ccwdev; chp_dsc =ccw_device_get_chp_desc (ccwdev,0 );if (!chp_dsc) - goto out; +return -ENOMEM ; card->info.func_level =0x4100 + chp_dsc->desc;if (card->info.type ==QETH_CARD_TYPE_IQD )
@@ -1323,6 +1323,7 @@ static void qeth_update_from_chp_desc(struct qeth_card *card)kfree (chp_dsc);QETH_DBF_TEXT_ (SETUP ,2 ,"nr:%x" , card->qdio.no_out_queues);QETH_DBF_TEXT_ (SETUP ,2 ,"lvl:%02x" , card->info.func_level); +return 0 ; }static void qeth_init_qdio_info (struct qeth_card *card)
@@ -4978,7 +4979,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok)QETH_DBF_TEXT (SETUP ,2 ,"hrdsetup" );atomic_set (&card->force_alloc_skb,0 ); -qeth_update_from_chp_desc (card); + rc =qeth_update_from_chp_desc (card); +if (rc) +return rc; retry:if (retries <3 ) QETH_DBF_MESSAGE(2, "Retrying to do IDX activates on device %x.\n",
@@ -5635,7 +5638,9 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) }qeth_setup_card (card); -qeth_update_from_chp_desc (card); + rc =qeth_update_from_chp_desc (card); +if (rc) + goto err_chp_desc; card->dev =qeth_alloc_netdev (card);if (!card->dev) {
@@ -5670,6 +5675,7 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)qeth_core_free_discipline (card); err_load:free_netdev (card->dev); +err_chp_desc: err_card:qeth_core_free_card (card); err_dev:
Signature · 1 line
2.16.4
PATCH 3/8 s390/qeth: don't bother updating the last-tx time
In reply to Julian WiedmannAs the documentation for netif_trans_update() says, netdev_start_xmit() already updates the last-tx time after every good xmit. So don't duplicate that effort.
One odd case is that qeth_flush_buffers() also gets called from our TX completion handler, to flush out any partially filled buffer when we switch the queue to non-packing mode. But as the TX completion handler will _always_ wake the txq, we don't have to worry about the TX watchdog there.
--- drivers/s390/net/qeth_core_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/s390/net/qeth_core_main.c +0 -1
@@ -3371,7 +3371,6 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, }QETH_TXQ_STAT_ADD (queue, bufs, count); -netif_trans_update (queue->card->dev); qdio_flags =QDIO_FLAG_SYNC_OUTPUT ;if (atomic_read (&queue->set_pci_flags_count)) qdio_flags |=QDIO_FLAG_PCI_OUT ;
Signature · 1 line
2.16.4
PATCH 4/8 s390/qeth: don't keep statistics for tx timeout
In reply to Julian Wiedmannstruct netdev_queue contains a counter for tx timeouts, which gets updated by dev_watchdog(). So let's not attempt to maintain our own statistics, in particular not by overloading the skb-error counter.
--- drivers/s390/net/qeth_core.h | 1 - drivers/s390/net/qeth_core_main.c | 2 -- 2 files changed, 3 deletions(-)
drivers/s390/net/qeth_core.h +0 -1
@@ -464,7 +464,6 @@ struct qeth_card_stats {u64 rx_errors;u64 rx_dropped;u64 rx_multicast; -u64 tx_errors; };struct qeth_out_q_stats {
drivers/s390/net/qeth_core_main.c +0 -2
@@ -4340,7 +4340,6 @@ void qeth_tx_timeout(struct net_device *dev) card = dev->ml_priv;QETH_CARD_TEXT (card,4 ,"txtimeo" ); -QETH_CARD_STAT_INC (card, tx_errors);qeth_schedule_recovery (card); }EXPORT_SYMBOL_GPL (qeth_tx_timeout);
@@ -6192,7 +6191,6 @@ void qeth_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) stats->rx_errors = card->stats.rx_errors; stats->rx_dropped = card->stats.rx_dropped; stats->multicast = card->stats.rx_multicast; - stats->tx_errors = card->stats.tx_errors;for (i =0 ; i < card->qdio.no_out_queues; i++) { queue = card->qdio.out_qs[i];
Signature · 1 line
2.16.4
PATCH 5/8 s390/qeth: add TX multiqueue support for IQD devices
In reply to Julian Wiedmannqeth has been supporting multiple HW Output Queues for a long time. But rather than exposing those queues to the stack, it uses its own queue selection logic in .ndo_start_xmit... with all the drawbacks that entails.
Start off by switching IQD devices over to a proper mqs net_device, and converting all the netdev_queue management code.
One oddity with IQD devices is the requirement to place all mcast traffic on the _highest_ established HW queue. Doing so via .ndo_select_queue seems straight-forward - but that won't work if only some of the HW queues are active
(ie. when dev->real_num_tx_queues < dev->num_tx_queues), since netdev_cap_txqueue() will not allow us to put skbs on the higher queues.
To make this work, we
1. let .ndo_select_queue() map all mcast traffic to netdev_queue 0, and
2. later re-map the netdev_queue and HW queue indices in .ndo_start_xmit and the TX completion handler.
With this patch we default to a fixed set of 1 ucast and 1 mcast queue. Support for dynamic reconfiguration is added at a later time.
--- drivers/s390/net/qeth_core.h | 18 +++++++++++++++--- drivers/s390/net/qeth_core_main.c | 27 +++++++++++++++++++++------ drivers/s390/net/qeth_core_sys.c | 3 +++ drivers/s390/net/qeth_ethtool.c | 16 ++++++++++++++++ drivers/s390/net/qeth_l2_main.c | 29 +++++++++++++++++++---------- drivers/s390/net/qeth_l3_main.c | 30 +++++++++++++++++++++++------- 6 files changed, 97 insertions(+), 26 deletions(-)
drivers/s390/net/qeth_core.h +15 -3
@@ -219,6 +219,9 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa,/* QDIO queue and buffer handling */ /*****************************************************************************/ #define QETH_MAX_QUEUES 4 +#define QETH_IQD_MIN_TXQ 2/* One for ucast, one for mcast. */ +#define QETH_IQD_MCAST_TXQ 0 +#define QETH_IQD_MIN_UCAST_TXQ 1#define QETH_IN_BUF_SIZE_DEFAULT 65536#define QETH_IN_BUF_COUNT_DEFAULT 64#define QETH_IN_BUF_COUNT_HSDEFAULT 128
@@ -835,6 +838,15 @@ static inline bool qeth_netdev_is_registered(struct net_device *dev)return dev->netdev_ops !=NULL ; } +static inline u16 qeth_iqd_translate_txq (struct net_device *dev,u16 txq) +{ +if (txq ==QETH_IQD_MCAST_TXQ ) +return dev->num_tx_queues -1 ; +if (txq == dev->num_tx_queues -1 ) +return QETH_IQD_MCAST_TXQ ; +return txq; +} +static inline void qeth_scrub_qdio_buffer (struct qdio_buffer *buf,unsigned int elements) {
@@ -934,10 +946,8 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb, int ipv);static inline struct qeth_qdio_out_q *qeth_get_tx_queue (struct qeth_card *card,struct sk_buff *skb, -int ipv,int cast_type) +int ipv) { -if (IS_IQD (card) && cast_type !=RTN_UNICAST ) -return card->qdio.out_qs[card->qdio.no_out_queues -1 ];if (!card->qdio.do_prio_queueing)return card->qdio.out_qs[card->qdio.default_out_queue];return card->qdio.out_qs[qeth_get_priority_queue (card, skb, ipv)];
@@ -1022,6 +1032,8 @@ netdev_features_t qeth_features_check(struct sk_buff *skb,struct net_device *dev, netdev_features_t features);void qeth_get_stats64 (struct net_device *dev,struct rtnl_link_stats64 *stats); +u16 qeth_iqd_select_queue (struct net_device *dev,struct sk_buff *skb, +u8 cast_type,struct net_device *sb_dev);int qeth_open (struct net_device *dev);int qeth_stop (struct net_device *dev);
drivers/s390/net/qeth_core_main.c +21 -6
@@ -3485,7 +3485,7 @@ static void qeth_qdio_cq_handler(struct qeth_card *card, unsigned int qdio_err,QETH_CARD_TEXT_ (card,5 ,"qcqherr%d" , qdio_err);if (qdio_err) { -netif_stop_queue (card->dev); +netif_tx_stop_all_queues (card->dev);qeth_schedule_recovery (card);return ; }
@@ -3541,12 +3541,14 @@ static void qeth_qdio_output_handler(struct ccw_device *ccwdev,struct qeth_card *card = (struct qeth_card *) card_ptr;struct qeth_qdio_out_q *queue = card->qdio.out_qs[__queue];struct qeth_qdio_out_buffer *buffer; +struct net_device *dev = card->dev; +u16 txq;int i;QETH_CARD_TEXT (card,6 ,"qdouhdl" );if (qdio_error &QDIO_ERROR_FATAL ) {QETH_CARD_TEXT (card,2 ,"achkcond" ); -netif_stop_queue (card->dev); +netif_tx_stop_all_queues (dev);qeth_schedule_recovery (card);return ; }
@@ -3595,7 +3597,8 @@ static void qeth_qdio_output_handler(struct ccw_device *ccwdev,if (card->info.type !=QETH_CARD_TYPE_IQD )qeth_check_outbound_queue (queue); -netif_wake_queue (queue->card->dev); + txq =IS_IQD (card) ?qeth_iqd_translate_txq (dev, __queue) :0 ; +netif_wake_subqueue (dev, txq); }/* We cannot use outbound queue 3 for unicast packets on HiperSockets */
@@ -5557,7 +5560,8 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)switch (card->info.type) {case QETH_CARD_TYPE_IQD : - dev =alloc_netdev (0 ,"hsi%d" ,NET_NAME_UNKNOWN , ether_setup); + dev =alloc_netdev_mqs (0 ,"hsi%d" ,NET_NAME_UNKNOWN , + ether_setup,QETH_MAX_QUEUES ,1 );break ;case QETH_CARD_TYPE_OSN : dev =alloc_netdev (0 ,"osn%d" ,NET_NAME_UNKNOWN , ether_setup);
@@ -5585,8 +5589,10 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card) dev->priv_flags &= ~IFF_TX_SKB_SHARING ; dev->hw_features |=NETIF_F_SG ; dev->vlan_features |=NETIF_F_SG ; -if (IS_IQD (card)) +if (IS_IQD (card)) { +netif_set_real_num_tx_queues (dev,QETH_IQD_MIN_TXQ ); dev->features |=NETIF_F_SG ; + } }return dev;
@@ -6203,6 +6209,15 @@ void qeth_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) }EXPORT_SYMBOL_GPL (qeth_get_stats64); +u16 qeth_iqd_select_queue (struct net_device *dev,struct sk_buff *skb, +u8 cast_type,struct net_device *sb_dev) +{ +if (cast_type !=RTN_UNICAST ) +return QETH_IQD_MCAST_TXQ ; +return QETH_IQD_MIN_UCAST_TXQ ; +} +EXPORT_SYMBOL_GPL (qeth_iqd_select_queue); +int qeth_open (struct net_device *dev) {struct qeth_card *card = dev->ml_priv;
@@ -6213,7 +6228,7 @@ int qeth_open(struct net_device *dev)return -EIO ; card->data.state =CH_STATE_UP ; -netif_start_queue (dev); +netif_tx_start_all_queues (dev);napi_enable (&card->napi);local_bh_disable ();
drivers/s390/net/qeth_core_sys.c +3 -0
@@ -198,6 +198,9 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev,if (!card)return -EINVAL ; +if (IS_IQD (card)) +return -EOPNOTSUPP ; +mutex_lock (&card->conf_mutex);if (card->state !=CARD_STATE_DOWN ) { rc = -EPERM ;
drivers/s390/net/qeth_ethtool.c +16 -0
@@ -154,6 +154,21 @@ static void qeth_get_drvinfo(struct net_device *dev, CARD_RDEV_ID(card), CARD_WDEV_ID(card), CARD_DDEV_ID(card)); } +static void qeth_get_channels (struct net_device *dev, +struct ethtool_channels *channels) +{ +struct qeth_card *card = dev->ml_priv; + + channels->max_rx = dev->num_rx_queues; + channels->max_tx = card->qdio.no_out_queues; + channels->max_other =0 ; + channels->max_combined =0 ; + channels->rx_count = dev->real_num_rx_queues; + channels->tx_count = dev->real_num_tx_queues; + channels->other_count =0 ; + channels->combined_count =0 ; +} +/* Helper function to fill 'advertising' and 'supported' which are the same. */ /* Autoneg and full-duplex are supported and advertised unconditionally. */ /* Always advertise and support all speeds up to specified, and only one */
@@ -359,6 +374,7 @@ const struct ethtool_ops qeth_ethtool_ops = { .get_ethtool_stats = qeth_get_ethtool_stats, .get_sset_count = qeth_get_sset_count, .get_drvinfo = qeth_get_drvinfo, + .get_channels = qeth_get_channels, .get_link_ksettings = qeth_get_link_ksettings, };
drivers/s390/net/qeth_l2_main.c +19 -10
@@ -161,10 +161,8 @@ static void qeth_l2_drain_rx_mode_cache(struct qeth_card *card) } } -static int qeth_l2_get_cast_type (struct qeth_card *card,struct sk_buff *skb) +static int qeth_l2_get_cast_type (struct sk_buff *skb) { -if (card->info.type ==QETH_CARD_TYPE_OSN ) -return RTN_UNICAST ;if (is_broadcast_ether_addr (skb->data))return RTN_BROADCAST ;if (is_multicast_ether_addr (skb->data))
@@ -603,26 +601,29 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) {struct qeth_card *card = dev->ml_priv; -int cast_type =qeth_l2_get_cast_type (card, skb); +u16 txq =skb_get_queue_mapping (skb);int ipv =qeth_get_ip_version (skb);struct qeth_qdio_out_q *queue;int tx_bytes = skb->len;int rc; - queue =qeth_get_tx_queue (card, skb, ipv, cast_type); +if (IS_IQD (card)) + queue = card->qdio.out_qs[qeth_iqd_translate_txq (dev, txq)]; +else + queue =qeth_get_tx_queue (card, skb, ipv); -netif_stop_queue (dev); +netif_stop_subqueue (dev, txq);if (IS_OSN (card)) rc =qeth_l2_xmit_osn (card, skb, queue);else - rc =qeth_xmit (card, skb, queue, ipv, cast_type, - qeth_l2_fill_header); + rc =qeth_xmit (card, skb, queue, ipv, +qeth_l2_get_cast_type (skb), qeth_l2_fill_header);if (!rc) {QETH_TXQ_STAT_INC (queue, tx_packets);QETH_TXQ_STAT_ADD (queue, tx_bytes, tx_bytes); -netif_wake_queue (dev); +netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; }else if (rc == -EBUSY ) {return NETDEV_TX_BUSY ;
@@ -630,10 +631,17 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,QETH_TXQ_STAT_INC (queue, tx_dropped);kfree_skb (skb); -netif_wake_queue (dev); +netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; } +static u16 qeth_l2_select_queue (struct net_device *dev,struct sk_buff *skb, +struct net_device *sb_dev) +{ +return qeth_iqd_select_queue (dev, skb,qeth_l2_get_cast_type (skb), + sb_dev); +} +static const struct device_type qeth_l2_devtype = { .name ="qeth_layer2" , .groups = qeth_l2_attr_groups,
@@ -687,6 +695,7 @@ static const struct net_device_ops qeth_l2_netdev_ops = { .ndo_get_stats64 = qeth_get_stats64, .ndo_start_xmit = qeth_l2_hard_start_xmit, .ndo_features_check = qeth_features_check, + .ndo_select_queue = qeth_l2_select_queue, .ndo_validate_addr = qeth_l2_validate_addr, .ndo_set_rx_mode = qeth_l2_set_rx_mode, .ndo_do_ioctl = qeth_do_ioctl,
drivers/s390/net/qeth_l3_main.c +23 -7
@@ -2062,28 +2062,36 @@ static int qeth_l3_xmit(struct qeth_card *card, struct sk_buff *skb,static netdev_tx_t qeth_l3_hard_start_xmit (struct sk_buff *skb,struct net_device *dev) { -int cast_type =qeth_l3_get_cast_type (skb);struct qeth_card *card = dev->ml_priv; +u16 txq =skb_get_queue_mapping (skb);int ipv =qeth_get_ip_version (skb);struct qeth_qdio_out_q *queue;int tx_bytes = skb->len; -int rc; - - queue =qeth_get_tx_queue (card, skb, ipv, cast_type); +int cast_type, rc;if (IS_IQD (card)) { + queue = card->qdio.out_qs[qeth_iqd_translate_txq (dev, txq)]; +if (card->options.sniffer) goto tx_drop;if ((card->options.cq !=QETH_CQ_ENABLED && !ipv) || (card->options.cq ==QETH_CQ_ENABLED && skb->protocol !=htons (ETH_P_AF_IUCV ))) goto tx_drop; + +if (txq ==QETH_IQD_MCAST_TXQ ) + cast_type =qeth_l3_get_cast_type (skb); +else + cast_type =RTN_UNICAST ; + }else { + queue =qeth_get_tx_queue (card, skb, ipv); + cast_type =qeth_l3_get_cast_type (skb); }if (cast_type ==RTN_BROADCAST && !card->info.broadcast_capable) goto tx_drop; -netif_stop_queue (dev); +netif_stop_subqueue (dev, txq);if (ipv ==4 ||IS_IQD (card)) rc =qeth_l3_xmit (card, skb, queue, ipv, cast_type);
@@ -2094,7 +2102,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,if (!rc) {QETH_TXQ_STAT_INC (queue, tx_packets);QETH_TXQ_STAT_ADD (queue, tx_bytes, tx_bytes); -netif_wake_queue (dev); +netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; }else if (rc == -EBUSY ) {return NETDEV_TX_BUSY ;
@@ -2103,7 +2111,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb, tx_drop:QETH_TXQ_STAT_INC (queue, tx_dropped);kfree_skb (skb); -netif_wake_queue (dev); +netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; }
@@ -2147,11 +2155,19 @@ static netdev_features_t qeth_l3_osa_features_check(struct sk_buff *skb,return qeth_features_check (skb, dev, features); } +static u16 qeth_l3_iqd_select_queue (struct net_device *dev,struct sk_buff *skb, +struct net_device *sb_dev) +{ +return qeth_iqd_select_queue (dev, skb,qeth_l3_get_cast_type (skb), + sb_dev); +} +static const struct net_device_ops qeth_l3_netdev_ops = { .ndo_open = qeth_open, .ndo_stop = qeth_stop, .ndo_get_stats64 = qeth_get_stats64, .ndo_start_xmit = qeth_l3_hard_start_xmit, + .ndo_select_queue = qeth_l3_iqd_select_queue, .ndo_validate_addr = eth_validate_addr, .ndo_set_rx_mode = qeth_l3_set_rx_mode, .ndo_do_ioctl = qeth_do_ioctl,
Signature · 1 line
2.16.4
PATCH 6/8 s390/qeth: add TX multiqueue support for OSA devices
In reply to Julian WiedmannThis adds trivial support for multiple TX queues on OSA-style devices (both real HW and z/VM NICs). For now we expose the driver's existing QoS mechanism via .ndo_select_queue, and adjust the number of available TX queues when qeth_update_from_chp_desc() detects that the HW configuration has changed.
--- drivers/s390/net/qeth_core.h | 11 +------ drivers/s390/net/qeth_core_main.c | 67 ++++++++++++++++++--------------------- drivers/s390/net/qeth_l2_main.c | 14 +++++--- drivers/s390/net/qeth_l3_main.c | 11 ++++++- 4 files changed, 51 insertions(+), 52 deletions(-)
drivers/s390/net/qeth_core.h +1 -10
@@ -942,16 +942,7 @@ static inline int qeth_send_simple_setassparms_v6(struct qeth_card *card, data, QETH_PROT_IPV6); } -int qeth_get_priority_queue (struct qeth_card *card,struct sk_buff *skb, -int ipv); -static inline struct qeth_qdio_out_q *qeth_get_tx_queue (struct qeth_card *card, -struct sk_buff *skb, -int ipv) -{ -if (!card->qdio.do_prio_queueing) -return card->qdio.out_qs[card->qdio.default_out_queue]; -return card->qdio.out_qs[qeth_get_priority_queue (card, skb, ipv)]; -} +int qeth_get_priority_queue (struct qeth_card *card,struct sk_buff *skb);extern struct qeth_discipline qeth_l2_discipline;extern struct qeth_discipline qeth_l3_discipline;
drivers/s390/net/qeth_core_main.c +31 -36
144 lines not on this page · raw message
drivers/s390/net/qeth_l2_main.c +9 -5
@@ -602,7 +602,6 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb, {struct qeth_card *card = dev->ml_priv;u16 txq =skb_get_queue_mapping (skb); -int ipv =qeth_get_ip_version (skb);struct qeth_qdio_out_q *queue;int tx_bytes = skb->len;int rc;
@@ -610,14 +609,14 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,if (IS_IQD (card)) queue = card->qdio.out_qs[qeth_iqd_translate_txq (dev, txq)];else - queue =qeth_get_tx_queue (card, skb, ipv); + queue = card->qdio.out_qs[txq];netif_stop_subqueue (dev, txq);if (IS_OSN (card)) rc =qeth_l2_xmit_osn (card, skb, queue);else - rc =qeth_xmit (card, skb, queue, ipv, + rc =qeth_xmit (card, skb, queue,qeth_get_ip_version (skb),qeth_l2_get_cast_type (skb), qeth_l2_fill_header);if (!rc) {
@@ -638,8 +637,13 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,static u16 qeth_l2_select_queue (struct net_device *dev,struct sk_buff *skb,struct net_device *sb_dev) { -return qeth_iqd_select_queue (dev, skb,qeth_l2_get_cast_type (skb), - sb_dev); +struct qeth_card *card = dev->ml_priv; + +if (IS_IQD (card)) +return qeth_iqd_select_queue (dev, skb, +qeth_l2_get_cast_type (skb), + sb_dev); +return qeth_get_priority_queue (card, skb); }static const struct device_type qeth_l2_devtype = {
drivers/s390/net/qeth_l3_main.c +10 -1
@@ -2084,7 +2084,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,else cast_type =RTN_UNICAST ; }else { - queue =qeth_get_tx_queue (card, skb, ipv); + queue = card->qdio.out_qs[txq]; cast_type =qeth_l3_get_cast_type (skb); }
@@ -2162,6 +2162,14 @@ static u16 qeth_l3_iqd_select_queue(struct net_device *dev, struct sk_buff *skb, sb_dev); } +static u16 qeth_l3_osa_select_queue (struct net_device *dev,struct sk_buff *skb, +struct net_device *sb_dev) +{ +struct qeth_card *card = dev->ml_priv; + +return qeth_get_priority_queue (card, skb); +} +static const struct net_device_ops qeth_l3_netdev_ops = { .ndo_open = qeth_open, .ndo_stop = qeth_stop,
@@ -2184,6 +2192,7 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = { .ndo_get_stats64 = qeth_get_stats64, .ndo_start_xmit = qeth_l3_hard_start_xmit, .ndo_features_check = qeth_l3_osa_features_check, + .ndo_select_queue = qeth_l3_osa_select_queue, .ndo_validate_addr = eth_validate_addr, .ndo_set_rx_mode = qeth_l3_set_rx_mode, .ndo_do_ioctl = qeth_do_ioctl,
Signature · 1 line
2.16.4
PATCH 7/8 s390/qeth: simplify QoS code
In reply to Julian Wiedmannqeth_get_priority_queue() is no longer used for IQD devices, remove the special-casing of their mcast queue.
This effectively reverts
commit 70deb01662b1 ("qeth: omit outbound queue 3 for unicast packets in Priority Queuing on HiperSockets").
--- drivers/s390/net/qeth_core_main.c | 23 +++++++---------------- drivers/s390/net/qeth_core_sys.c | 4 ---- 2 files changed, 7 insertions(+), 20 deletions(-)
drivers/s390/net/qeth_core_main.c +7 -16
@@ -3594,20 +3594,12 @@ static void qeth_qdio_output_handler(struct ccw_device *ccwdev,netif_wake_subqueue (dev, txq); } -/* We cannot use outbound queue 3 for unicast packets on HiperSockets */ -static inline int qeth_cut_iqd_prio (struct qeth_card *card,int queue_num) -{ -if ((card->info.type ==QETH_CARD_TYPE_IQD ) && (queue_num ==3 )) -return 2 ; -return queue_num; -} -/** * Note: Function assumes that we have 4 outbound queues. */ int qeth_get_priority_queue (struct qeth_card *card,struct sk_buff *skb) { -__be16 *tci; +struct vlan_ethhdr *veth =vlan_eth_hdr (skb);u8 tos;switch (card->qdio.do_prio_queueing) {
@@ -3624,9 +3616,9 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb)return card->qdio.default_out_queue; }if (card->qdio.do_prio_queueing ==QETH_PRIO_Q_ING_PREC ) -return qeth_cut_iqd_prio (card, ~tos >>6 &3 ); +return ~tos >>6 &3 ;if (tos &IPTOS_MINCOST ) -return qeth_cut_iqd_prio (card,3 ); +return 3 ;if (tos &IPTOS_RELIABILITY )return 2 ;if (tos &IPTOS_THROUGHPUT )
@@ -3637,12 +3629,11 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb)case QETH_PRIO_Q_ING_SKB :if (skb->priority >5 )return 0 ; -return qeth_cut_iqd_prio (card, ~skb->priority >>1 &3 ); +return ~skb->priority >>1 &3 ;case QETH_PRIO_Q_ING_VLAN : - tci = &((struct ethhdr *)skb->data)->h_proto; -if (be16_to_cpu (*tci) ==ETH_P_8021Q ) -return qeth_cut_iqd_prio (card, - ~be16_to_cpu (*(tci +1 )) >> (VLAN_PRIO_SHIFT +1 ) &3 ); +if (veth->h_vlan_proto ==htons (ETH_P_8021Q )) +return ~ntohs (veth->h_vlan_TCI) >> + (VLAN_PRIO_SHIFT +1 ) &3 ;break ;default :break ;
drivers/s390/net/qeth_core_sys.c +0 -4
@@ -242,10 +242,6 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev, card->qdio.do_prio_queueing =QETH_NO_PRIO_QUEUEING ; card->qdio.default_out_queue =2 ; }else if (sysfs_streq (buf,"no_prio_queueing:3" )) { -if (card->info.type ==QETH_CARD_TYPE_IQD ) { - rc = -EPERM ; - goto out; - } card->qdio.do_prio_queueing =QETH_NO_PRIO_QUEUEING ; card->qdio.default_out_queue =3 ; }else if (sysfs_streq (buf,"no_prio_queueing" )) {
Signature · 1 line
2.16.4
PATCH 8/8 s390/qeth: stop/wake TX queues based on their fill level
In reply to Julian WiedmannCurrent xmit code only stops the txq after attempting to fill an IO buffer that hasn't been TX-completed yet. In many-connection scenarios, this can result in frequent rejected TX attempts, requeuing of skbs with NETDEV_TX_BUSY and extra overhead.
Now that we have a proper 1-to-1 relation between stack-side txqs and our HW Queues, overhaul the stop/wake logic so that the xmit code stops the txq as needed.
Given that we might map multiple skbs into a single buffer, it's crucial to ensure that the queue always provides an _entirely_ empty IO buffer. Otherwise large skbs (eg TSO) might not fit into the last available buffer. So whenever qeth_do_send_packet() first utilizes an _empty_ buffer, it updates & checks the used_buffers count.
This now ensures that an skb passed to qeth_xmit() can always be mapped into an IO buffer, so remove all of the -EBUSY roll-back handling in the TX path. We preserve the minimal safety-checks ("Is this IO buffer really available?"), just in case some nasty future bug ever attempts to corrupt an in-use buffer.
--- drivers/s390/net/qeth_core.h | 6 +++ drivers/s390/net/qeth_core_main.c | 81 ++++++++++++++++++++++++++++----------- drivers/s390/net/qeth_ethtool.c | 1 + drivers/s390/net/qeth_l2_main.c | 13 ++----- drivers/s390/net/qeth_l3_main.c | 18 +-------- 5 files changed, 71 insertions(+), 48 deletions(-)
drivers/s390/net/qeth_core.h +6 -0
@@ -481,6 +481,7 @@ struct qeth_out_q_stats {u64 skbs_linearized_fail;u64 tso_bytes;u64 packing_mode_switch; +u64 stopped;/* rtnl_link_stats64 */ u64 tx_packets;
@@ -511,6 +512,11 @@ struct qeth_qdio_out_q {atomic_t set_pci_flags_count; }; +static inline bool qeth_out_queue_is_full (struct qeth_qdio_out_q *queue) +{ +return atomic_read (&queue->used_buffers) >=QDIO_MAX_BUFFERS_PER_Q ; +} +struct qeth_qdio_info {atomic_t state;/* input */
drivers/s390/net/qeth_core_main.c +59 -22
173 lines not on this page · raw message
drivers/s390/net/qeth_ethtool.c +1 -0
@@ -38,6 +38,7 @@ static const struct qeth_stats txq_stats[] = {QETH_TXQ_STAT ("linearized+error skbs" , skbs_linearized_fail),QETH_TXQ_STAT ("TSO bytes" , tso_bytes),QETH_TXQ_STAT ("Packing mode switches" , packing_mode_switch), + QETH_TXQ_STAT("Queue stopped", stopped), }; static const struct qeth_stats card_stats[] = {
drivers/s390/net/qeth_l2_main.c +3 -10
@@ -607,11 +607,8 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,int rc;if (IS_IQD (card)) - queue = card->qdio.out_qs[qeth_iqd_translate_txq (dev, txq)]; -else - queue = card->qdio.out_qs[txq]; - -netif_stop_subqueue (dev, txq); + txq =qeth_iqd_translate_txq (dev, txq); + queue = card->qdio.out_qs[txq];if (IS_OSN (card)) rc =qeth_l2_xmit_osn (card, skb, queue);
@@ -622,15 +619,11 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,if (!rc) {QETH_TXQ_STAT_INC (queue, tx_packets);QETH_TXQ_STAT_ADD (queue, tx_bytes, tx_bytes); -netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; - }else if (rc == -EBUSY ) { -return NETDEV_TX_BUSY ; - }/* else fall through */ + }QETH_TXQ_STAT_INC (queue, tx_dropped);kfree_skb (skb); -netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; }
drivers/s390/net/qeth_l3_main.c +2 -16
@@ -2036,7 +2036,6 @@ static void qeth_l3_fixup_headers(struct sk_buff *skb)static int qeth_l3_xmit (struct qeth_card *card,struct sk_buff *skb,struct qeth_qdio_out_q *queue,int ipv,int cast_type) { -unsigned char eth_hdr[ETH_HLEN ];unsigned int hw_hdr_len;int rc;
@@ -2046,17 +2045,10 @@ static int qeth_l3_xmit(struct qeth_card *card, struct sk_buff *skb, rc =skb_cow_head (skb, hw_hdr_len -ETH_HLEN );if (rc)return rc; -skb_copy_from_linear_data (skb, eth_hdr,ETH_HLEN );skb_pull (skb,ETH_HLEN );qeth_l3_fixup_headers (skb); - rc =qeth_xmit (card, skb, queue, ipv, cast_type, qeth_l3_fill_header); -if (rc == -EBUSY ) { -/* roll back to ETH header */ -skb_push (skb,ETH_HLEN ); -skb_copy_to_linear_data (skb, eth_hdr,ETH_HLEN ); - } -return rc; +return qeth_xmit (card, skb, queue, ipv, cast_type, qeth_l3_fill_header); } static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
@@ -2091,8 +2083,6 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,if (cast_type ==RTN_BROADCAST && !card->info.broadcast_capable) goto tx_drop; -netif_stop_subqueue (dev, txq); -if (ipv ==4 ||IS_IQD (card)) rc =qeth_l3_xmit (card, skb, queue, ipv, cast_type);else
@@ -2102,16 +2092,12 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,if (!rc) {QETH_TXQ_STAT_INC (queue, tx_packets);QETH_TXQ_STAT_ADD (queue, tx_bytes, tx_bytes); -netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; - }else if (rc == -EBUSY ) { -return NETDEV_TX_BUSY ; - }/* else fall through */ + } tx_drop:QETH_TXQ_STAT_INC (queue, tx_dropped);kfree_skb (skb); -netif_wake_subqueue (dev, txq);return NETDEV_TX_OK ; }
Signature · 1 line
2.16.4
David Miller
maintainerFrom: Julian Wiedmann <[email protected]>
Date: Wed, 17 Apr 2019 18:17:27 +0200
Quoted 2 lines
please apply some additional qeth patches to net-next. This patchset converts the driver to use the kernel's multiqueue model.
Series applied, thanks.