Skip to content

Commit 1baedb1

Browse files
Stefan Raspldavem330
authored andcommitted
s390/ism: Introduce struct ism_dmb
Conceptually, a DMB is a structure that belongs to ISM devices. However, SMC currently 'owns' this structure. So future exploiters of ISM devices would be forced to include SMC headers to work - which is just weird. Therefore, we switch ISM to struct ism_dmb, introduce a new public header with the definition (will be populated with further API calls later on), and, add a thin wrapper to please SMC. Since structs smcd_dmb and ism_dmb are identical, we can simply convert between the two for now. Signed-off-by: Stefan Raspl <[email protected]> Signed-off-by: Jan Karcher <[email protected]> Signed-off-by: Wenjia Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 462502f commit 1baedb1

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

drivers/s390/net/ism.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/spinlock.h>
66
#include <linux/types.h>
77
#include <linux/pci.h>
8+
#include <linux/ism.h>
89
#include <net/smc.h>
910
#include <asm/pci_insn.h>
1011

drivers/s390/net/ism_drv.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ static int ism_query_rgid(struct smcd_dev *smcd, u64 rgid, u32 vid_valid,
215215
return ism_cmd(ism, &cmd);
216216
}
217217

218-
static void ism_free_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
218+
static void ism_free_dmb(struct ism_dev *ism, struct ism_dmb *dmb)
219219
{
220220
clear_bit(dmb->sba_idx, ism->sba_bitmap);
221221
dma_free_coherent(&ism->pdev->dev, dmb->dmb_len,
222222
dmb->cpu_addr, dmb->dma_addr);
223223
}
224224

225-
static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
225+
static int ism_alloc_dmb(struct ism_dev *ism, struct ism_dmb *dmb)
226226
{
227227
unsigned long bit;
228228

@@ -251,7 +251,7 @@ static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
251251
return dmb->cpu_addr ? 0 : -ENOMEM;
252252
}
253253

254-
static int ism_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
254+
static int ism_register_dmb(struct smcd_dev *smcd, struct ism_dmb *dmb)
255255
{
256256
struct ism_dev *ism = smcd->priv;
257257
union ism_reg_dmb cmd;
@@ -282,7 +282,12 @@ static int ism_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
282282
return ret;
283283
}
284284

285-
static int ism_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
285+
static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
286+
{
287+
return ism_register_dmb(smcd, (struct ism_dmb *)dmb);
288+
}
289+
290+
static int ism_unregister_dmb(struct smcd_dev *smcd, struct ism_dmb *dmb)
286291
{
287292
struct ism_dev *ism = smcd->priv;
288293
union ism_unreg_dmb cmd;
@@ -303,6 +308,11 @@ static int ism_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
303308
return ret;
304309
}
305310

311+
static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
312+
{
313+
return ism_unregister_dmb(smcd, (struct ism_dmb *)dmb);
314+
}
315+
306316
static int ism_add_vlan_id(struct smcd_dev *smcd, u64 vlan_id)
307317
{
308318
struct ism_dev *ism = smcd->priv;
@@ -475,8 +485,8 @@ static irqreturn_t ism_handle_irq(int irq, void *data)
475485

476486
static const struct smcd_ops ism_ops = {
477487
.query_remote_gid = ism_query_rgid,
478-
.register_dmb = ism_register_dmb,
479-
.unregister_dmb = ism_unregister_dmb,
488+
.register_dmb = smcd_register_dmb,
489+
.unregister_dmb = smcd_unregister_dmb,
480490
.add_vlan_id = ism_add_vlan_id,
481491
.del_vlan_id = ism_del_vlan_id,
482492
.set_vlan_required = ism_set_vlan_required,

include/linux/ism.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Internal Shared Memory
4+
*
5+
* Definitions for the ISM module
6+
*
7+
* Copyright IBM Corp. 2022
8+
*/
9+
#ifndef _ISM_H
10+
#define _ISM_H
11+
12+
struct ism_dmb {
13+
u64 dmb_tok;
14+
u64 rgid;
15+
u32 dmb_len;
16+
u32 sba_idx;
17+
u32 vlan_valid;
18+
u32 vlan_id;
19+
void *cpu_addr;
20+
dma_addr_t dma_addr;
21+
};
22+
23+
#endif /* _ISM_H */

0 commit comments

Comments
 (0)