Commit 6da95b52 authored by Alok Prasad's avatar Alok Prasad Committed by David S. Miller

net: qed: fixes crash while running driver in kdump kernel

This fixes a crash introduced by recent is_kdump_kernel() check.
The source of the crash is that kdump kernel can be loaded on a
system with already created VFs. But for such VFs, it will follow
a logic path of PF and eventually crash.

Thus, we are partially reverting back previous changes and instead
use is_kdump_kernel is a single init point of PF init, where we
disable SRIOV explicitly.

Fixes: 37d4f8a6 ("net: qed: Disable SRIOV functionality inside kdump kernel")
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
Signed-off-by: default avatarAlok Prasad <palok@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdb4276a
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/crash_dump.h>
#include <linux/qed/qed_iov_if.h> #include <linux/qed/qed_iov_if.h>
#include "qed_cxt.h" #include "qed_cxt.h"
#include "qed_hsi.h" #include "qed_hsi.h"
...@@ -607,6 +608,9 @@ int qed_iov_hw_info(struct qed_hwfn *p_hwfn) ...@@ -607,6 +608,9 @@ int qed_iov_hw_info(struct qed_hwfn *p_hwfn)
int pos; int pos;
int rc; int rc;
if (is_kdump_kernel())
return 0;
if (IS_VF(p_hwfn->cdev)) if (IS_VF(p_hwfn->cdev))
return 0; return 0;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#ifndef _QED_SRIOV_H #ifndef _QED_SRIOV_H
#define _QED_SRIOV_H #define _QED_SRIOV_H
#include <linux/crash_dump.h>
#include <linux/types.h> #include <linux/types.h>
#include "qed_vf.h" #include "qed_vf.h"
...@@ -41,12 +40,9 @@ ...@@ -41,12 +40,9 @@
#define QED_VF_ARRAY_LENGTH (3) #define QED_VF_ARRAY_LENGTH (3)
#ifdef CONFIG_QED_SRIOV #ifdef CONFIG_QED_SRIOV
#define IS_VF(cdev) (is_kdump_kernel() ? \ #define IS_VF(cdev) ((cdev)->b_is_vf)
(0) : ((cdev)->b_is_vf)) #define IS_PF(cdev) (!((cdev)->b_is_vf))
#define IS_PF(cdev) (is_kdump_kernel() ? \ #define IS_PF_SRIOV(p_hwfn) (!!((p_hwfn)->cdev->p_iov_info))
(1) : !((cdev)->b_is_vf))
#define IS_PF_SRIOV(p_hwfn) (is_kdump_kernel() ? \
(0) : !!((p_hwfn)->cdev->p_iov_info))
#else #else
#define IS_VF(cdev) (0) #define IS_VF(cdev) (0)
#define IS_PF(cdev) (1) #define IS_PF(cdev) (1)
......
...@@ -1265,7 +1265,7 @@ static int qede_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1265,7 +1265,7 @@ static int qede_probe(struct pci_dev *pdev, const struct pci_device_id *id)
case QEDE_PRIVATE_VF: case QEDE_PRIVATE_VF:
if (debug & QED_LOG_VERBOSE_MASK) if (debug & QED_LOG_VERBOSE_MASK)
dev_err(&pdev->dev, "Probing a VF\n"); dev_err(&pdev->dev, "Probing a VF\n");
is_vf = is_kdump_kernel() ? false : true; is_vf = true;
break; break;
default: default:
if (debug & QED_LOG_VERBOSE_MASK) if (debug & QED_LOG_VERBOSE_MASK)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment