* [PATCH trivial] IB/hfi1: Spelling s/statisfied/satisfied/
From: Geert Uytterhoeven @ 2019-06-17 14:01 UTC (permalink / raw)
To: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford,
Jason Gunthorpe, Jiri Kosina
Cc: linux-rdma, linux-kernel, Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/infiniband/hw/hfi1/tid_rdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
index 6fb93032fbefcb7e..24f30ff6b5fbc868 100644
--- a/drivers/infiniband/hw/hfi1/tid_rdma.c
+++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
@@ -477,7 +477,7 @@ static struct rvt_qp *first_qp(struct hfi1_ctxtdata *rcd,
* Must hold the qp s_lock and the exp_lock.
*
* Return:
- * false if either of the conditions below are statisfied:
+ * false if either of the conditions below are satisfied:
* 1. The list is empty or
* 2. The indicated qp is at the head of the list and the
* HFI1_S_WAIT_TID_SPACE bit is set in qp->s_flags.
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v17 03/15] arm64: Introduce prctl() options to control the tagged user addresses ABI
From: Catalin Marinas @ 2019-06-17 13:56 UTC (permalink / raw)
To: Andrey Konovalov
Cc: linux-arm-kernel, linux-mm, linux-kernel, amd-gfx, dri-devel,
linux-rdma, linux-media, kvm, linux-kselftest, Vincenzo Frascino,
Will Deacon, Mark Rutland, Andrew Morton, Greg Kroah-Hartman,
Kees Cook, Yishai Hadas, Felix Kuehling, Alexander Deucher,
Christian Koenig, Mauro Carvalho Chehab, Jens Wiklander
In-Reply-To: <a7a2933bea5fe57e504891b7eec7e9432e5e1c1a.1560339705.git.andreyknvl@google.com>
On Wed, Jun 12, 2019 at 01:43:20PM +0200, Andrey Konovalov wrote:
> From: Catalin Marinas <catalin.marinas@arm.com>
>
> It is not desirable to relax the ABI to allow tagged user addresses into
> the kernel indiscriminately. This patch introduces a prctl() interface
> for enabling or disabling the tagged ABI with a global sysctl control
> for preventing applications from enabling the relaxed ABI (meant for
> testing user-space prctl() return error checking without reconfiguring
> the kernel). The ABI properties are inherited by threads of the same
> application and fork()'ed children but cleared on execve().
>
> The PR_SET_TAGGED_ADDR_CTRL will be expanded in the future to handle
> MTE-specific settings like imprecise vs precise exceptions.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
A question for the user-space folk: if an application opts in to this
ABI, would you want the sigcontext.fault_address and/or siginfo.si_addr
to contain the tag? We currently clear it early in the arm64 entry.S but
we could find a way to pass it down if needed.
--
Catalin
^ permalink raw reply
* Re: [PATCH 12/16] staging/comedi: mark as broken
From: Ian Abbott @ 2019-06-17 13:15 UTC (permalink / raw)
To: Christoph Hellwig, Greg KH
Cc: Maxime Ripard, Joonas Lahtinen, dri-devel, linux-mm, devel,
linux-s390, linux-rdma, David Airlie, linux-media,
Intel Linux Wireless, intel-gfx, Maarten Lankhorst, Jani Nikula,
Rodrigo Vivi, Sean Paul, moderated list:ARM PORT, netdev,
linux-wireless, linux-kernel, H Hartley Sweeten, iommu,
Daniel Vetter
In-Reply-To: <20190614153428.GA10008@lst.de>
On 14/06/2019 16:34, Christoph Hellwig wrote:
> On Fri, Jun 14, 2019 at 05:30:32PM +0200, Greg KH wrote:
>> On Fri, Jun 14, 2019 at 04:48:57PM +0200, Christoph Hellwig wrote:
>>> On Fri, Jun 14, 2019 at 04:02:39PM +0200, Greg KH wrote:
>>>> Perhaps a hint as to how we can fix this up? This is the first time
>>>> I've heard of the comedi code not handling dma properly.
>>>
>>> It can be fixed by:
>>>
>>> a) never calling virt_to_page (or vmalloc_to_page for that matter)
>>> on dma allocation
>>> b) never remapping dma allocation with conflicting cache modes
>>> (no remapping should be doable after a) anyway).
>>
>> Ok, fair enough, have any pointers of drivers/core code that does this
>> correctly? I can put it on my todo list, but might take a week or so...
>
> Just about everyone else. They just need to remove the vmap and
> either do one large allocation, or live with the fact that they need
> helpers to access multiple array elements instead of one net vmap,
> which most of the users already seem to do anyway, with just a few
> using the vmap (which might explain why we didn't see blowups yet).
Avoiding the vmap in comedi should be do-able as it already has other
means to get at the buffer pages.
When comedi makes the buffer from DMA coherent memory, it currently
allocates it as a series of page-sized chunks. That cannot be mmap'ed
in one go with dma_mmap_coherent(), so I see the following solutions.
1. Change the buffer allocation to allocate a single chunk of DMA
coherent memory and use dma_mmap_coherent() to mmap it.
2. Call dma_mmap_coherent() in a loop, adjusting vma->vm_start and
vma->vm_end for each iteration (vma->vm_pgoff will be 0), and restoring
the vma->vm_start and vma->vm_end at the end.
I'm not sure if 2 is a legal option.
--
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268. Registered address: )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
^ permalink raw reply
* [PATCH 8/8] megaraid_sas: set an unlimited max_segment_size
From: Christoph Hellwig @ 2019-06-17 12:20 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
When using a virt_boundary_mask, as done for NVMe devices attached to
megaraid_sas controllers we require an unlimited max_segment_size, as
the virt boundary merging code assumes that. But we also need to
propagate that to the DMA mapping layer to make dma-debug happy. The
SCSI layer takes care of that when using the per-host virt_boundary
setting, but given that megaraid_sas only wants to set the virt_boundary
for actual NVMe devices we can't rely on that. The DMA layer maximum
segment is global to the HBA however, so we have to set it explicitly.
This patch assumes that megaraid_sas does not have a segment size
limitation, which seems true based on the SGL format, but will need
to be verified.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/megaraid/megaraid_sas_base.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 3dd1df472dc6..59f709dbbab9 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3207,6 +3207,7 @@ static struct scsi_host_template megasas_template = {
.shost_attrs = megaraid_host_attrs,
.bios_param = megasas_bios_param,
.change_queue_depth = scsi_change_queue_depth,
+ .max_segment_size = 0xffffffff,
.no_write_same = 1,
};
--
2.20.1
^ permalink raw reply related
* [PATCH 7/8] mpt3sas: set an unlimited max_segment_size for SAS 3.0 HBAs
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
When using a virt_boundary_mask, as done for NVMe devices attached to
mpt3sas controllers we require an unlimited max_segment_size, as the
virt boundary merging code assumes that. But we also need to propagate
that to the DMA mapping layer to make dma-debug happy. The SCSI layer
takes care of that when using the per-host virt_boundary setting, but
given that mpt3sas only wants to set the virt_boundary for actual
NVMe devices we can't rely on that. The DMA layer maximum segment
is global to the HBA however, so we have to set it explicitly. This
patch assumes that mpt3sas does not have a segment size limitation,
which seems true based on the SGL format, but will need to be verified.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 1ccfbc7eebe0..c719b807f6d8 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10222,6 +10222,7 @@ static struct scsi_host_template mpt3sas_driver_template = {
.this_id = -1,
.sg_tablesize = MPT3SAS_SG_DEPTH,
.max_sectors = 32767,
+ .max_segment_size = 0xffffffff,
.cmd_per_lun = 7,
.shost_attrs = mpt3sas_host_attrs,
.sdev_attrs = mpt3sas_dev_attrs,
--
2.20.1
^ permalink raw reply related
* [PATCH 6/8] IB/srp: set virt_boundary_mask in the scsi host
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
This ensures all proper DMA layer handling is taken care of by the
SCSI midlayer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/infiniband/ulp/srp/ib_srp.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 4305da2c9037..b3a4ebd85046 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3063,20 +3063,6 @@ static int srp_target_alloc(struct scsi_target *starget)
return 0;
}
-static int srp_slave_alloc(struct scsi_device *sdev)
-{
- struct Scsi_Host *shost = sdev->host;
- struct srp_target_port *target = host_to_target(shost);
- struct srp_device *srp_dev = target->srp_host->srp_dev;
- struct ib_device *ibdev = srp_dev->dev;
-
- if (!(ibdev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
- blk_queue_virt_boundary(sdev->request_queue,
- ~srp_dev->mr_page_mask);
-
- return 0;
-}
-
static int srp_slave_configure(struct scsi_device *sdev)
{
struct Scsi_Host *shost = sdev->host;
@@ -3279,7 +3265,6 @@ static struct scsi_host_template srp_template = {
.name = "InfiniBand SRP initiator",
.proc_name = DRV_NAME,
.target_alloc = srp_target_alloc,
- .slave_alloc = srp_slave_alloc,
.slave_configure = srp_slave_configure,
.info = srp_target_info,
.queuecommand = srp_queuecommand,
@@ -3814,6 +3799,9 @@ static ssize_t srp_create_target(struct device *dev,
target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
+ if (!(ibdev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
+ target_host->virt_boundary_mask = ~srp_dev->mr_page_mask;
+
target = host_to_target(target_host);
target->net = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
--
2.20.1
^ permalink raw reply related
* [PATCH 5/8] IB/iser: set virt_boundary_mask in the scsi host
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
This ensures all proper DMA layer handling is taken care of by the
SCSI midlayer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/infiniband/ulp/iser/iscsi_iser.c | 35 +++++-------------------
1 file changed, 7 insertions(+), 28 deletions(-)
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 9c185a8dabd3..841b66397a57 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -613,6 +613,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
struct Scsi_Host *shost;
struct iser_conn *iser_conn = NULL;
struct ib_conn *ib_conn;
+ struct ib_device *ib_dev;
u32 max_fr_sectors;
shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0);
@@ -643,16 +644,19 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
}
ib_conn = &iser_conn->ib_conn;
+ ib_dev = ib_conn->device->ib_device;
if (ib_conn->pi_support) {
- u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap;
+ u32 sig_caps = ib_dev->attrs.sig_prot_cap;
scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps));
scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP |
SHOST_DIX_GUARD_CRC);
}
- if (iscsi_host_add(shost,
- ib_conn->device->ib_device->dev.parent)) {
+ if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
+ shost->virt_boundary_mask = ~MASK_4K;
+
+ if (iscsi_host_add(shost, ib_dev->dev.parent)) {
mutex_unlock(&iser_conn->state_mutex);
goto free_host;
}
@@ -958,30 +962,6 @@ static umode_t iser_attr_is_visible(int param_type, int param)
return 0;
}
-static int iscsi_iser_slave_alloc(struct scsi_device *sdev)
-{
- struct iscsi_session *session;
- struct iser_conn *iser_conn;
- struct ib_device *ib_dev;
-
- mutex_lock(&unbind_iser_conn_mutex);
-
- session = starget_to_session(scsi_target(sdev))->dd_data;
- iser_conn = session->leadconn->dd_data;
- if (!iser_conn) {
- mutex_unlock(&unbind_iser_conn_mutex);
- return -ENOTCONN;
- }
- ib_dev = iser_conn->ib_conn.device->ib_device;
-
- if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
- blk_queue_virt_boundary(sdev->request_queue, ~MASK_4K);
-
- mutex_unlock(&unbind_iser_conn_mutex);
-
- return 0;
-}
-
static struct scsi_host_template iscsi_iser_sht = {
.module = THIS_MODULE,
.name = "iSCSI Initiator over iSER",
@@ -994,7 +974,6 @@ static struct scsi_host_template iscsi_iser_sht = {
.eh_device_reset_handler= iscsi_eh_device_reset,
.eh_target_reset_handler = iscsi_eh_recover_target,
.target_alloc = iscsi_target_alloc,
- .slave_alloc = iscsi_iser_slave_alloc,
.proc_name = "iscsi_iser",
.this_id = -1,
.track_queue_depth = 1,
--
2.20.1
^ permalink raw reply related
* [PATCH 4/8] storvsc: set virt_boundary_mask in the scsi host template
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
This ensures all proper DMA layer handling is taken care of by the
SCSI midlayer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/storvsc_drv.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index b89269120a2d..7ed6f2fc1446 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1422,9 +1422,6 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
{
blk_queue_rq_timeout(sdevice->request_queue, (storvsc_timeout * HZ));
- /* Ensure there are no gaps in presented sgls */
- blk_queue_virt_boundary(sdevice->request_queue, PAGE_SIZE - 1);
-
sdevice->no_write_same = 1;
/*
@@ -1697,6 +1694,8 @@ static struct scsi_host_template scsi_driver = {
.this_id = -1,
/* Make sure we dont get a sg segment crosses a page boundary */
.dma_boundary = PAGE_SIZE-1,
+ /* Ensure there are no gaps in presented sgls */
+ .virt_boundary_mask = PAGE_SIZE-1,
.no_write_same = 1,
.track_queue_depth = 1,
};
--
2.20.1
^ permalink raw reply related
* [PATCH 3/8] ufshcd: set max_segment_size in the scsi host template
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
We need to also mirror the value to the device to ensure IOMMU merging
doesn't undo it, and the SCSI host level parameter will ensure that.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/ufs/ufshcd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 3fe3029617a8..505d625ed28d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4587,8 +4587,6 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
struct request_queue *q = sdev->request_queue;
blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
- blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
-
return 0;
}
@@ -6991,6 +6989,7 @@ static struct scsi_host_template ufshcd_driver_template = {
.sg_tablesize = SG_ALL,
.cmd_per_lun = UFSHCD_CMD_PER_LUN,
.can_queue = UFSHCD_CAN_QUEUE,
+ .max_segment_size = PRDT_DATA_BYTE_COUNT_MAX,
.max_host_blocked = 1,
.track_queue_depth = 1,
.sdev_groups = ufshcd_driver_groups,
--
2.20.1
^ permalink raw reply related
* [PATCH 2/8] scsi: take the DMA max mapping size into account
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
We need to limit the devices max_sectors to what the DMA mapping
implementation can support. If not we risk running out of swiotlb
buffers easily.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/scsi_lib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index d333bb6b1c59..f233bfd84cd7 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1768,6 +1768,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
blk_queue_max_integrity_segments(q, shost->sg_prot_tablesize);
}
+ shost->max_sectors = min_t(unsigned int, shost->max_sectors,
+ dma_max_mapping_size(dev) << SECTOR_SHIFT);
blk_queue_max_hw_sectors(q, shost->max_sectors);
if (shost->unchecked_isa_dma)
blk_queue_bounce_limit(q, BLK_BOUNCE_ISA);
--
2.20.1
^ permalink raw reply related
* [PATCH 1/8] scsi: add a host / host template field for the virt boundary
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
This allows drivers setting it up easily instead of branching out to
block layer calls in slave_alloc, and ensures the upgraded
max_segment_size setting gets picked up by the DMA layer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/hosts.c | 3 +++
drivers/scsi/scsi_lib.c | 3 ++-
include/scsi/scsi_host.h | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index ff0d8c6a8d0c..55522b7162d3 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -462,6 +462,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
else
shost->dma_boundary = 0xffffffff;
+ if (sht->virt_boundary_mask)
+ shost->virt_boundary_mask = sht->virt_boundary_mask;
+
device_initialize(&shost->shost_gendev);
dev_set_name(&shost->shost_gendev, "host%d", shost->host_no);
shost->shost_gendev.bus = &scsi_bus_type;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 65d0a10c76ad..d333bb6b1c59 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1775,7 +1775,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
dma_set_seg_boundary(dev, shost->dma_boundary);
blk_queue_max_segment_size(q, shost->max_segment_size);
- dma_set_max_seg_size(dev, shost->max_segment_size);
+ blk_queue_virt_boundary(q, shost->virt_boundary_mask);
+ dma_set_max_seg_size(dev, queue_max_segment_size(q));
/*
* Set a reasonable default alignment: The larger of 32-byte (dword),
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index a5fcdad4a03e..cc139dbd71e5 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -369,6 +369,8 @@ struct scsi_host_template {
*/
unsigned long dma_boundary;
+ unsigned long virt_boundary_mask;
+
/*
* This specifies "machine infinity" for host templates which don't
* limit the transfer size. Note this limit represents an absolute
@@ -587,6 +589,7 @@ struct Scsi_Host {
unsigned int max_sectors;
unsigned int max_segment_size;
unsigned long dma_boundary;
+ unsigned long virt_boundary_mask;
/*
* In scsi-mq mode, the number of hardware queues supported by the LLD.
*
--
2.20.1
^ permalink raw reply related
* properly communicate queue limits to the DMA layer v2
From: Christoph Hellwig @ 2019-06-17 12:19 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Sagi Grimberg, Max Gurtovoy, Bart Van Assche, linux-rdma,
linux-scsi, megaraidlinux.pdl, MPT-FusionLinux.pdl, linux-hyperv,
linux-kernel
Hi Martin,
we've always had a bit of a problem communicating the block layer
queue limits to the DMA layer, which needs to respect them when
an IOMMU that could merge segments is used. Unfortunately most
drivers don't get this right. Oddly enough we've been mostly
getting away with it, although lately dma-debug has been catching
a few of those issues.
The segment merging fix for devices with PRP-like structures seems
to have escalated this a bit. The first patch fixes the actual
report from Sebastian, while the rest fix every drivers that appears
to have the problem based on a code audit looking for drivers using
blk_queue_max_segment_size, blk_queue_segment_boundary or
blk_queue_virt_boundary and calling dma_map_sg eventually.
For SCSI drivers I've taken the blk_queue_virt_boundary setting
to the SCSI core, similar to how we did it for the other two settings
a while ago. This also deals with the fact that the DMA layer
settings are on a per-device granularity, so the per-device settings
in a few SCSI drivers can't actually work in an IOMMU environment.
It would be nice to eventually pass these limits as arguments to
dma_map_sg, but that is a far too big series for the 5.2 merge
window.
Changes since v1:
- dropped block layer parts merged by Jens
- dropped the usb-storage / uas changes, as the virt_boundary usage
there will be dropped soon
- reworked the mpt3sas / megaraid_sas changes to keep per-device
settings
^ permalink raw reply
* [PATCH] net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create
From: Arnd Bergmann @ 2019-06-17 11:08 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, David S. Miller
Cc: Arnd Bergmann, Oz Shlomo, Paul Blakey, Eli Britstein, Mark Bloch,
Or Gerlitz, Maor Gottlieb, netdev, linux-rdma, linux-kernel
Putting an empty 'mlx5_flow_spec' structure on the stack is a bit
wasteful and causes a warning on 32-bit architectures when building
with clang -fsanitize-coverage:
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c: In function 'mlx5_eswitch_termtbl_create':
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c:90:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Since the structure is never written to, we can statically allocate
it to avoid the stack usage. To be on the safe side, mark all
subsequent function arguments that we pass it into as 'const'
as well.
Fixes: 10caabdaad5a ("net/mlx5e: Use termination table for VLAN push actions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
.../mlx5/core/eswitch_offloads_termtbl.c | 2 +-
.../net/ethernet/mellanox/mlx5/core/fs_core.c | 20 +++++++++----------
include/linux/mlx5/fs.h | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
index cb7d8ebe2c95..171f3d4ef9ac 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
@@ -50,7 +50,7 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev,
struct mlx5_flow_act *flow_act)
{
struct mlx5_flow_namespace *root_ns;
- struct mlx5_flow_spec spec = {};
+ static const struct mlx5_flow_spec spec = {};
int prio, flags;
int err;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index fe76c6fd6d80..739123e1363b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -584,7 +584,7 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)
}
static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft,
- u32 *match_value,
+ const u32 *match_value,
struct mlx5_flow_act *flow_act)
{
struct mlx5_flow_steering *steering = get_steering(&ft->node);
@@ -612,7 +612,7 @@ static void dealloc_flow_group(struct mlx5_flow_steering *steering,
static struct mlx5_flow_group *alloc_flow_group(struct mlx5_flow_steering *steering,
u8 match_criteria_enable,
- void *match_criteria,
+ const void *match_criteria,
int start_index,
int end_index)
{
@@ -642,7 +642,7 @@ static struct mlx5_flow_group *alloc_flow_group(struct mlx5_flow_steering *steer
static struct mlx5_flow_group *alloc_insert_flow_group(struct mlx5_flow_table *ft,
u8 match_criteria_enable,
- void *match_criteria,
+ const void *match_criteria,
int start_index,
int end_index,
struct list_head *prev)
@@ -1285,7 +1285,7 @@ add_rule_fte(struct fs_fte *fte,
}
static struct mlx5_flow_group *alloc_auto_flow_group(struct mlx5_flow_table *ft,
- struct mlx5_flow_spec *spec)
+ const struct mlx5_flow_spec *spec)
{
struct list_head *prev = &ft->node.children;
struct mlx5_flow_group *fg;
@@ -1451,7 +1451,7 @@ static int check_conflicting_ftes(struct fs_fte *fte, const struct mlx5_flow_act
}
static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
- u32 *match_value,
+ const u32 *match_value,
struct mlx5_flow_act *flow_act,
struct mlx5_flow_destination *dest,
int dest_num,
@@ -1536,7 +1536,7 @@ static void free_match_list(struct match_list_head *head)
static int build_match_list(struct match_list_head *match_head,
struct mlx5_flow_table *ft,
- struct mlx5_flow_spec *spec)
+ const struct mlx5_flow_spec *spec)
{
struct rhlist_head *tmp, *list;
struct mlx5_flow_group *g;
@@ -1589,7 +1589,7 @@ static u64 matched_fgs_get_version(struct list_head *match_head)
static struct fs_fte *
lookup_fte_locked(struct mlx5_flow_group *g,
- u32 *match_value,
+ const u32 *match_value,
bool take_write)
{
struct fs_fte *fte_tmp;
@@ -1622,7 +1622,7 @@ lookup_fte_locked(struct mlx5_flow_group *g,
static struct mlx5_flow_handle *
try_add_to_existing_fg(struct mlx5_flow_table *ft,
struct list_head *match_head,
- struct mlx5_flow_spec *spec,
+ const struct mlx5_flow_spec *spec,
struct mlx5_flow_act *flow_act,
struct mlx5_flow_destination *dest,
int dest_num,
@@ -1715,7 +1715,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
static struct mlx5_flow_handle *
_mlx5_add_flow_rules(struct mlx5_flow_table *ft,
- struct mlx5_flow_spec *spec,
+ const struct mlx5_flow_spec *spec,
struct mlx5_flow_act *flow_act,
struct mlx5_flow_destination *dest,
int dest_num)
@@ -1823,7 +1823,7 @@ static bool fwd_next_prio_supported(struct mlx5_flow_table *ft)
struct mlx5_flow_handle *
mlx5_add_flow_rules(struct mlx5_flow_table *ft,
- struct mlx5_flow_spec *spec,
+ const struct mlx5_flow_spec *spec,
struct mlx5_flow_act *flow_act,
struct mlx5_flow_destination *dest,
int num_dest)
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 2ddaa97f2179..c0c029664527 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -200,7 +200,7 @@ struct mlx5_flow_act {
*/
struct mlx5_flow_handle *
mlx5_add_flow_rules(struct mlx5_flow_table *ft,
- struct mlx5_flow_spec *spec,
+ const struct mlx5_flow_spec *spec,
struct mlx5_flow_act *flow_act,
struct mlx5_flow_destination *dest,
int num_dest);
--
2.20.0
^ permalink raw reply related
* RE: [PATCH 10/13] megaraid_sas: set virt_boundary_mask in the scsi host
From: Kashyap Desai @ 2019-06-17 9:10 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Sebastian Ott, Sagi Grimberg, Max Gurtovoy,
Bart Van Assche, Ulf Hansson, Alan Stern, Oliver Neukum,
linux-block, linux-rdma, linux-mmc, linux-nvme, linux-scsi,
PDL,MEGARAIDLINUX, PDL-MPT-FUSIONLINUX, linux-hyperv, linux-usb,
usb-storage, linux-kernel
In-Reply-To: <20190617084433.GA7969@lst.de>
>
> On Fri, Jun 14, 2019 at 01:28:47AM +0530, Kashyap Desai wrote:
> > Is there any changes in API blk_queue_virt_boundary? I could not find
> > relevant code which account for this. Can you help ?
> > Which git repo shall I use for testing ? That way I can confirm, I
> > didn't miss relevant changes.
>
> Latest mainline plus the series (which is about to get resent).
> blk_queue_virt_boundary now forced an unlimited max_hw_sectors as that
is
> how PRP-like schemes work, to work around a block driver merging bug.
But
> we also need to communicate that limit to the DMA layer so that we don't
set
> a smaller iommu segment size limitation.
>
> > >From your above explanation, it means (after this patch) max segment
> > >size
> > of the MR controller will be set to 4K.
> > Earlier it is possible to receive single SGE of 64K datalength (Since
> > max seg size was 64K), but now the same buffer will reach the driver
> > having 16 SGEs (Each SGE will contain 4K length).
>
> No, there is no more limit for the size of the segment at all, as for
PRPs each
> PRP is sort of a segment from the hardware perspective.
> We just require the segments to not have gaps, as PRPs don't allow for
that.
Thanks for clarification. I have also observed that max_segment_size Is
unchanged and it is 64K.
>
> That being said I think these patches are wrong for the case of megaraid
or
> mpt having both NVMe and SAS/ATA devices behind a single controller.
> Is that a valid configuration?
Yes. This is a valid configuration.
^ permalink raw reply
* [PATCH net-next v4 2/2] ipoib: show VF broadcast address
From: Denis Kirjanov @ 2019-06-17 8:53 UTC (permalink / raw)
To: davem, dledford; +Cc: netdev, linux-rdma, mkubecek, Denis Kirjanov
In-Reply-To: <20190617085341.51592-1-dkirjanov@suse.com>
in IPoIB case we can't see a VF broadcast address for but
can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof
checking off, link-state disable, trust off, query_rss off
v1->v2: add the IFLA_VF_BROADCAST constant
v2->v3: put IFLA_VF_BROADCAST at the end
to avoid KABI breakage and set NLA_REJECT
dev_setlink
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
include/uapi/linux/if_link.h | 5 +++++
net/core/rtnetlink.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5b225ff63b48..6f75bda2c2d7 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -694,6 +694,7 @@ enum {
IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */
IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */
IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */
+ IFLA_VF_BROADCAST, /* VF broadcast */
__IFLA_VF_MAX,
};
@@ -704,6 +705,10 @@ struct ifla_vf_mac {
__u8 mac[32]; /* MAX_ADDR_LEN */
};
+struct ifla_vf_broadcast {
+ __u8 broadcast[32];
+};
+
struct ifla_vf_vlan {
__u32 vf;
__u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index cec60583931f..8ac81630ab5c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
size += num_vfs *
(nla_total_size(0) +
nla_total_size(sizeof(struct ifla_vf_mac)) +
+ nla_total_size(sizeof(struct ifla_vf_broadcast)) +
nla_total_size(sizeof(struct ifla_vf_vlan)) +
nla_total_size(0) + /* nest IFLA_VF_VLAN_LIST */
nla_total_size(MAX_VLAN_LIST_LEN *
@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
struct ifla_vf_vlan vf_vlan;
struct ifla_vf_rate vf_rate;
struct ifla_vf_mac vf_mac;
+ struct ifla_vf_broadcast vf_broadcast;
struct ifla_vf_info ivi;
memset(&ivi, 0, sizeof(ivi));
@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
vf_trust.vf = ivi.vf;
memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac));
+ memcpy(vf_broadcast.broadcast, dev->broadcast, dev->addr_len);
vf_vlan.vlan = ivi.vlan;
vf_vlan.qos = ivi.qos;
vf_vlan_info.vlan = ivi.vlan;
@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
if (!vf)
goto nla_put_vfinfo_failure;
if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) ||
+ nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) ||
nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) ||
nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate),
&vf_rate) ||
@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
[IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) },
+ [IFLA_VF_BROADCAST] = { .type = NLA_REJECT },
[IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) },
[IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED },
[IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },
--
2.12.3
^ permalink raw reply related
* [PATCH net-next v4 1/2] ipoib: correcly show a VF hardware address
From: Denis Kirjanov @ 2019-06-17 8:53 UTC (permalink / raw)
To: davem, dledford; +Cc: netdev, linux-rdma, mkubecek, Denis Kirjanov
In-Reply-To: <20190617085341.51592-1-dkirjanov@suse.com>
in the case of IPoIB with SRIOV enabled hardware
ip link show command incorrecly prints
0 instead of a VF hardware address.
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof
checking off, link-state disable, trust off, query_rss off
v1->v2: just copy an address without modifing ifla_vf_mac
v2->v3: update the changelog
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9b5e11d3fb85..04ea7db08e87 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1998,6 +1998,7 @@ static int ipoib_get_vf_config(struct net_device *dev, int vf,
return err;
ivf->vf = vf;
+ memcpy(ivf->mac, dev->dev_addr, dev->addr_len);
return 0;
}
--
2.12.3
^ permalink raw reply related
* [PATCH 2/2] ipoib: show VF broadcast address
From: Denis Kirjanov @ 2019-06-17 8:53 UTC (permalink / raw)
To: davem, dledford; +Cc: netdev, linux-rdma, mkubecek, Denis Kirjanov
In-Reply-To: <20190617085341.51592-1-dkirjanov@suse.com>
in IPoIB case we can't see a VF broadcast address for but
can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-state disable,
trust off, query_rss off
...
After with iproute2 patch[0]:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof
checking off, link-state disable, trust off, query_rss off
[0]: https://patchwork.kernel.org/patch/10997111
v1->v2: add the IFLA_VF_BROADCAST constant
v2->v3: put IFLA_VF_BROADCAST at the end
to avoid KABI breakage and set NLA_REJECT
dev_setlink
v3->v4: update the changelog: add a link to the patch for iproute2
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
include/uapi/linux/if_link.h | 5 +++++
net/core/rtnetlink.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5b225ff63b48..6f75bda2c2d7 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -694,6 +694,7 @@ enum {
IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */
IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */
IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */
+ IFLA_VF_BROADCAST, /* VF broadcast */
__IFLA_VF_MAX,
};
@@ -704,6 +705,10 @@ struct ifla_vf_mac {
__u8 mac[32]; /* MAX_ADDR_LEN */
};
+struct ifla_vf_broadcast {
+ __u8 broadcast[32];
+};
+
struct ifla_vf_vlan {
__u32 vf;
__u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index cec60583931f..8ac81630ab5c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
size += num_vfs *
(nla_total_size(0) +
nla_total_size(sizeof(struct ifla_vf_mac)) +
+ nla_total_size(sizeof(struct ifla_vf_broadcast)) +
nla_total_size(sizeof(struct ifla_vf_vlan)) +
nla_total_size(0) + /* nest IFLA_VF_VLAN_LIST */
nla_total_size(MAX_VLAN_LIST_LEN *
@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
struct ifla_vf_vlan vf_vlan;
struct ifla_vf_rate vf_rate;
struct ifla_vf_mac vf_mac;
+ struct ifla_vf_broadcast vf_broadcast;
struct ifla_vf_info ivi;
memset(&ivi, 0, sizeof(ivi));
@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
vf_trust.vf = ivi.vf;
memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac));
+ memcpy(vf_broadcast.broadcast, dev->broadcast, dev->addr_len);
vf_vlan.vlan = ivi.vlan;
vf_vlan.qos = ivi.qos;
vf_vlan_info.vlan = ivi.vlan;
@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
if (!vf)
goto nla_put_vfinfo_failure;
if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) ||
+ nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) ||
nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) ||
nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate),
&vf_rate) ||
@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
[IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) },
+ [IFLA_VF_BROADCAST] = { .type = NLA_REJECT },
[IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) },
[IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED },
[IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },
--
2.12.3
^ permalink raw reply related
* [PATCH 1/2] ipoib: correcly show a VF hardware address
From: Denis Kirjanov @ 2019-06-17 8:53 UTC (permalink / raw)
To: davem, dledford; +Cc: netdev, linux-rdma, mkubecek, Denis Kirjanov
in the case of IPoIB with SRIOV enabled hardware
ip link show command incorrecly prints
0 instead of a VF hardware address.
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable,
trust off, query_rss off
...
After with iproute2 patch[0]
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof
checking off, link-state disable, trust off, query_rss off
[0]: https://patchwork.kernel.org/patch/10997111/
v1->v2: just copy an address without modifing ifla_vf_mac
v2->v3: update the changelog
v3->v4: update the changelog: add a link to the patch for iproute2
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9b5e11d3fb85..04ea7db08e87 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1998,6 +1998,7 @@ static int ipoib_get_vf_config(struct net_device *dev, int vf,
return err;
ivf->vf = vf;
+ memcpy(ivf->mac, dev->dev_addr, dev->addr_len);
return 0;
}
--
2.12.3
^ permalink raw reply related
* Re: [PATCH 10/13] megaraid_sas: set virt_boundary_mask in the scsi host
From: Christoph Hellwig @ 2019-06-17 8:44 UTC (permalink / raw)
To: Kashyap Desai
Cc: Christoph Hellwig, Jens Axboe, Sebastian Ott, Sagi Grimberg,
Max Gurtovoy, Bart Van Assche, Ulf Hansson, Alan Stern,
Oliver Neukum, linux-block, linux-rdma, linux-mmc, linux-nvme,
linux-scsi, PDL,MEGARAIDLINUX, PDL-MPT-FUSIONLINUX, linux-hyperv,
linux-usb, usb-storage, linux-kernel
In-Reply-To: <98f6557ae91a7cdfe8069fcf7d788c88@mail.gmail.com>
On Fri, Jun 14, 2019 at 01:28:47AM +0530, Kashyap Desai wrote:
> Is there any changes in API blk_queue_virt_boundary? I could not find
> relevant code which account for this. Can you help ?
> Which git repo shall I use for testing ? That way I can confirm, I didn't
> miss relevant changes.
Latest mainline plus the series (which is about to get resent).
blk_queue_virt_boundary now forced an unlimited max_hw_sectors as that
is how PRP-like schemes work, to work around a block driver merging
bug. But we also need to communicate that limit to the DMA layer so
that we don't set a smaller iommu segment size limitation.
> >From your above explanation, it means (after this patch) max segment size
> of the MR controller will be set to 4K.
> Earlier it is possible to receive single SGE of 64K datalength (Since max
> seg size was 64K), but now the same buffer will reach the driver having 16
> SGEs (Each SGE will contain 4K length).
No, there is no more limit for the size of the segment at all,
as for PRPs each PRP is sort of a segment from the hardware perspective.
We just require the segments to not have gaps, as PRPs don't allow for
that.
That being said I think these patches are wrong for the case of megaraid
or mpt having both NVMe and SAS/ATA devices behind a single controller.
Is that a valid configuration?
^ permalink raw reply
* Re: use exact allocation for dma coherent memory
From: Christoph Hellwig @ 2019-06-17 8:33 UTC (permalink / raw)
To: Dan Carpenter
Cc: Maxime Ripard, Joonas Lahtinen,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg, Christoph Hellwig,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
linux-s390-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, David Airlie,
linux-media-u79uwXL29TY76Z2rM5mHXA, Intel Linux Wireless,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Maarten Lankhorst,
Jani Nikula, Ian Abbott, Rodrigo Vivi, Sean Paul,
moderated list:ARM PORT, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, H Hartley Sweeten,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Daniel Vetter
In-Reply-To: <20190617082148.GF28859@kadam>
> drivers/infiniband/hw/cxgb4/qp.c
> 129 static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq)
> 130 {
> 131 sq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), sq->memsize,
> 132 &(sq->dma_addr), GFP_KERNEL);
> 133 if (!sq->queue)
> 134 return -ENOMEM;
> 135 sq->phys_addr = virt_to_phys(sq->queue);
> 136 dma_unmap_addr_set(sq, mapping, sq->dma_addr);
> 137 return 0;
> 138 }
>
> Is this a bug?
Yes. This will blow up badly on many platforms, as sq->queue
might be vmapped, ioremapped, come from a pool without page backing.
^ permalink raw reply
* Re: use exact allocation for dma coherent memory
From: Dan Carpenter @ 2019-06-17 8:21 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Maxime Ripard, dri-devel, linux-mm, devel, linux-s390, linux-rdma,
David Airlie, linux-media, Intel Linux Wireless, intel-gfx,
Ian Abbott, Rodrigo Vivi, Sean Paul, moderated list:ARM PORT,
netdev, linux-wireless, linux-kernel, H Hartley Sweeten, iommu
In-Reply-To: <20190614134726.3827-1-hch@lst.de>
I once wrote a Smatch check based on a commit message that said we can't
pass dma_alloc_coherent() pointers to virt_to_phys(). But then I never
felt like I understood the rules enough to actually report the warnings
as bugs.
drivers/platform/x86/dcdbas.c:108 smi_data_buf_realloc() error: 'buf' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/net/caif/caif_virtio.c:414 cfv_create_genpool() error: 'cfv->alloc_addr' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/infiniband/hw/cxgb4/qp.c:135 alloc_host_sq() error: 'sq->queue' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/infiniband/hw/cxgb4/qp.c:272 create_qp() error: 'wq->rq.queue' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/infiniband/hw/cxgb4/qp.c:2628 alloc_srq_queue() error: 'wq->queue' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:494 ocrdma_alloc_ucontext() error: 'ctx->ah_tbl.va' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/infiniband/hw/cxgb4/qp.c
129 static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq)
130 {
131 sq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), sq->memsize,
132 &(sq->dma_addr), GFP_KERNEL);
133 if (!sq->queue)
134 return -ENOMEM;
135 sq->phys_addr = virt_to_phys(sq->queue);
136 dma_unmap_addr_set(sq, mapping, sq->dma_addr);
137 return 0;
138 }
Is this a bug?
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Re: [PATCH rdma-next v1 0/4] Expose ENCAP mode to mlx5_ib
From: Leon Romanovsky @ 2019-06-16 12:44 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: RDMA mailing list, Maor Gottlieb, Mark Bloch, Parav Pandit,
Petr Vorel, Saeed Mahameed, linux-netdev, Jiri Pirko
In-Reply-To: <20190612122014.22359-1-leon@kernel.org>
On Wed, Jun 12, 2019 at 03:20:10PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Changelog v0->v1:
> * Added patch to devlink to use declared enum for encap mode instead of u8
> * Constify input argumetn to encap mode function
> * fix encap variable type to be boolean
>
> ---------------------------------------------------------------------
> Hi,
>
> This is short series from Maor to expose and use enacap mode inside mlx5_ib.
>
> Thanks
>
> Leon Romanovsky (1):
> net/mlx5: Declare more strictly devlink encap mode
>
> Maor Gottlieb (3):
> net/mlx5: Expose eswitch encap mode
Those two applied to mlx5-next
82b11f071936 net/mlx5: Expose eswitch encap mode
98fdbea55037 net/mlx5: Declare more strictly devlink encap mode
> RDMA/mlx5: Consider eswitch encap mode
> RDMA/mlx5: Enable decap and packet reformat on FDB
Doug, Jason
Can you please take those two patches in addition to latest mlx5-next?
Thanks
>
> drivers/infiniband/hw/mlx5/main.c | 25 ++++++++++++++-----
> .../net/ethernet/mellanox/mlx5/core/eswitch.c | 11 ++++++++
> .../net/ethernet/mellanox/mlx5/core/eswitch.h | 8 +++---
> .../mellanox/mlx5/core/eswitch_offloads.c | 6 +++--
> include/linux/mlx5/eswitch.h | 12 +++++++++
> include/net/devlink.h | 6 +++--
> net/core/devlink.c | 6 +++--
> 7 files changed, 59 insertions(+), 15 deletions(-)
>
> --
> 2.20.1
>
^ permalink raw reply
* Re: [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink encap mode
From: Jiri Pirko @ 2019-06-16 11:18 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Parav Pandit, Doug Ledford, Jason Gunthorpe, RDMA mailing list,
Maor Gottlieb, Mark Bloch, Petr Vorel, Saeed Mahameed,
linux-netdev, Jiri Pirko
In-Reply-To: <20190616105327.GG4694@mtr-leonro.mtl.com>
Sun, Jun 16, 2019 at 12:53:27PM CEST, leon@kernel.org wrote:
>On Sun, Jun 16, 2019 at 12:39:40PM +0200, Jiri Pirko wrote:
>> Sun, Jun 16, 2019 at 12:15:07PM CEST, leon@kernel.org wrote:
>> >On Sun, Jun 16, 2019 at 12:07:07PM +0200, Jiri Pirko wrote:
>> >> Thu, Jun 13, 2019 at 07:59:54AM CEST, leon@kernel.org wrote:
>> >> >On Thu, Jun 13, 2019 at 04:32:25AM +0000, Parav Pandit wrote:
>> >> >>
>> >> >>
>> >> >> > -----Original Message-----
>> >> >> > From: Leon Romanovsky <leon@kernel.org>
>> >> >> > Sent: Wednesday, June 12, 2019 5:50 PM
>> >> >> > To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
>> >> >> > <jgg@mellanox.com>
>> >> >> > Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
>> >> >> > rdma@vger.kernel.org>; Maor Gottlieb <maorg@mellanox.com>; Mark Bloch
>> >> >> > <markb@mellanox.com>; Parav Pandit <parav@mellanox.com>; Petr Vorel
>> >> >> > <pvorel@suse.cz>; Saeed Mahameed <saeedm@mellanox.com>; linux-
>> >> >> > netdev <netdev@vger.kernel.org>; Jiri Pirko <jiri@mellanox.com>
>> >> >> > Subject: [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink
>> >> >> > encap mode
>> >> >> >
>> >> >> > From: Leon Romanovsky <leonro@mellanox.com>
>> >> >> >
>> >> >> > Devlink has UAPI declaration for encap mode, so there is no need to be
>> >> >> > loose on the data get/set by drivers.
>> >> >> >
>> >> >> > Update call sites to use enum devlink_eswitch_encap_mode instead of plain
>> >> >> > u8.
>> >> >> >
>> >> >> > Suggested-by: Parav Pandit <parav@mellanox.com>
>> >> >> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>> >> >> > ---
>> >> >> > drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 8 +++++---
>> >> >> > .../net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 6 ++++--
>> >> >> > include/net/devlink.h | 6 ++++--
>> >> >> > net/core/devlink.c | 6 ++++--
>> >> >> > 4 files changed, 17 insertions(+), 9 deletions(-)
>> >> >> >
>> >> >> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> >> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> >> > index ed3fad689ec9..e264dfc64a6e 100644
>> >> >> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> >> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> >> > @@ -175,7 +175,7 @@ struct mlx5_esw_offload {
>> >> >> > DECLARE_HASHTABLE(mod_hdr_tbl, 8);
>> >> >> > u8 inline_mode;
>> >> >> > u64 num_flows;
>> >> >> > - u8 encap;
>> >> >> > + enum devlink_eswitch_encap_mode encap;
>> >> >> > };
>> >> >> >
>> >> >> > /* E-Switch MC FDB table hash node */
>> >> >> > @@ -356,9 +356,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct
>> >> >> > devlink *devlink, u8 mode,
>> >> >> > struct netlink_ext_ack *extack);
>> >> >> > int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8
>> >> >> > *mode); int mlx5_eswitch_inline_mode_get(struct mlx5_eswitch *esw, int
>> >> >> > nvfs, u8 *mode); -int mlx5_devlink_eswitch_encap_mode_set(struct devlink
>> >> >> > *devlink, u8 encap,
>> >> >> > +int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
>> >> >> > + enum devlink_eswitch_encap_mode
>> >> >> > encap,
>> >> >> > struct netlink_ext_ack *extack);
>> >> >> > -int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8
>> >> >> > *encap);
>> >> >> > +int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
>> >> >> > + enum devlink_eswitch_encap_mode
>> >> >> > *encap);
>> >> >> > void *mlx5_eswitch_get_uplink_priv(struct mlx5_eswitch *esw, u8
>> >> >> > rep_type);
>> >> >> >
>> >> >> > int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw, diff --git
>> >> >> > a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> >> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> >> > index e09ae27485ee..f1571163143d 100644
>> >> >> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> >> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> >> > @@ -2137,7 +2137,8 @@ int mlx5_eswitch_inline_mode_get(struct
>> >> >> > mlx5_eswitch *esw, int nvfs, u8 *mode)
>> >> >> > return 0;
>> >> >> > }
>> >> >> >
>> >> >> > -int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8
>> >> >> > encap,
>> >> >> > +int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
>> >> >> > + enum devlink_eswitch_encap_mode
>> >> >> > encap,
>> >> >> > struct netlink_ext_ack *extack)
>> >> >> > {
>> >> >> > struct mlx5_core_dev *dev = devlink_priv(devlink); @@ -2186,7
>> >> >> > +2187,8 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink
>> >> >> > *devlink, u8 encap,
>> >> >> > return err;
>> >> >> > }
>> >> >> >
>> >> >> > -int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8
>> >> >> > *encap)
>> >> >> > +int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
>> >> >> > + enum devlink_eswitch_encap_mode
>> >> >> > *encap)
>> >> >> > {
>> >> >> > struct mlx5_core_dev *dev = devlink_priv(devlink);
>> >> >> > struct mlx5_eswitch *esw = dev->priv.eswitch; diff --git
>> >> >> > a/include/net/devlink.h b/include/net/devlink.h index
>> >> >> > 1c4adfb4195a..7a34fc586def 100644
>> >> >> > --- a/include/net/devlink.h
>> >> >> > +++ b/include/net/devlink.h
>> >> >> > @@ -530,8 +530,10 @@ struct devlink_ops {
>> >> >> > int (*eswitch_inline_mode_get)(struct devlink *devlink, u8
>> >> >> > *p_inline_mode);
>> >> >> > int (*eswitch_inline_mode_set)(struct devlink *devlink, u8
>> >> >> > inline_mode,
>> >> >> > struct netlink_ext_ack *extack);
>> >> >> > - int (*eswitch_encap_mode_get)(struct devlink *devlink, u8
>> >> >> > *p_encap_mode);
>> >> >> > - int (*eswitch_encap_mode_set)(struct devlink *devlink, u8
>> >> >> > encap_mode,
>> >> >> > + int (*eswitch_encap_mode_get)(struct devlink *devlink,
>> >> >> > + enum devlink_eswitch_encap_mode
>> >> >> > *p_encap_mode);
>> >> >> > + int (*eswitch_encap_mode_set)(struct devlink *devlink,
>> >> >> > + enum devlink_eswitch_encap_mode
>> >> >> > encap_mode,
>> >> >> > struct netlink_ext_ack *extack);
>> >> >> > int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
>> >> >> > struct netlink_ext_ack *extack);
>> >> >> > diff --git a/net/core/devlink.c b/net/core/devlink.c index
>> >> >> > d43bc52b8840..47ae69363b07 100644
>> >> >> > --- a/net/core/devlink.c
>> >> >> > +++ b/net/core/devlink.c
>> >> >> > @@ -1552,7 +1552,8 @@ static int devlink_nl_eswitch_fill(struct sk_buff
>> >> >> > *msg, struct devlink *devlink,
>> >> >> > u32 seq, int flags)
>> >> >> > {
>> >> >> > const struct devlink_ops *ops = devlink->ops;
>> >> >> > - u8 inline_mode, encap_mode;
>> >> >> > + enum devlink_eswitch_encap_mode encap_mode;
>> >> >> > + u8 inline_mode;
>> >> >> > void *hdr;
>> >> >> > int err = 0;
>> >> >> > u16 mode;
>> >> >> > @@ -1628,7 +1629,8 @@ static int devlink_nl_cmd_eswitch_set_doit(struct
>> >> >> > sk_buff *skb, {
>> >> >> > struct devlink *devlink = info->user_ptr[0];
>> >> >> > const struct devlink_ops *ops = devlink->ops;
>> >> >> > - u8 inline_mode, encap_mode;
>> >> >> > + enum devlink_eswitch_encap_mode encap_mode;
>> >> >> > + u8 inline_mode;
>> >> >> > int err = 0;
>> >> >> > u16 mode;
>> >> >> >
>> >> >> > --
>> >> >> > 2.20.1
>> >> >>
>> >> >> Netdev follows reverse Christmas tree, but otherwise,
>> >> >
>> >> >It was before this patch, if Jiri is ok with that, I'll change this
>> >> >"const struct devlink_ops *ops = devlink->ops;" line while I'll apply
>> >> >this patchset to mlx5-net. If not, I'll leave it as is.
>> >>
>> >> Change to what? I don't follow. The patch looks completely fine to me as
>> >> it is.
>> >
>> >Thanks Jiri,
>> >
>> >Parav mentioned that two lines above my change were already not in Christmas
>> >tree format.
>> >
>> > struct devlink *devlink = info->user_ptr[0];
>> > const struct devlink_ops *ops = devlink->ops;
>>
>> As there is a dependency between those 2 lines, I don't see how you can
>> fix this.
>
>I don't want to do it, but this is possible solution:
>
> const struct devlink_ops *ops:
> struct devlink *devlink;
> ..... extra declarations ....
>
> devlink = info->user_ptr[0];
> ops = devlink->ops;
> ... rest of the code ...
Please don't.
>>
>>
>> >
>> >Thanks
>> >
>> >>
>> >> Acked-by: Jiri Pirko <jiri@mellanox.com>
>> >>
>> >>
>> >>
>> >> >
>> >> >> Reviewed-by: Parav Pandit <parav@mellanox.com>
>> >> >
>> >> >Thanks
>> >> >
>> >> >>
^ permalink raw reply
* Re: [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink encap mode
From: Leon Romanovsky @ 2019-06-16 10:53 UTC (permalink / raw)
To: Jiri Pirko
Cc: Parav Pandit, Doug Ledford, Jason Gunthorpe, RDMA mailing list,
Maor Gottlieb, Mark Bloch, Petr Vorel, Saeed Mahameed,
linux-netdev, Jiri Pirko
In-Reply-To: <20190616103939.GC2511@nanopsycho>
On Sun, Jun 16, 2019 at 12:39:40PM +0200, Jiri Pirko wrote:
> Sun, Jun 16, 2019 at 12:15:07PM CEST, leon@kernel.org wrote:
> >On Sun, Jun 16, 2019 at 12:07:07PM +0200, Jiri Pirko wrote:
> >> Thu, Jun 13, 2019 at 07:59:54AM CEST, leon@kernel.org wrote:
> >> >On Thu, Jun 13, 2019 at 04:32:25AM +0000, Parav Pandit wrote:
> >> >>
> >> >>
> >> >> > -----Original Message-----
> >> >> > From: Leon Romanovsky <leon@kernel.org>
> >> >> > Sent: Wednesday, June 12, 2019 5:50 PM
> >> >> > To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
> >> >> > <jgg@mellanox.com>
> >> >> > Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
> >> >> > rdma@vger.kernel.org>; Maor Gottlieb <maorg@mellanox.com>; Mark Bloch
> >> >> > <markb@mellanox.com>; Parav Pandit <parav@mellanox.com>; Petr Vorel
> >> >> > <pvorel@suse.cz>; Saeed Mahameed <saeedm@mellanox.com>; linux-
> >> >> > netdev <netdev@vger.kernel.org>; Jiri Pirko <jiri@mellanox.com>
> >> >> > Subject: [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink
> >> >> > encap mode
> >> >> >
> >> >> > From: Leon Romanovsky <leonro@mellanox.com>
> >> >> >
> >> >> > Devlink has UAPI declaration for encap mode, so there is no need to be
> >> >> > loose on the data get/set by drivers.
> >> >> >
> >> >> > Update call sites to use enum devlink_eswitch_encap_mode instead of plain
> >> >> > u8.
> >> >> >
> >> >> > Suggested-by: Parav Pandit <parav@mellanox.com>
> >> >> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> >> >> > ---
> >> >> > drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 8 +++++---
> >> >> > .../net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 6 ++++--
> >> >> > include/net/devlink.h | 6 ++++--
> >> >> > net/core/devlink.c | 6 ++++--
> >> >> > 4 files changed, 17 insertions(+), 9 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
> >> >> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
> >> >> > index ed3fad689ec9..e264dfc64a6e 100644
> >> >> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
> >> >> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
> >> >> > @@ -175,7 +175,7 @@ struct mlx5_esw_offload {
> >> >> > DECLARE_HASHTABLE(mod_hdr_tbl, 8);
> >> >> > u8 inline_mode;
> >> >> > u64 num_flows;
> >> >> > - u8 encap;
> >> >> > + enum devlink_eswitch_encap_mode encap;
> >> >> > };
> >> >> >
> >> >> > /* E-Switch MC FDB table hash node */
> >> >> > @@ -356,9 +356,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct
> >> >> > devlink *devlink, u8 mode,
> >> >> > struct netlink_ext_ack *extack);
> >> >> > int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8
> >> >> > *mode); int mlx5_eswitch_inline_mode_get(struct mlx5_eswitch *esw, int
> >> >> > nvfs, u8 *mode); -int mlx5_devlink_eswitch_encap_mode_set(struct devlink
> >> >> > *devlink, u8 encap,
> >> >> > +int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
> >> >> > + enum devlink_eswitch_encap_mode
> >> >> > encap,
> >> >> > struct netlink_ext_ack *extack);
> >> >> > -int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8
> >> >> > *encap);
> >> >> > +int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
> >> >> > + enum devlink_eswitch_encap_mode
> >> >> > *encap);
> >> >> > void *mlx5_eswitch_get_uplink_priv(struct mlx5_eswitch *esw, u8
> >> >> > rep_type);
> >> >> >
> >> >> > int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw, diff --git
> >> >> > a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> >> >> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> >> >> > index e09ae27485ee..f1571163143d 100644
> >> >> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> >> >> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> >> >> > @@ -2137,7 +2137,8 @@ int mlx5_eswitch_inline_mode_get(struct
> >> >> > mlx5_eswitch *esw, int nvfs, u8 *mode)
> >> >> > return 0;
> >> >> > }
> >> >> >
> >> >> > -int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8
> >> >> > encap,
> >> >> > +int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
> >> >> > + enum devlink_eswitch_encap_mode
> >> >> > encap,
> >> >> > struct netlink_ext_ack *extack)
> >> >> > {
> >> >> > struct mlx5_core_dev *dev = devlink_priv(devlink); @@ -2186,7
> >> >> > +2187,8 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink
> >> >> > *devlink, u8 encap,
> >> >> > return err;
> >> >> > }
> >> >> >
> >> >> > -int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8
> >> >> > *encap)
> >> >> > +int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
> >> >> > + enum devlink_eswitch_encap_mode
> >> >> > *encap)
> >> >> > {
> >> >> > struct mlx5_core_dev *dev = devlink_priv(devlink);
> >> >> > struct mlx5_eswitch *esw = dev->priv.eswitch; diff --git
> >> >> > a/include/net/devlink.h b/include/net/devlink.h index
> >> >> > 1c4adfb4195a..7a34fc586def 100644
> >> >> > --- a/include/net/devlink.h
> >> >> > +++ b/include/net/devlink.h
> >> >> > @@ -530,8 +530,10 @@ struct devlink_ops {
> >> >> > int (*eswitch_inline_mode_get)(struct devlink *devlink, u8
> >> >> > *p_inline_mode);
> >> >> > int (*eswitch_inline_mode_set)(struct devlink *devlink, u8
> >> >> > inline_mode,
> >> >> > struct netlink_ext_ack *extack);
> >> >> > - int (*eswitch_encap_mode_get)(struct devlink *devlink, u8
> >> >> > *p_encap_mode);
> >> >> > - int (*eswitch_encap_mode_set)(struct devlink *devlink, u8
> >> >> > encap_mode,
> >> >> > + int (*eswitch_encap_mode_get)(struct devlink *devlink,
> >> >> > + enum devlink_eswitch_encap_mode
> >> >> > *p_encap_mode);
> >> >> > + int (*eswitch_encap_mode_set)(struct devlink *devlink,
> >> >> > + enum devlink_eswitch_encap_mode
> >> >> > encap_mode,
> >> >> > struct netlink_ext_ack *extack);
> >> >> > int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
> >> >> > struct netlink_ext_ack *extack);
> >> >> > diff --git a/net/core/devlink.c b/net/core/devlink.c index
> >> >> > d43bc52b8840..47ae69363b07 100644
> >> >> > --- a/net/core/devlink.c
> >> >> > +++ b/net/core/devlink.c
> >> >> > @@ -1552,7 +1552,8 @@ static int devlink_nl_eswitch_fill(struct sk_buff
> >> >> > *msg, struct devlink *devlink,
> >> >> > u32 seq, int flags)
> >> >> > {
> >> >> > const struct devlink_ops *ops = devlink->ops;
> >> >> > - u8 inline_mode, encap_mode;
> >> >> > + enum devlink_eswitch_encap_mode encap_mode;
> >> >> > + u8 inline_mode;
> >> >> > void *hdr;
> >> >> > int err = 0;
> >> >> > u16 mode;
> >> >> > @@ -1628,7 +1629,8 @@ static int devlink_nl_cmd_eswitch_set_doit(struct
> >> >> > sk_buff *skb, {
> >> >> > struct devlink *devlink = info->user_ptr[0];
> >> >> > const struct devlink_ops *ops = devlink->ops;
> >> >> > - u8 inline_mode, encap_mode;
> >> >> > + enum devlink_eswitch_encap_mode encap_mode;
> >> >> > + u8 inline_mode;
> >> >> > int err = 0;
> >> >> > u16 mode;
> >> >> >
> >> >> > --
> >> >> > 2.20.1
> >> >>
> >> >> Netdev follows reverse Christmas tree, but otherwise,
> >> >
> >> >It was before this patch, if Jiri is ok with that, I'll change this
> >> >"const struct devlink_ops *ops = devlink->ops;" line while I'll apply
> >> >this patchset to mlx5-net. If not, I'll leave it as is.
> >>
> >> Change to what? I don't follow. The patch looks completely fine to me as
> >> it is.
> >
> >Thanks Jiri,
> >
> >Parav mentioned that two lines above my change were already not in Christmas
> >tree format.
> >
> > struct devlink *devlink = info->user_ptr[0];
> > const struct devlink_ops *ops = devlink->ops;
>
> As there is a dependency between those 2 lines, I don't see how you can
> fix this.
I don't want to do it, but this is possible solution:
const struct devlink_ops *ops:
struct devlink *devlink;
..... extra declarations ....
devlink = info->user_ptr[0];
ops = devlink->ops;
... rest of the code ...
>
>
> >
> >Thanks
> >
> >>
> >> Acked-by: Jiri Pirko <jiri@mellanox.com>
> >>
> >>
> >>
> >> >
> >> >> Reviewed-by: Parav Pandit <parav@mellanox.com>
> >> >
> >> >Thanks
> >> >
> >> >>
^ permalink raw reply
* Re: [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink encap mode
From: Jiri Pirko @ 2019-06-16 10:39 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Parav Pandit, Doug Ledford, Jason Gunthorpe, RDMA mailing list,
Maor Gottlieb, Mark Bloch, Petr Vorel, Saeed Mahameed,
linux-netdev, Jiri Pirko
In-Reply-To: <20190616101507.GF4694@mtr-leonro.mtl.com>
Sun, Jun 16, 2019 at 12:15:07PM CEST, leon@kernel.org wrote:
>On Sun, Jun 16, 2019 at 12:07:07PM +0200, Jiri Pirko wrote:
>> Thu, Jun 13, 2019 at 07:59:54AM CEST, leon@kernel.org wrote:
>> >On Thu, Jun 13, 2019 at 04:32:25AM +0000, Parav Pandit wrote:
>> >>
>> >>
>> >> > -----Original Message-----
>> >> > From: Leon Romanovsky <leon@kernel.org>
>> >> > Sent: Wednesday, June 12, 2019 5:50 PM
>> >> > To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
>> >> > <jgg@mellanox.com>
>> >> > Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
>> >> > rdma@vger.kernel.org>; Maor Gottlieb <maorg@mellanox.com>; Mark Bloch
>> >> > <markb@mellanox.com>; Parav Pandit <parav@mellanox.com>; Petr Vorel
>> >> > <pvorel@suse.cz>; Saeed Mahameed <saeedm@mellanox.com>; linux-
>> >> > netdev <netdev@vger.kernel.org>; Jiri Pirko <jiri@mellanox.com>
>> >> > Subject: [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink
>> >> > encap mode
>> >> >
>> >> > From: Leon Romanovsky <leonro@mellanox.com>
>> >> >
>> >> > Devlink has UAPI declaration for encap mode, so there is no need to be
>> >> > loose on the data get/set by drivers.
>> >> >
>> >> > Update call sites to use enum devlink_eswitch_encap_mode instead of plain
>> >> > u8.
>> >> >
>> >> > Suggested-by: Parav Pandit <parav@mellanox.com>
>> >> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>> >> > ---
>> >> > drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 8 +++++---
>> >> > .../net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 6 ++++--
>> >> > include/net/devlink.h | 6 ++++--
>> >> > net/core/devlink.c | 6 ++++--
>> >> > 4 files changed, 17 insertions(+), 9 deletions(-)
>> >> >
>> >> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> > index ed3fad689ec9..e264dfc64a6e 100644
>> >> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
>> >> > @@ -175,7 +175,7 @@ struct mlx5_esw_offload {
>> >> > DECLARE_HASHTABLE(mod_hdr_tbl, 8);
>> >> > u8 inline_mode;
>> >> > u64 num_flows;
>> >> > - u8 encap;
>> >> > + enum devlink_eswitch_encap_mode encap;
>> >> > };
>> >> >
>> >> > /* E-Switch MC FDB table hash node */
>> >> > @@ -356,9 +356,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct
>> >> > devlink *devlink, u8 mode,
>> >> > struct netlink_ext_ack *extack);
>> >> > int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8
>> >> > *mode); int mlx5_eswitch_inline_mode_get(struct mlx5_eswitch *esw, int
>> >> > nvfs, u8 *mode); -int mlx5_devlink_eswitch_encap_mode_set(struct devlink
>> >> > *devlink, u8 encap,
>> >> > +int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
>> >> > + enum devlink_eswitch_encap_mode
>> >> > encap,
>> >> > struct netlink_ext_ack *extack);
>> >> > -int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8
>> >> > *encap);
>> >> > +int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
>> >> > + enum devlink_eswitch_encap_mode
>> >> > *encap);
>> >> > void *mlx5_eswitch_get_uplink_priv(struct mlx5_eswitch *esw, u8
>> >> > rep_type);
>> >> >
>> >> > int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw, diff --git
>> >> > a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> > index e09ae27485ee..f1571163143d 100644
>> >> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> >> > @@ -2137,7 +2137,8 @@ int mlx5_eswitch_inline_mode_get(struct
>> >> > mlx5_eswitch *esw, int nvfs, u8 *mode)
>> >> > return 0;
>> >> > }
>> >> >
>> >> > -int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8
>> >> > encap,
>> >> > +int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
>> >> > + enum devlink_eswitch_encap_mode
>> >> > encap,
>> >> > struct netlink_ext_ack *extack)
>> >> > {
>> >> > struct mlx5_core_dev *dev = devlink_priv(devlink); @@ -2186,7
>> >> > +2187,8 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink
>> >> > *devlink, u8 encap,
>> >> > return err;
>> >> > }
>> >> >
>> >> > -int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8
>> >> > *encap)
>> >> > +int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
>> >> > + enum devlink_eswitch_encap_mode
>> >> > *encap)
>> >> > {
>> >> > struct mlx5_core_dev *dev = devlink_priv(devlink);
>> >> > struct mlx5_eswitch *esw = dev->priv.eswitch; diff --git
>> >> > a/include/net/devlink.h b/include/net/devlink.h index
>> >> > 1c4adfb4195a..7a34fc586def 100644
>> >> > --- a/include/net/devlink.h
>> >> > +++ b/include/net/devlink.h
>> >> > @@ -530,8 +530,10 @@ struct devlink_ops {
>> >> > int (*eswitch_inline_mode_get)(struct devlink *devlink, u8
>> >> > *p_inline_mode);
>> >> > int (*eswitch_inline_mode_set)(struct devlink *devlink, u8
>> >> > inline_mode,
>> >> > struct netlink_ext_ack *extack);
>> >> > - int (*eswitch_encap_mode_get)(struct devlink *devlink, u8
>> >> > *p_encap_mode);
>> >> > - int (*eswitch_encap_mode_set)(struct devlink *devlink, u8
>> >> > encap_mode,
>> >> > + int (*eswitch_encap_mode_get)(struct devlink *devlink,
>> >> > + enum devlink_eswitch_encap_mode
>> >> > *p_encap_mode);
>> >> > + int (*eswitch_encap_mode_set)(struct devlink *devlink,
>> >> > + enum devlink_eswitch_encap_mode
>> >> > encap_mode,
>> >> > struct netlink_ext_ack *extack);
>> >> > int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
>> >> > struct netlink_ext_ack *extack);
>> >> > diff --git a/net/core/devlink.c b/net/core/devlink.c index
>> >> > d43bc52b8840..47ae69363b07 100644
>> >> > --- a/net/core/devlink.c
>> >> > +++ b/net/core/devlink.c
>> >> > @@ -1552,7 +1552,8 @@ static int devlink_nl_eswitch_fill(struct sk_buff
>> >> > *msg, struct devlink *devlink,
>> >> > u32 seq, int flags)
>> >> > {
>> >> > const struct devlink_ops *ops = devlink->ops;
>> >> > - u8 inline_mode, encap_mode;
>> >> > + enum devlink_eswitch_encap_mode encap_mode;
>> >> > + u8 inline_mode;
>> >> > void *hdr;
>> >> > int err = 0;
>> >> > u16 mode;
>> >> > @@ -1628,7 +1629,8 @@ static int devlink_nl_cmd_eswitch_set_doit(struct
>> >> > sk_buff *skb, {
>> >> > struct devlink *devlink = info->user_ptr[0];
>> >> > const struct devlink_ops *ops = devlink->ops;
>> >> > - u8 inline_mode, encap_mode;
>> >> > + enum devlink_eswitch_encap_mode encap_mode;
>> >> > + u8 inline_mode;
>> >> > int err = 0;
>> >> > u16 mode;
>> >> >
>> >> > --
>> >> > 2.20.1
>> >>
>> >> Netdev follows reverse Christmas tree, but otherwise,
>> >
>> >It was before this patch, if Jiri is ok with that, I'll change this
>> >"const struct devlink_ops *ops = devlink->ops;" line while I'll apply
>> >this patchset to mlx5-net. If not, I'll leave it as is.
>>
>> Change to what? I don't follow. The patch looks completely fine to me as
>> it is.
>
>Thanks Jiri,
>
>Parav mentioned that two lines above my change were already not in Christmas
>tree format.
>
> struct devlink *devlink = info->user_ptr[0];
> const struct devlink_ops *ops = devlink->ops;
As there is a dependency between those 2 lines, I don't see how you can
fix this.
>
>Thanks
>
>>
>> Acked-by: Jiri Pirko <jiri@mellanox.com>
>>
>>
>>
>> >
>> >> Reviewed-by: Parav Pandit <parav@mellanox.com>
>> >
>> >Thanks
>> >
>> >>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox