s390/qeth: updates 2021-06-11
Subsystems (4)
cover s390/qeth: updates 2021-06-11
Hi Dave & Jakub,
please apply the following patch series for qeth to netdev's net-next tree.
This enables TX NAPI for those devices that didn't use it previously, so that we can eventually rip out the qdio layer's internal interrupt machinery.
Other than that it's just the normal mix of minor improvements and cleanups.
Thanks,
Julian
Alexandra Winter (1):
s390/qeth: Consider dependency on SWITCHDEV module
Julian Wiedmann (8):
s390/qeth: count TX completion interrupts s390/qeth: also use TX NAPI for non-IQD devices s390/qeth: unify the tracking of active cmds on ccw device s390/qeth: use ethtool_sprintf()
s390/qeth: consolidate completion of pending TX buffers s390/qeth: remove QAOB's pointer to its TX buffer s390/qeth: remove TX buffer's pointer to its queue s390/qeth: shrink TX buffer struct
arch/s390/include/asm/qdio.h | 4 +- drivers/s390/net/qeth_core.h | 42 ++-- drivers/s390/net/qeth_core_main.c | 349 ++++++++++++------------------ drivers/s390/net/qeth_ethtool.c | 7 +- drivers/s390/net/qeth_l2_main.c | 12 +- 5 files changed, 181 insertions(+), 233 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/9 s390/qeth: count TX completion interrupts
While the qdio layer already tracks the number of HW interrupts for a device, there's value in understanding how many of them have been raised due to our TX completion logic.
--- drivers/s390/net/qeth_core.h | 1 + drivers/s390/net/qeth_core_main.c | 4 +++- drivers/s390/net/qeth_ethtool.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/s390/net/qeth_core.h +1 -0
@@ -483,6 +483,7 @@ struct qeth_out_q_stats {u64 stopped;u64 doorbell;u64 coal_frames; +u64 completion_irq;u64 completion_yield;u64 completion_timer;
drivers/s390/net/qeth_core_main.c +3 -1
@@ -1400,8 +1400,10 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,int i;/* is PCI flag set on buffer? */ -if (buf->buffer->element[0 ].sflags &SBAL_SFLAGS0_PCI_REQ ) +if (buf->buffer->element[0 ].sflags &SBAL_SFLAGS0_PCI_REQ ) {atomic_dec (&queue->set_pci_flags_count); +QETH_TXQ_STAT_INC (queue, completion_irq); + }qeth_tx_complete_buf (buf, error, budget);
drivers/s390/net/qeth_ethtool.c +1 -0
@@ -41,6 +41,7 @@ static const struct qeth_stats txq_stats[] = {QETH_TXQ_STAT ("Queue stopped" , stopped),QETH_TXQ_STAT ("Doorbell" , doorbell),QETH_TXQ_STAT ("IRQ for frames" , coal_frames), +QETH_TXQ_STAT ("Completion IRQ" , completion_irq),QETH_TXQ_STAT ("Completion yield" , completion_yield), QETH_TXQ_STAT("Completion timer", completion_timer), };
Signature · 1 line
2.25.1
PATCH 2/9 s390/qeth: also use TX NAPI for non-IQD devices
In reply to Julian WiedmannSet scan_threshold = 0 to opt out from the qdio layer's internal tasklet & timer mechanism for TX completions, and replace it with the TX NAPI infrastructure that qeth already uses for IQD devices. This avoids the fragile logic in qdio_check_output_queue(), enables tighter integration and gives us more tuning options via ethtool in the future.
For now we continue to apply the same policy as the qdio layer:
scan for completions if 32 TX buffers are in use, or after 1 sec. A re-scan is done after 10 sec, but only if no TX interrupt is pending.
With scan_threshold = 0 we no longer get TX completion scans from within qdio_get_next_buffers(). So trigger these manually in qeth_poll() and in the RX path switch to the equivalent qdio_inspect_queue().
--- drivers/s390/net/qeth_core.h | 6 ++ drivers/s390/net/qeth_core_main.c | 148 +++++++++++++++--------------- 2 files changed, 79 insertions(+), 75 deletions(-)
drivers/s390/net/qeth_core.h +6 -0
@@ -527,6 +527,7 @@ struct qeth_qdio_out_q {unsigned int coalesce_usecs;unsigned int max_coalesced_frames; +unsigned int rescan_usecs; };#define qeth_for_each_output_queue (card, q, i) \
@@ -887,6 +888,11 @@ static inline bool qeth_card_hw_is_reachable(struct qeth_card *card)return card->state ==CARD_STATE_SOFTSETUP ; } +static inline bool qeth_use_tx_irqs (struct qeth_card *card) +{ +return !IS_IQD (card); +} +static inline void qeth_unlock_channel (struct qeth_card *card,struct qeth_channel *channel) {
drivers/s390/net/qeth_core_main.c +73 -75
257 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 3/9 s390/qeth: unify the tracking of active cmds on ccw device
In reply to Julian WiedmannWe have one field to track _whether_ a cmd is active on a ccw device ('irq_pending'), and one to track _which_ cmd it is ('active_cmd').
Get rid of the irq_pending field, by testing active_cmd for NULL.
--- drivers/s390/net/qeth_core.h | 14 +++++++------- drivers/s390/net/qeth_core_main.c | 12 ++++-------- 2 files changed, 11 insertions(+), 15 deletions(-)
drivers/s390/net/qeth_core.h +7 -7
@@ -614,7 +614,6 @@ struct qeth_channel {struct ccw_device *ccwdev;struct qeth_cmd_buffer *active_cmd;enum qeth_channel_states state; -atomic_t irq_pending; };struct qeth_reply {
@@ -664,11 +663,6 @@ static inline struct ccw1 *__ccw_from_cmd(struct qeth_cmd_buffer *iob)return (struct ccw1 *)(iob->data +ALIGN (iob->length,8 )); } -static inline bool qeth_trylock_channel (struct qeth_channel *channel) -{ -return atomic_cmpxchg (&channel->irq_pending,0 ,1 ) ==0 ; -} -/** * OSA card related definitions */
@@ -896,10 +890,16 @@ static inline bool qeth_use_tx_irqs(struct qeth_card *card)static inline void qeth_unlock_channel (struct qeth_card *card,struct qeth_channel *channel) { -atomic_set (&channel->irq_pending,0 ); +xchg (&channel->active_cmd,NULL );wake_up (&card->wait_q); } +static inline bool qeth_trylock_channel (struct qeth_channel *channel, +struct qeth_cmd_buffer *cmd) +{ +return cmpxchg (&channel->active_cmd,NULL , cmd) ==NULL ; +} +struct qeth_trap_id {__u16 lparnr;char vmname[8 ];
drivers/s390/net/qeth_core_main.c +4 -8
@@ -1268,7 +1268,6 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, iob = (struct qeth_cmd_buffer *) (addr_t )intparm; } - channel->active_cmd =NULL ;qeth_unlock_channel (card, channel); rc =qeth_check_irb_error (card, cdev, irb);
@@ -1715,11 +1714,10 @@ static int qeth_stop_channel(struct qeth_channel *channel) rc =ccw_device_set_offline (cdev);spin_lock_irq (get_ccwdev_lock (cdev)); -if (channel->active_cmd) { +if (channel->active_cmd)dev_err (&cdev->dev,"Stopped channel while cmd %px was still active\n" , channel->active_cmd); - channel->active_cmd =NULL ; - } + cdev->handler =NULL ;spin_unlock_irq (get_ccwdev_lock (cdev));
@@ -1732,7 +1730,7 @@ static int qeth_start_channel(struct qeth_channel *channel)int rc; channel->state =CH_STATE_DOWN ; -atomic_set (&channel->irq_pending,0 ); +xchg (&channel->active_cmd,NULL );spin_lock_irq (get_ccwdev_lock (cdev)); cdev->handler = qeth_irq;
@@ -2039,7 +2037,7 @@ static int qeth_send_control_data(struct qeth_card *card, reply->param = reply_param; timeout =wait_event_interruptible_timeout (card->wait_q, -qeth_trylock_channel (channel), +qeth_trylock_channel (channel, iob), timeout);if (timeout <=0 ) {qeth_put_cmd (iob);
@@ -2059,8 +2057,6 @@ static int qeth_send_control_data(struct qeth_card *card,spin_lock_irq (get_ccwdev_lock (channel->ccwdev)); rc =ccw_device_start_timeout (channel->ccwdev,__ccw_from_cmd (iob), (addr_t ) iob,0 ,0 , timeout); -if (!rc) - channel->active_cmd = iob;spin_unlock_irq (get_ccwdev_lock (channel->ccwdev));if (rc) { QETH_DBF_MESSAGE(2, "qeth_send_control_data on device %x: ccw_device_start rc = %i\n",
Signature · 1 line
2.25.1
PATCH 4/9 s390/qeth: use ethtool_sprintf()
In reply to Julian WiedmannUse a recently introduced helper to fill our ethtool stats strings.
--- drivers/s390/net/qeth_ethtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_ethtool.c +2 -4
@@ -80,10 +80,8 @@ static void qeth_add_stat_strings(u8 **data, const char *prefix, {unsigned int i; -for (i =0 ; i < size; i++) { -snprintf (*data,ETH_GSTRING_LEN ,"%s%s" , prefix, stats[i].name); - *data +=ETH_GSTRING_LEN ; - } +for (i =0 ; i < size; i++) +ethtool_sprintf (data,"%s%s" , prefix, stats[i].name); }static int qeth_get_sset_count (struct net_device *dev,int stringset)
Signature · 1 line
2.25.1
PATCH 5/9 s390/qeth: consolidate completion of pending TX buffers
In reply to Julian WiedmannWith commit 396c100472dd ("s390/qdio: let driver manage the QAOB") a pending TX buffer now has access to its associated QAOB during TX completion processing. We can thus reduce the amount of work & state propagation that needs to be done by qeth_qdio_handle_aob().
Move all this logic into the respective TX completion paths. Doing so even allows us to determine more precise TX_NOTIFY_* values via qeth_compute_cq_notification(aob->aorc, ...).
--- drivers/s390/net/qeth_core.h | 3 +- drivers/s390/net/qeth_core_main.c | 73 ++++++++++++------------------- 2 files changed, 29 insertions(+), 47 deletions(-)
drivers/s390/net/qeth_core.h +1 -2
@@ -422,8 +422,7 @@ enum qeth_qdio_out_buffer_state {/* Finished by the TX completion code: */ QETH_QDIO_BUF_NEED_QAOB ,/* Received QAOB notification on CQ: */ -QETH_QDIO_BUF_QAOB_OK , - QETH_QDIO_BUF_QAOB_ERROR, + QETH_QDIO_BUF_QAOB_DONE, }; struct qeth_qdio_out_buffer {
drivers/s390/net/qeth_core_main.c +28 -45
133 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 6/9 s390/qeth: remove QAOB's pointer to its TX buffer
In reply to Julian WiedmannMaintaining a pointer inside the aob's user-definable area is fragile and unnecessary. At this stage we only need it to overload the buffer's state field, and to access the buffer's TX queue.
The first part is easily solved by tracking the aob's state within the aob itself. This also feels much cleaner and self-contained. For enabling the access to the associated TX queue, we can store the queue's index in the aob.
--- arch/s390/include/asm/qdio.h | 4 +- drivers/s390/net/qeth_core.h | 17 +++-- drivers/s390/net/qeth_core_main.c | 118 ++++++++++-------------------- 3 files changed, 49 insertions(+), 90 deletions(-)
arch/s390/include/asm/qdio.h +1 -3
@@ -137,7 +137,6 @@ struct slibe {* @user0: user defineable value * @res4: reserved paramater * @user1: user defineable value -* @user2: user defineable value */ struct qaob {u64 res0[6 ];
@@ -152,8 +151,7 @@ struct qaob {u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER ];u64 user0;u64 res4[2 ]; -u64 user1; -u64 user2; +u8 user1[16 ]; } __attribute__ ((packed, aligned(256)));/**
drivers/s390/net/qeth_core.h +11 -6
@@ -417,12 +417,17 @@ enum qeth_qdio_out_buffer_state {QETH_QDIO_BUF_EMPTY ,/* Filled by driver; owned by hardware in order to be sent. */ QETH_QDIO_BUF_PRIMED, -/* Discovered by the TX completion code: */ -QETH_QDIO_BUF_PENDING , -/* Finished by the TX completion code: */ -QETH_QDIO_BUF_NEED_QAOB , -/* Received QAOB notification on CQ: */ - QETH_QDIO_BUF_QAOB_DONE, +}; + +enum qeth_qaob_state { +QETH_QAOB_ISSUED , +QETH_QAOB_PENDING , +QETH_QAOB_DONE , +}; + +struct qeth_qaob_priv1 { +unsigned int state; +u8 queue_no; }; struct qeth_qdio_out_buffer {
drivers/s390/net/qeth_core_main.c +37 -81
171 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 7/9 s390/qeth: remove TX buffer's pointer to its queue
In reply to Julian Wiedmannqeth_tx_complete_buf() is the only remaining user of buf->q, and the callers can easily provide this as a parameter instead.
--- drivers/s390/net/qeth_core.h | 1 - drivers/s390/net/qeth_core_main.c | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/s390/net/qeth_core.h +0 -1
@@ -439,7 +439,6 @@ struct qeth_qdio_out_buffer {struct sk_buff_head skb_list;int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER ]; -struct qeth_qdio_out_q *q;struct list_head list_entry;struct qaob *aob; };
drivers/s390/net/qeth_core_main.c +4 -5
@@ -1290,10 +1290,10 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *q, } } -static void qeth_tx_complete_buf (struct qeth_qdio_out_buffer *buf,bool error, +static void qeth_tx_complete_buf (struct qeth_qdio_out_q *queue, +struct qeth_qdio_out_buffer *buf,bool error,int budget) { -struct qeth_qdio_out_q *queue = buf->q;struct sk_buff *skb;/* Empty buffer? */
@@ -1342,7 +1342,7 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,QETH_TXQ_STAT_INC (queue, completion_irq); } -qeth_tx_complete_buf (buf, error, budget); +qeth_tx_complete_buf (queue, buf, error, budget);for (i =0 ; i < queue->max_elements; ++i) {void *data =phys_to_virt (buf->buffer->element[i].addr);
@@ -1386,7 +1386,7 @@ static void qeth_tx_complete_pending_bufs(struct qeth_card *card, notify = drain ?TX_NOTIFY_GENERALERROR :qeth_compute_cq_notification (aob->aorc,1 );qeth_notify_skbs (queue, buf, notify); -qeth_tx_complete_buf (buf, drain, budget); +qeth_tx_complete_buf (queue, buf, drain, budget); for (i = 0; i < aob->sb_count && i < queue->max_elements;
@@ -2530,7 +2530,6 @@ static int qeth_alloc_out_buf(struct qeth_qdio_out_q *q, unsigned int bidx, newbuf->buffer = q->qdio_bufs[bidx];skb_queue_head_init (&newbuf->skb_list);lockdep_set_class (&newbuf->skb_list.lock, &qdio_out_skb_queue_key); - newbuf->q = q;atomic_set (&newbuf->state,QETH_QDIO_BUF_EMPTY ); q->bufs[bidx] = newbuf;return 0 ;
Signature · 1 line
2.25.1
PATCH 8/9 s390/qeth: shrink TX buffer struct
In reply to Julian WiedmannConvert the large boolean array into a bitmap, this substantially reduces the struct's size. While at it also clarify the naming.
--- drivers/s390/net/qeth_core.h | 2 +- drivers/s390/net/qeth_core_main.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/s390/net/qeth_core.h +1 -1
@@ -437,7 +437,7 @@ struct qeth_qdio_out_buffer {unsigned int frames;unsigned int bytes;struct sk_buff_head skb_list; -int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER ]; +DECLARE_BITMAP (from_kmem_cache,QDIO_MAX_ELEMENTS_PER_BUFFER );struct list_head list_entry;struct qaob *aob;
drivers/s390/net/qeth_core_main.c +3 -4
@@ -1347,9 +1347,8 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,for (i =0 ; i < queue->max_elements; ++i) {void *data =phys_to_virt (buf->buffer->element[i].addr); -if (data && buf->is_header[i]) +if (__test_and_clear_bit (i, buf->from_kmem_cache) && data)kmem_cache_free (qeth_core_header_cache, data); - buf->is_header[i] =0 ; }qeth_scrub_qdio_buffer (buf->buffer, queue->max_elements);
@@ -1393,7 +1392,7 @@ static void qeth_tx_complete_pending_bufs(struct qeth_card *card, i++) {void *data =phys_to_virt (aob->sba[i]); -if (data && buf->is_header[i]) +if (test_bit (i, buf->from_kmem_cache) && data)kmem_cache_free (qeth_core_header_cache, data); }
@@ -4053,7 +4052,7 @@ static unsigned int qeth_fill_buffer(struct qeth_qdio_out_buffer *buf,/* HW header is allocated from cache: */ if ((void *)hdr != skb->data) - buf->is_header[element] =1 ; +__set_bit (element, buf->from_kmem_cache);/* HW header was pushed and is contiguous with linear part: */ else if (length >0 && !PAGE_ALIGNED (data) && (data == (char *)hdr + hd_len))
Signature · 1 line
2.25.1
PATCH 9/9 s390/qeth: Consider dependency on SWITCHDEV module
In reply to Julian WiedmannFrom: Alexandra Winter <[email protected]>
Without the SWITCHDEV module, the bridgeport attribute LEARNING_SYNC of the physical device (self) does not provide any functionality. Instead of calling the no-op stub version of the switchdev functions, fail the setting of the attribute with an appropriate message.
While at it, also add an error message for the 'not supported by HW' case.
--- drivers/s390/net/qeth_l2_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_l2_main.c +10 -2
@@ -805,8 +805,6 @@ static int qeth_l2_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,if (!netif_device_present (dev))return -ENODEV ; -if (!(priv->brport_hw_features)) -return -EOPNOTSUPP ;nlmsg_for_each_attr (attr, nlh,sizeof (struct ifinfomsg ), rem1) {if (nla_type (attr) ==IFLA_PROTINFO ) {
@@ -832,6 +830,16 @@ static int qeth_l2_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,return 0 ;if (!bp_tb[IFLA_BRPORT_LEARNING_SYNC ])return -EINVAL ; +if (!(priv->brport_hw_features &BR_LEARNING_SYNC )) { +NL_SET_ERR_MSG_ATTR (extack, bp_tb[IFLA_BRPORT_LEARNING_SYNC ], +"Operation not supported by HW" ); +return -EOPNOTSUPP ; + } +if (!IS_ENABLED (CONFIG_NET_SWITCHDEV )) { +NL_SET_ERR_MSG_ATTR (extack, bp_tb[IFLA_BRPORT_LEARNING_SYNC ], +"Requires NET_SWITCHDEV" ); +return -EOPNOTSUPP ; + } enable = !!nla_get_u8 (bp_tb[IFLA_BRPORT_LEARNING_SYNC ]);if (enable == !!(priv->brport_features &BR_LEARNING_SYNC ))
Signature · 1 line
2.25.1
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 9 lines · On Fri, 11 Jun 2021 09:33:32 +0200 you wrote:
Hi Dave & Jakub,
please apply the following patch series for qeth to netdev's net-next tree.
This enables TX NAPI for those devices that didn't use it previously, so that we can eventually rip out the qdio layer's internal interrupt machinery.
[...]
Here is the summary with links:
- [net-next,1/9] s390/qeth: count TX completion interrupts
https://git.kernel.org/netdev/net-next/c/e872d0c1249b - [net-next,2/9] s390/qeth: also use TX NAPI for non-IQD devices https://git.kernel.org/netdev/net-next/c/7a4b92e8e0de - [net-next,3/9] s390/qeth: unify the tracking of active cmds on ccw device https://git.kernel.org/netdev/net-next/c/3518ae76f2bb - [net-next,4/9] s390/qeth: use ethtool_sprintf() https://git.kernel.org/netdev/net-next/c/c0a0186630fb - [net-next,5/9] s390/qeth: consolidate completion of pending TX buffers https://git.kernel.org/netdev/net-next/c/f875d880f049 - [net-next,6/9] s390/qeth: remove QAOB's pointer to its TX buffer https://git.kernel.org/netdev/net-next/c/838e4cc80814 - [net-next,7/9] s390/qeth: remove TX buffer's pointer to its queue https://git.kernel.org/netdev/net-next/c/6b7ec41e574a - [net-next,8/9] s390/qeth: shrink TX buffer struct https://git.kernel.org/netdev/net-next/c/bb7032ddc947 - [net-next,9/9] s390/qeth: Consider dependency on SWITCHDEV module https://git.kernel.org/netdev/net-next/c/953fb4dc4f4a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html