Commit 5ffcba41 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'smc-updates'



Wenjia Zhang says:

====================
net/smc: updates 2022-07-25

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.

v2: add "Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>"
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2f0f6b17 28ec53f3
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -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)
@@ -444,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;
@@ -457,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) {
+2 −2
Original line number Diff line number Diff line
@@ -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);
};

@@ -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 */
+1 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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);
+4 −15
Original line number Diff line number Diff line
@@ -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)
@@ -440,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,
@@ -519,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;
Loading