Skip to contentSkip to conversation

megasas: fix mapped frame size

PATCH Superseded Peter Lieven 3 participants 3 messages Apr 4, 2019 – Apr 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megasas: fix mapped frame size

the current value of 1024 bytes (16 * MFI_FRAME_SIZE) we map is not enough to hold the maximum number of scatter gather elements we advertise. We actually need a maximum of 2048 bytes. This is 128 max sg elements * 16 bytes (sizeof (union mfi_sgl)).

---
 hw/scsi/megasas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/megasas.c +1 -1
index a56317e026..5ad762de23 100644
@@ -477,7 +477,7 @@ static MegasasCmd *megasas_enqueue_frame(MegasasState *s,
 {
     PCIDevice *pcid = PCI_DEVICE(s);
     MegasasCmd *cmd = NULL;
-    int frame_size = MFI_FRAME_SIZE * 16;
+    int frame_size = MEGASAS_MAX_SGE * sizeof(union mfi_sgl);
     hwaddr frame_size_p = frame_size;
     unsigned long index;
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Peter Lieven

the current value of 1024 bytes (16 * MFI_FRAME_SIZE) we map is not enough to hold the maximum number of scatter gather elements we advertise. We actually need a maximum of 2048 bytes. This is 128 max sg elements * 16 bytes (sizeof (union mfi_sgl)).

---
  hw/scsi/megasas.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/megasas.c +0 -0
index a56317e026..5ad762de23 100644

hw/scsi/megasas.c static MegasasCmd *megasas_enqueue_frame(MegasasState *s, · line 483

Quoted 8 lines
hw/scsi/megasas.c +1 -1
@@ -477,7 +477,7 @@ static MegasasCmd *megasas_enqueue_frame(MegasasState *s,
  {
      PCIDevice *pcid = PCI_DEVICE(s);
      MegasasCmd *cmd = NULL;
-    int frame_size = MFI_FRAME_SIZE * 16;
+    int frame_size = MEGASAS_MAX_SGE * sizeof(union mfi_sgl);
      hwaddr frame_size_p = frame_size;
      unsigned long index;
 

Indeed.

Cheers,

Hannes

#2 lore raw
In reply to Peter Lieven

Quoting Peter Lieven (2019-04-04 07:10:15)

Quoted 6 lines

the current value of 1024 bytes (16 * MFI_FRAME_SIZE) we map is not enough to hold the maximum number of scatter gather elements we advertise. We actually need a maximum of 2048 bytes. This is 128 max sg elements * 16 bytes (sizeof (union mfi_sgl)).

Is there any chance of getting this in for v4.0.0-rc3 tomorrow? Also hoping to pull it in for v3.0.1.

Quoted 22 lines
---
 hw/scsi/megasas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/megasas.c +1 -1
index a56317e026..5ad762de23 100644
@@ -477,7 +477,7 @@ static MegasasCmd *megasas_enqueue_frame(MegasasState *s,
 {
     PCIDevice *pcid = PCI_DEVICE(s);
     MegasasCmd *cmd = NULL;
-    int frame_size = MFI_FRAME_SIZE * 16;
+    int frame_size = MEGASAS_MAX_SGE * sizeof(union mfi_sgl);
     hwaddr frame_size_p = frame_size;
     unsigned long index;
 
Signature · 1 line
2.17.1