net/smc: updates 2022-07-25
Subsystems (5)
v2 cover net/smc: updates 2022-07-25
Hi Dave & Jakub,
please apply the following patches to netdev's net-next tree.
These patches do some preparation to make ISM available for uses beyond SMC-D, and a bunch of cleanups.
Thanks,
Wenjia
v2: add "Reviewed-by: Tony Lu <[email protected]>"
Heiko Carstens (1):
net/smc: Eliminate struct smc_ism_position
Stefan Raspl (3):
s390/ism: Cleanups
net/smc: Pass on DMBE bit mask in IRQ handler
net/smc: Enable module load on netlink usage
drivers/s390/net/ism_drv.c | 15 ++++++++------- include/net/smc.h | 4 ++-- net/smc/af_smc.c | 1 + net/smc/smc_diag.c | 1 + net/smc/smc_ism.c | 19 ++++--------------- net/smc/smc_ism.h | 20 +++++++++++--------- net/smc/smc_tx.c | 10 +++------- 7 files changed, 30 insertions(+), 40 deletions(-)
Signature · 1 line
2.35.2
PATCH v2 1/4 net/smc: Eliminate struct smc_ism_position
From: Heiko Carstens <[email protected]>
This struct is used in a single place only, and its usage generates inefficient code. Time to clean up!
--- net/smc/smc_ism.c | 11 ----------- net/smc/smc_ism.h | 20 +++++++++++--------- net/smc/smc_tx.c | 10 +++------- 3 files changed, 14 insertions(+), 27 deletions(-)
net/smc/smc_ism.c +0 -11
@@ -33,17 +33,6 @@ int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *smcd) vlan_id); } -int smc_ism_write (struct smcd_dev *smcd,const struct smc_ism_position *pos, -void *data,size_t len) -{ -int rc; - - rc = smcd->ops->move_data (smcd, pos->token, pos->index, pos->signal, - pos->offset, data, len); - -return rc <0 ? rc :0 ; -} -void smc_ism_get_system_eid (u8 **eid) {if (!smc_ism_v2_capable)
net/smc/smc_ism.h +11 -9
@@ -28,13 +28,6 @@ struct smc_ism_vlanid { /* VLAN id set on ISM device */refcount_t refcnt;/* Reference count */ }; -struct smc_ism_position {/* ISM device position to write to */ -u64 token;/* Token of DMB */ -u32 offset;/* Offset into DMBE */ -u8 index;/* Index of DMBE */ -u8 signal;/* Generate interrupt on owner side */ -}; -struct smcd_dev ;int smc_ism_cantalk (u64 peer_gid,unsigned short vlan_id,struct smcd_dev *dev);
@@ -45,12 +38,21 @@ int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id);int smc_ism_register_dmb (struct smc_link_group *lgr,int buf_size,struct smc_buf_desc *dmb_desc);int smc_ism_unregister_dmb (struct smcd_dev *dev,struct smc_buf_desc *dmb_desc); -int smc_ism_write (struct smcd_dev *dev,const struct smc_ism_position *pos, -void *data,size_t len);int smc_ism_signal_shutdown (struct smc_link_group *lgr);void smc_ism_get_system_eid (u8 **eid);u16 smc_ism_get_chid (struct smcd_dev *dev);bool smc_ism_is_v2_capable (void );void smc_ism_init (void );int smcd_nl_get_device (struct sk_buff *skb,struct netlink_callback *cb); + +static inline int smc_ism_write (struct smcd_dev *smcd,u64 dmb_tok, +unsigned int idx,bool sf,unsigned int offset, +void *data,size_t len) +{ +int rc; + + rc = smcd->ops->move_data (smcd, dmb_tok, idx, sf, offset, data, len); +return rc <0 ? rc :0 ; +} +#endif
net/smc/smc_tx.c +3 -7
@@ -320,15 +320,11 @@ int smc_tx_sendpage(struct smc_sock *smc, struct page *page, int offset,int smcd_tx_ism_write (struct smc_connection *conn,void *data,size_t len,u32 offset,int signal) { -struct smc_ism_position pos;int rc; -memset (&pos,0 ,sizeof (pos)); - pos.token = conn->peer_token; - pos.index = conn->peer_rmbe_idx; - pos.offset = conn->tx_off + offset; - pos.signal = signal; - rc =smc_ism_write (conn->lgr->smcd, &pos, data, len); + rc =smc_ism_write (conn->lgr->smcd, conn->peer_token, + conn->peer_rmbe_idx, signal, conn->tx_off + offset, + data, len);if (rc) conn->local_tx_ctrl.conn_state_flags.peer_conn_abort =1 ;return rc;
Signature · 1 line
2.35.2
PATCH v2 2/4 s390/ism: Cleanups
In reply to Wenjia ZhangFrom: Stefan Raspl <[email protected]>
Reworked signature of the function to retrieve the system EID: No plausible reason to use a double pointer. And neither to pass in the device as an argument, as this identifier is by definition per system, not per device. Plus some minor consistency edits.
--- drivers/s390/net/ism_drv.c | 11 +++++------ include/net/smc.h | 2 +- net/smc/smc_ism.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/s390/net/ism_drv.c +5 -6
@@ -409,20 +409,19 @@ static void ism_create_system_eid(void)memcpy (&SYSTEM_EID .type, tmp,4 ); } -static void ism_get_system_eid (struct smcd_dev *smcd,u8 **eid) +static u8 *ism_get_system_eid (void ) { - *eid = &SYSTEM_EID .seid_string[0 ]; +return SYSTEM_EID .seid_string; }static u16 ism_get_chid (struct smcd_dev *smcd) { -struct ism_dev *ismdev; +struct ism_dev *ism = (struct ism_dev *)smcd->priv; - ismdev = (struct ism_dev *)smcd->priv; -if (!ismdev || !ismdev->pdev) +if (!ism || !ism->pdev)return 0 ; -return to_zpci (ismdev->pdev)->pchid; +return to_zpci (ism->pdev)->pchid; }static void ism_handle_event (struct ism_dev *ism)
include/net/smc.h +1 -1
@@ -72,7 +72,7 @@ struct smcd_ops {int (*move_data)(struct smcd_dev *dev,u64 dmb_tok,unsigned int idx,bool sf,unsigned int offset,void *data,unsigned int size); -void (*get_system_eid)(struct smcd_dev *dev,u8 **eid); + u8* (*get_system_eid)(void);u16 (*get_chid)(struct smcd_dev *dev); };
net/smc/smc_ism.c +1 -1
@@ -429,7 +429,7 @@ int smcd_register_dev(struct smcd_dev *smcd)if (list_empty (&smcd_dev_list.list)) {u8 *system_eid =NULL ; - smcd->ops->get_system_eid (smcd, &system_eid); + system_eid = smcd->ops->get_system_eid ();if (system_eid[24 ] !='0' || system_eid[28 ] !='0' ) { smc_ism_v2_capable = true; memcpy(smc_ism_v2_system_eid, system_eid,
Signature · 1 line
2.35.2
PATCH v2 3/4 net/smc: Pass on DMBE bit mask in IRQ handler
In reply to Wenjia ZhangFrom: Stefan Raspl <[email protected]>
Make the DMBE bits, which are passed on individually in ism_move() as parameter idx, available to the receiver.
--- drivers/s390/net/ism_drv.c | 4 +++- include/net/smc.h | 2 +- net/smc/smc_ism.c | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/s390/net/ism_drv.c +3 -1
@@ -443,6 +443,7 @@ static irqreturn_t ism_handle_irq(int irq, void *data)struct ism_dev *ism = data;unsigned long bit, end;unsigned long *bv; +u16 dmbemask; bv = (void *) &ism->sba->dmb_bits[ISM_DMB_WORD_OFFSET ]; end =sizeof (ism->sba->dmb_bits) *BITS_PER_BYTE -ISM_DMB_BIT_OFFSET ;
@@ -456,9 +457,10 @@ static irqreturn_t ism_handle_irq(int irq, void *data)break ;clear_bit_inv (bit, bv); + dmbemask = ism->sba->dmbe_mask[bit +ISM_DMB_BIT_OFFSET ]; ism->sba->dmbe_mask[bit +ISM_DMB_BIT_OFFSET ] =0 ;barrier (); -smcd_handle_irq (ism->smcd, bit +ISM_DMB_BIT_OFFSET ); +smcd_handle_irq (ism->smcd, bit +ISM_DMB_BIT_OFFSET , dmbemask); }if (ism->sba->e) {
include/net/smc.h +1 -1
@@ -101,5 +101,5 @@ int smcd_register_dev(struct smcd_dev *smcd);void smcd_unregister_dev (struct smcd_dev *smcd);void smcd_free_dev (struct smcd_dev *smcd);void smcd_handle_event (struct smcd_dev *dev,struct smcd_event *event); -void smcd_handle_irq (struct smcd_dev *dev,unsigned int bit); +void smcd_handle_irq (struct smcd_dev *dev,unsigned int bit,u16 dmbemask);#endif /* _SMC_H */
net/smc/smc_ism.c +3 -3
@@ -508,13 +508,13 @@ void smcd_handle_event(struct smcd_dev *smcd, struct smcd_event *event)EXPORT_SYMBOL_GPL (smcd_handle_event);/* SMCD Device interrupt handler. Called from ISM device interrupt handler. -* Parameters are smcd device pointer and DMB number. Find the connection and -* schedule the tasklet for this connection. +* Parameters are smcd device pointer, DMB number, and the DMBE bitmask. +* Find the connection and schedule the tasklet for this connection. * * Context: * - Function called in IRQ context from ISM device driver IRQ handler. */ -void smcd_handle_irq (struct smcd_dev *smcd,unsigned int dmbno) +void smcd_handle_irq (struct smcd_dev *smcd,unsigned int dmbno,u16 dmbemask) {struct smc_connection *conn =NULL ;unsigned long flags;
Signature · 1 line
2.35.2
PATCH v2 4/4 net/smc: Enable module load on netlink usage
In reply to Wenjia ZhangFrom: Stefan Raspl <[email protected]>
Previously, the smc and smc_diag modules were automatically loaded as dependencies of the ism module whenever an ISM device was present. With the pending rework of the ISM API, the smc module will no longer automatically be loaded in presence of an ISM device. Usage of an AF_SMC socket will still trigger loading of the smc modules, but usage of a netlink socket will not.
This is addressed by setting the correct module aliases.
--- net/smc/af_smc.c | 1 + net/smc/smc_diag.c | 1 + 2 files changed, 2 insertions(+)
net/smc/af_smc.c +1 -0
@@ -3515,3 +3515,4 @@ MODULE_DESCRIPTION("smc socket address family");MODULE_LICENSE ("GPL" );MODULE_ALIAS_NETPROTO (PF_SMC );MODULE_ALIAS_TCP_ULP ("smc" ); +MODULE_ALIAS_GENL_FAMILY (SMC_GENL_FAMILY_NAME );
net/smc/smc_diag.c +1 -0
@@ -268,3 +268,4 @@ module_init(smc_diag_init);module_exit (smc_diag_exit);MODULE_LICENSE ("GPL" );MODULE_ALIAS_NET_PF_PROTO_TYPE (PF_NETLINK ,NETLINK_SOCK_DIAG ,43 /* AF_SMC */ ); +MODULE_ALIAS_GENL_FAMILY (SMCR_GENL_FAMILY_NAME );
Signature · 1 line
2.35.2
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 8 lines · On Tue, 26 Jul 2022 12:03:26 +0200 you wrote:
Hi Dave & Jakub,
please apply the following patches to netdev's net-next tree.
These patches do some preparation to make ISM available for uses beyond SMC-D, and a bunch of cleanups.
[...]
Here is the summary with links:
- [net-next,v2,1/4] net/smc: Eliminate struct smc_ism_position
https://git.kernel.org/netdev/net-next/c/eb481b02bd18 - [net-next,v2,2/4] s390/ism: Cleanups https://git.kernel.org/netdev/net-next/c/0a2f4f9893c8 - [net-next,v2,3/4] net/smc: Pass on DMBE bit mask in IRQ handler https://git.kernel.org/netdev/net-next/c/8b2fed8e2712 - [net-next,v2,4/4] net/smc: Enable module load on netlink usage https://git.kernel.org/netdev/net-next/c/28ec53f3a830
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html