* [PATCH 00/10] net: thunderx: fix problems reported by static check tools
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov
These are fixes for the problems that were reported by static check tools.
Aleksey Makarov (9):
net: thunderx: fix constants
net: thunderx: introduce a function for mailbox access
net: thunderx: rework mac address handling
net: thunderx: delete unused variables
net: thunderx: add static
net: thunderx: fix nicvf_set_rxfh()
net: thunderx: remove unneeded type conversions
net: thunderx: check if memory allocation was successful
net: thunderx: use GFP_KERNEL in thread context
Robert Richter (1):
net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id()
drivers/net/ethernet/cavium/thunder/nic.h | 16 +++--
drivers/net/ethernet/cavium/thunder/nic_main.c | 12 +---
.../net/ethernet/cavium/thunder/nicvf_ethtool.c | 3 +-
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 73 +++++++++++-----------
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 9 +--
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 18 +++---
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 7 +--
7 files changed, 67 insertions(+), 71 deletions(-)
--
2.4.1
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 00/10] net: thunderx: fix problems reported by static check tools
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
These are fixes for the problems that were reported by static check tools.
Aleksey Makarov (9):
net: thunderx: fix constants
net: thunderx: introduce a function for mailbox access
net: thunderx: rework mac address handling
net: thunderx: delete unused variables
net: thunderx: add static
net: thunderx: fix nicvf_set_rxfh()
net: thunderx: remove unneeded type conversions
net: thunderx: check if memory allocation was successful
net: thunderx: use GFP_KERNEL in thread context
Robert Richter (1):
net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id()
drivers/net/ethernet/cavium/thunder/nic.h | 16 +++--
drivers/net/ethernet/cavium/thunder/nic_main.c | 12 +---
.../net/ethernet/cavium/thunder/nicvf_ethtool.c | 3 +-
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 73 +++++++++++-----------
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 9 +--
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 18 +++---
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 7 +--
7 files changed, 67 insertions(+), 71 deletions(-)
--
2.4.1
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 01/10] net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id()
2015-06-02 18:00 ` Aleksey Makarov
(?)
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Robert Richter, Sunil Goutham, Robert Richter
From: Robert Richter <rrichter@cavium.com>
There are duplicate NODE_ID macro definitions. Move all of them to
nic.h for usage in nic and bgx driver and introduce nic_get_node_id()
helper function.
This patch also fixes 64bit mask which should have been ULL by
reworking the node calculation.
Signed-off-by: Robert Richter <rrichter@cavium.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 10 ++++++++++
drivers/net/ethernet/cavium/thunder/nic_main.c | 4 +---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 3 ---
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 9b0be52..4f426db 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -11,6 +11,7 @@
#include <linux/netdevice.h>
#include <linux/interrupt.h>
+#include <linux/pci.h>
#include "thunder_bgx.h"
/* PCI device IDs */
@@ -398,6 +399,15 @@ union nic_mbx {
struct bgx_link_status link_status;
};
+#define NIC_NODE_ID_MASK 0x03
+#define NIC_NODE_ID_SHIFT 44
+
+static inline int nic_get_node_id(struct pci_dev *pdev)
+{
+ u64 addr = pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM);
+ return ((addr >> NIC_NODE_ID_SHIFT) & NIC_NODE_ID_MASK);
+}
+
int nicvf_set_real_num_queues(struct net_device *netdev,
int tx_queues, int rx_queues);
int nicvf_open(struct net_device *netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 0f1f58b..3ca7ad8 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -23,8 +23,6 @@
struct nicpf {
struct pci_dev *pdev;
u8 rev_id;
-#define NIC_NODE_ID_MASK 0x300000000000
-#define NIC_NODE_ID(x) ((x & NODE_ID_MASK) >> 44)
u8 node;
unsigned int flags;
u8 num_vf_en; /* No of VF enabled */
@@ -851,7 +849,7 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id);
- nic->node = NIC_NODE_ID(pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM));
+ nic->node = nic_get_node_id(pdev);
nic_set_lmac_vf_mapping(nic);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 020e11c..cde604a 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -894,8 +894,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_release_regions;
}
bgx->bgx_id = (pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM) >> 24) & 1;
- bgx->bgx_id += NODE_ID(pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM))
- * MAX_BGX_PER_CN88XX;
+ bgx->bgx_id += nic_get_node_id(pdev) * MAX_BGX_PER_CN88XX;
+
bgx_vnic[bgx->bgx_id] = bgx;
bgx_get_qlm_mode(bgx);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
index 9d91ce4..f9e2170 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
@@ -20,9 +20,6 @@
#define MAX_LMAC (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX)
-#define NODE_ID_MASK 0x300000000000
-#define NODE_ID(x) ((x & NODE_ID_MASK) >> 44)
-
/* Registers */
#define BGX_CMRX_CFG 0x00
#define CMR_PKT_TX_EN BIT_ULL(13)
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 01/10] net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id()
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: Robert Richter, David Daney, Aleksey Makarov, linux-kernel,
Robert Richter, Robert Richter, Sunil Goutham, linux-arm-kernel
From: Robert Richter <rrichter@cavium.com>
There are duplicate NODE_ID macro definitions. Move all of them to
nic.h for usage in nic and bgx driver and introduce nic_get_node_id()
helper function.
This patch also fixes 64bit mask which should have been ULL by
reworking the node calculation.
Signed-off-by: Robert Richter <rrichter@cavium.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 10 ++++++++++
drivers/net/ethernet/cavium/thunder/nic_main.c | 4 +---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 3 ---
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 9b0be52..4f426db 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -11,6 +11,7 @@
#include <linux/netdevice.h>
#include <linux/interrupt.h>
+#include <linux/pci.h>
#include "thunder_bgx.h"
/* PCI device IDs */
@@ -398,6 +399,15 @@ union nic_mbx {
struct bgx_link_status link_status;
};
+#define NIC_NODE_ID_MASK 0x03
+#define NIC_NODE_ID_SHIFT 44
+
+static inline int nic_get_node_id(struct pci_dev *pdev)
+{
+ u64 addr = pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM);
+ return ((addr >> NIC_NODE_ID_SHIFT) & NIC_NODE_ID_MASK);
+}
+
int nicvf_set_real_num_queues(struct net_device *netdev,
int tx_queues, int rx_queues);
int nicvf_open(struct net_device *netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 0f1f58b..3ca7ad8 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -23,8 +23,6 @@
struct nicpf {
struct pci_dev *pdev;
u8 rev_id;
-#define NIC_NODE_ID_MASK 0x300000000000
-#define NIC_NODE_ID(x) ((x & NODE_ID_MASK) >> 44)
u8 node;
unsigned int flags;
u8 num_vf_en; /* No of VF enabled */
@@ -851,7 +849,7 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id);
- nic->node = NIC_NODE_ID(pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM));
+ nic->node = nic_get_node_id(pdev);
nic_set_lmac_vf_mapping(nic);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 020e11c..cde604a 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -894,8 +894,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_release_regions;
}
bgx->bgx_id = (pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM) >> 24) & 1;
- bgx->bgx_id += NODE_ID(pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM))
- * MAX_BGX_PER_CN88XX;
+ bgx->bgx_id += nic_get_node_id(pdev) * MAX_BGX_PER_CN88XX;
+
bgx_vnic[bgx->bgx_id] = bgx;
bgx_get_qlm_mode(bgx);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
index 9d91ce4..f9e2170 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
@@ -20,9 +20,6 @@
#define MAX_LMAC (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX)
-#define NODE_ID_MASK 0x300000000000
-#define NODE_ID(x) ((x & NODE_ID_MASK) >> 44)
-
/* Registers */
#define BGX_CMRX_CFG 0x00
#define CMR_PKT_TX_EN BIT_ULL(13)
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 01/10] net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id()
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Robert Richter <rrichter@cavium.com>
There are duplicate NODE_ID macro definitions. Move all of them to
nic.h for usage in nic and bgx driver and introduce nic_get_node_id()
helper function.
This patch also fixes 64bit mask which should have been ULL by
reworking the node calculation.
Signed-off-by: Robert Richter <rrichter@cavium.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 10 ++++++++++
drivers/net/ethernet/cavium/thunder/nic_main.c | 4 +---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 3 ---
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 9b0be52..4f426db 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -11,6 +11,7 @@
#include <linux/netdevice.h>
#include <linux/interrupt.h>
+#include <linux/pci.h>
#include "thunder_bgx.h"
/* PCI device IDs */
@@ -398,6 +399,15 @@ union nic_mbx {
struct bgx_link_status link_status;
};
+#define NIC_NODE_ID_MASK 0x03
+#define NIC_NODE_ID_SHIFT 44
+
+static inline int nic_get_node_id(struct pci_dev *pdev)
+{
+ u64 addr = pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM);
+ return ((addr >> NIC_NODE_ID_SHIFT) & NIC_NODE_ID_MASK);
+}
+
int nicvf_set_real_num_queues(struct net_device *netdev,
int tx_queues, int rx_queues);
int nicvf_open(struct net_device *netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 0f1f58b..3ca7ad8 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -23,8 +23,6 @@
struct nicpf {
struct pci_dev *pdev;
u8 rev_id;
-#define NIC_NODE_ID_MASK 0x300000000000
-#define NIC_NODE_ID(x) ((x & NODE_ID_MASK) >> 44)
u8 node;
unsigned int flags;
u8 num_vf_en; /* No of VF enabled */
@@ -851,7 +849,7 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id);
- nic->node = NIC_NODE_ID(pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM));
+ nic->node = nic_get_node_id(pdev);
nic_set_lmac_vf_mapping(nic);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 020e11c..cde604a 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -894,8 +894,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_release_regions;
}
bgx->bgx_id = (pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM) >> 24) & 1;
- bgx->bgx_id += NODE_ID(pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM))
- * MAX_BGX_PER_CN88XX;
+ bgx->bgx_id += nic_get_node_id(pdev) * MAX_BGX_PER_CN88XX;
+
bgx_vnic[bgx->bgx_id] = bgx;
bgx_get_qlm_mode(bgx);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
index 9d91ce4..f9e2170 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
@@ -20,9 +20,6 @@
#define MAX_LMAC (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX)
-#define NODE_ID_MASK 0x300000000000
-#define NODE_ID(x) ((x & NODE_ID_MASK) >> 44)
-
/* Registers */
#define BGX_CMRX_CFG 0x00
#define CMR_PKT_TX_EN BIT_ULL(13)
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 02/10] net: thunderx: fix constants
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
This fixes sparse messages like this:
drivers/net/ethernet/cavium/thunder/thunder_bgx.c:897:24: sparse:
constant 0x300000000000 is so big it is long
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index abd446e6..f81182c 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -326,11 +326,11 @@ static int nicvf_rss_init(struct nicvf *nic)
rss->enable = true;
/* Using the HW reset value for now */
- rss->key[0] = 0xFEED0BADFEED0BAD;
- rss->key[1] = 0xFEED0BADFEED0BAD;
- rss->key[2] = 0xFEED0BADFEED0BAD;
- rss->key[3] = 0xFEED0BADFEED0BAD;
- rss->key[4] = 0xFEED0BADFEED0BAD;
+ rss->key[0] = 0xFEED0BADFEED0BADULL;
+ rss->key[1] = 0xFEED0BADFEED0BADULL;
+ rss->key[2] = 0xFEED0BADFEED0BADULL;
+ rss->key[3] = 0xFEED0BADFEED0BADULL;
+ rss->key[4] = 0xFEED0BADFEED0BADULL;
nicvf_set_rss_key(nic);
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 02/10] net: thunderx: fix constants
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
This fixes sparse messages like this:
drivers/net/ethernet/cavium/thunder/thunder_bgx.c:897:24: sparse:
constant 0x300000000000 is so big it is long
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index abd446e6..f81182c 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -326,11 +326,11 @@ static int nicvf_rss_init(struct nicvf *nic)
rss->enable = true;
/* Using the HW reset value for now */
- rss->key[0] = 0xFEED0BADFEED0BAD;
- rss->key[1] = 0xFEED0BADFEED0BAD;
- rss->key[2] = 0xFEED0BADFEED0BAD;
- rss->key[3] = 0xFEED0BADFEED0BAD;
- rss->key[4] = 0xFEED0BADFEED0BAD;
+ rss->key[0] = 0xFEED0BADFEED0BADULL;
+ rss->key[1] = 0xFEED0BADFEED0BADULL;
+ rss->key[2] = 0xFEED0BADFEED0BADULL;
+ rss->key[3] = 0xFEED0BADFEED0BADULL;
+ rss->key[4] = 0xFEED0BADFEED0BADULL;
nicvf_set_rss_key(nic);
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 03/10] net: thunderx: introduce a function for mailbox access
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
This fixes sparse message:
drivers/net/ethernet/cavium/thunder/nicvf_main.c:153:25: sparse: cast to
restricted __le64
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 27 +++++++++++++++---------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index f81182c..989f005 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -110,17 +110,23 @@ u64 nicvf_queue_reg_read(struct nicvf *nic, u64 offset, u64 qidx)
/* VF -> PF mailbox communication */
+static void nicvf_write_to_mbx(struct nicvf *nic, union nic_mbx *mbx)
+{
+ u64 *msg = (u64 *)mbx;
+
+ nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 0, msg[0]);
+ nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 8, msg[1]);
+}
+
int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
{
int timeout = NIC_MBOX_MSG_TIMEOUT;
int sleep = 10;
- u64 *msg = (u64 *)mbx;
nic->pf_acked = false;
nic->pf_nacked = false;
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 0, msg[0]);
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 8, msg[1]);
+ nicvf_write_to_mbx(nic, mbx);
/* Wait for previous message to be acked, timeout 2sec */
while (!nic->pf_acked) {
@@ -146,12 +152,13 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
static int nicvf_check_pf_ready(struct nicvf *nic)
{
int timeout = 5000, sleep = 20;
+ union nic_mbx mbx = {};
+
+ mbx.msg.msg = NIC_MBOX_MSG_READY;
nic->pf_ready_to_rcv_msg = false;
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 0,
- le64_to_cpu(NIC_MBOX_MSG_READY));
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 8, 1ULL);
+ nicvf_write_to_mbx(nic, &mbx);
while (!nic->pf_ready_to_rcv_msg) {
msleep(sleep);
@@ -368,7 +375,9 @@ int nicvf_set_real_num_queues(struct net_device *netdev,
static int nicvf_init_resources(struct nicvf *nic)
{
int err;
- u64 mbx_addr = NIC_VF_PF_MAILBOX_0_1;
+ union nic_mbx mbx = {};
+
+ mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
/* Enable Qset */
nicvf_qset_config(nic, true);
@@ -382,9 +391,7 @@ static int nicvf_init_resources(struct nicvf *nic)
}
/* Send VF config done msg to PF */
- nicvf_reg_write(nic, mbx_addr, le64_to_cpu(NIC_MBOX_MSG_CFG_DONE));
- mbx_addr += (NIC_PF_VF_MAILBOX_SIZE - 1) * 8;
- nicvf_reg_write(nic, mbx_addr, 1ULL);
+ nicvf_write_to_mbx(nic, &mbx);
return 0;
}
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 03/10] net: thunderx: introduce a function for mailbox access
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
This fixes sparse message:
drivers/net/ethernet/cavium/thunder/nicvf_main.c:153:25: sparse: cast to
restricted __le64
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 27 +++++++++++++++---------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index f81182c..989f005 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -110,17 +110,23 @@ u64 nicvf_queue_reg_read(struct nicvf *nic, u64 offset, u64 qidx)
/* VF -> PF mailbox communication */
+static void nicvf_write_to_mbx(struct nicvf *nic, union nic_mbx *mbx)
+{
+ u64 *msg = (u64 *)mbx;
+
+ nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 0, msg[0]);
+ nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 8, msg[1]);
+}
+
int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
{
int timeout = NIC_MBOX_MSG_TIMEOUT;
int sleep = 10;
- u64 *msg = (u64 *)mbx;
nic->pf_acked = false;
nic->pf_nacked = false;
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 0, msg[0]);
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 8, msg[1]);
+ nicvf_write_to_mbx(nic, mbx);
/* Wait for previous message to be acked, timeout 2sec */
while (!nic->pf_acked) {
@@ -146,12 +152,13 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
static int nicvf_check_pf_ready(struct nicvf *nic)
{
int timeout = 5000, sleep = 20;
+ union nic_mbx mbx = {};
+
+ mbx.msg.msg = NIC_MBOX_MSG_READY;
nic->pf_ready_to_rcv_msg = false;
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 0,
- le64_to_cpu(NIC_MBOX_MSG_READY));
- nicvf_reg_write(nic, NIC_VF_PF_MAILBOX_0_1 + 8, 1ULL);
+ nicvf_write_to_mbx(nic, &mbx);
while (!nic->pf_ready_to_rcv_msg) {
msleep(sleep);
@@ -368,7 +375,9 @@ int nicvf_set_real_num_queues(struct net_device *netdev,
static int nicvf_init_resources(struct nicvf *nic)
{
int err;
- u64 mbx_addr = NIC_VF_PF_MAILBOX_0_1;
+ union nic_mbx mbx = {};
+
+ mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
/* Enable Qset */
nicvf_qset_config(nic, true);
@@ -382,9 +391,7 @@ static int nicvf_init_resources(struct nicvf *nic)
}
/* Send VF config done msg to PF */
- nicvf_reg_write(nic, mbx_addr, le64_to_cpu(NIC_MBOX_MSG_CFG_DONE));
- mbx_addr += (NIC_PF_VF_MAILBOX_SIZE - 1) * 8;
- nicvf_reg_write(nic, mbx_addr, 1ULL);
+ nicvf_write_to_mbx(nic, &mbx);
return 0;
}
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 04/10] net: thunderx: rework mac address handling
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
This fixes sparse message:
drivers/net/ethernet/cavium/thunder/nicvf_main.c:385:40: sparse: cast to
restricted __le64
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 4 ++--
drivers/net/ethernet/cavium/thunder/nic_main.c | 8 +-------
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 8 ++------
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 4 ++--
5 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 4f426db..6479ce2 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -301,7 +301,7 @@ struct nic_cfg_msg {
u8 vf_id;
u8 tns_mode;
u8 node_id;
- u64 mac_addr;
+ u8 mac_addr[ETH_ALEN];
};
/* Qset configuration */
@@ -331,7 +331,7 @@ struct sq_cfg_msg {
struct set_mac_msg {
u8 msg;
u8 vf_id;
- u64 addr;
+ u8 mac_addr[ETH_ALEN];
};
/* Set Maximum frame size */
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 3ca7ad8..6e0c031 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -492,7 +492,6 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
u64 *mbx_data;
u64 mbx_addr;
u64 reg_addr;
- u64 mac_addr;
int bgx, lmac;
int i;
int ret = 0;
@@ -555,12 +554,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
lmac = mbx.mac.vf_id;
bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]);
lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]);
-#ifdef __BIG_ENDIAN
- mac_addr = cpu_to_be64(mbx.nic_cfg.mac_addr) << 16;
-#else
- mac_addr = cpu_to_be64(mbx.nic_cfg.mac_addr) >> 16;
-#endif
- bgx_set_lmac_mac(nic->node, bgx, lmac, (u8 *)&mac_addr);
+ bgx_set_lmac_mac(nic->node, bgx, lmac, mbx.mac.mac_addr);
break;
case NIC_MBOX_MSG_SET_MAX_FRS:
ret = nic_update_hw_frs(nic, mbx.frs.max_frs,
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 989f005..54bba86 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -197,8 +197,7 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
nic->vf_id = mbx.nic_cfg.vf_id & 0x7F;
nic->tns_mode = mbx.nic_cfg.tns_mode & 0x7F;
nic->node = mbx.nic_cfg.node_id;
- ether_addr_copy(nic->netdev->dev_addr,
- (u8 *)&mbx.nic_cfg.mac_addr);
+ ether_addr_copy(nic->netdev->dev_addr, mbx.nic_cfg.mac_addr);
nic->link_up = false;
nic->duplex = 0;
nic->speed = 0;
@@ -248,13 +247,10 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
static int nicvf_hw_set_mac_addr(struct nicvf *nic, struct net_device *netdev)
{
union nic_mbx mbx = {};
- int i;
mbx.mac.msg = NIC_MBOX_MSG_SET_MAC;
mbx.mac.vf_id = nic->vf_id;
- for (i = 0; i < ETH_ALEN; i++)
- mbx.mac.addr = (mbx.mac.addr << 8) |
- netdev->dev_addr[i];
+ ether_addr_copy(mbx.mac.mac_addr, netdev->dev_addr);
return nicvf_send_msg_to_pf(nic, &mbx);
}
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index cde604a..a58924c 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -163,7 +163,7 @@ void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status)
}
EXPORT_SYMBOL(bgx_get_lmac_link_state);
-const char *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
+const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
{
struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_CN88XX) + bgx_idx];
@@ -174,7 +174,7 @@ const char *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
}
EXPORT_SYMBOL(bgx_get_lmac_mac);
-void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const char *mac)
+void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac)
{
struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_CN88XX) + bgx_idx];
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
index f9e2170..ba4f53b 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
@@ -183,8 +183,8 @@ enum MCAST_MODE {
void bgx_add_dmac_addr(u64 dmac, int node, int bgx_idx, int lmac);
unsigned bgx_get_map(int node);
int bgx_get_lmac_count(int node, int bgx);
-const char *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid);
-void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const char *mac);
+const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid);
+void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac);
void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status);
u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx);
u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx);
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 04/10] net: thunderx: rework mac address handling
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
This fixes sparse message:
drivers/net/ethernet/cavium/thunder/nicvf_main.c:385:40: sparse: cast to
restricted __le64
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 4 ++--
drivers/net/ethernet/cavium/thunder/nic_main.c | 8 +-------
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 8 ++------
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 4 ++--
5 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 4f426db..6479ce2 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -301,7 +301,7 @@ struct nic_cfg_msg {
u8 vf_id;
u8 tns_mode;
u8 node_id;
- u64 mac_addr;
+ u8 mac_addr[ETH_ALEN];
};
/* Qset configuration */
@@ -331,7 +331,7 @@ struct sq_cfg_msg {
struct set_mac_msg {
u8 msg;
u8 vf_id;
- u64 addr;
+ u8 mac_addr[ETH_ALEN];
};
/* Set Maximum frame size */
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 3ca7ad8..6e0c031 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -492,7 +492,6 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
u64 *mbx_data;
u64 mbx_addr;
u64 reg_addr;
- u64 mac_addr;
int bgx, lmac;
int i;
int ret = 0;
@@ -555,12 +554,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
lmac = mbx.mac.vf_id;
bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]);
lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]);
-#ifdef __BIG_ENDIAN
- mac_addr = cpu_to_be64(mbx.nic_cfg.mac_addr) << 16;
-#else
- mac_addr = cpu_to_be64(mbx.nic_cfg.mac_addr) >> 16;
-#endif
- bgx_set_lmac_mac(nic->node, bgx, lmac, (u8 *)&mac_addr);
+ bgx_set_lmac_mac(nic->node, bgx, lmac, mbx.mac.mac_addr);
break;
case NIC_MBOX_MSG_SET_MAX_FRS:
ret = nic_update_hw_frs(nic, mbx.frs.max_frs,
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 989f005..54bba86 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -197,8 +197,7 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
nic->vf_id = mbx.nic_cfg.vf_id & 0x7F;
nic->tns_mode = mbx.nic_cfg.tns_mode & 0x7F;
nic->node = mbx.nic_cfg.node_id;
- ether_addr_copy(nic->netdev->dev_addr,
- (u8 *)&mbx.nic_cfg.mac_addr);
+ ether_addr_copy(nic->netdev->dev_addr, mbx.nic_cfg.mac_addr);
nic->link_up = false;
nic->duplex = 0;
nic->speed = 0;
@@ -248,13 +247,10 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
static int nicvf_hw_set_mac_addr(struct nicvf *nic, struct net_device *netdev)
{
union nic_mbx mbx = {};
- int i;
mbx.mac.msg = NIC_MBOX_MSG_SET_MAC;
mbx.mac.vf_id = nic->vf_id;
- for (i = 0; i < ETH_ALEN; i++)
- mbx.mac.addr = (mbx.mac.addr << 8) |
- netdev->dev_addr[i];
+ ether_addr_copy(mbx.mac.mac_addr, netdev->dev_addr);
return nicvf_send_msg_to_pf(nic, &mbx);
}
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index cde604a..a58924c 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -163,7 +163,7 @@ void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status)
}
EXPORT_SYMBOL(bgx_get_lmac_link_state);
-const char *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
+const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
{
struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_CN88XX) + bgx_idx];
@@ -174,7 +174,7 @@ const char *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
}
EXPORT_SYMBOL(bgx_get_lmac_mac);
-void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const char *mac)
+void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac)
{
struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_CN88XX) + bgx_idx];
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
index f9e2170..ba4f53b 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
@@ -183,8 +183,8 @@ enum MCAST_MODE {
void bgx_add_dmac_addr(u64 dmac, int node, int bgx_idx, int lmac);
unsigned bgx_get_map(int node);
int bgx_get_lmac_count(int node, int bgx);
-const char *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid);
-void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const char *mac);
+const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid);
+void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac);
void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status);
u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx);
u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx);
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 05/10] net: thunderx: delete unused variables
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
They were left from development stage
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index a58924c..83476f0 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -38,7 +38,7 @@ struct lmac {
bool is_sgmii;
struct delayed_work dwork;
struct workqueue_struct *check_link;
-} lmac;
+};
struct bgx {
u8 bgx_id;
@@ -50,7 +50,7 @@ struct bgx {
int use_training;
void __iomem *reg_base;
struct pci_dev *pdev;
-} bgx;
+};
struct bgx *bgx_vnic[MAX_BGX_THUNDER];
static int lmac_count; /* Total no of LMACs in system */
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 05/10] net: thunderx: delete unused variables
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
They were left from development stage
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index a58924c..83476f0 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -38,7 +38,7 @@ struct lmac {
bool is_sgmii;
struct delayed_work dwork;
struct workqueue_struct *check_link;
-} lmac;
+};
struct bgx {
u8 bgx_id;
@@ -50,7 +50,7 @@ struct bgx {
int use_training;
void __iomem *reg_base;
struct pci_dev *pdev;
-} bgx;
+};
struct bgx *bgx_vnic[MAX_BGX_THUNDER];
static int lmac_count; /* Total no of LMACs in system */
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 06/10] net: thunderx: add static
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
This fixes sparse messages like this:
drivers/net/ethernet/cavium/thunder/nicvf_main.c:1141:26: sparse: symbol
'nicvf_get_stats64' was not declared. Should it be static?
Also remove unused declarations
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 2 --
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 28 ++++++++++------------
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +-
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 6 ++---
4 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 6479ce2..a3b43e5 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -413,10 +413,8 @@ int nicvf_set_real_num_queues(struct net_device *netdev,
int nicvf_open(struct net_device *netdev);
int nicvf_stop(struct net_device *netdev);
int nicvf_send_msg_to_pf(struct nicvf *vf, union nic_mbx *mbx);
-void nicvf_config_cpi(struct nicvf *nic);
void nicvf_config_rss(struct nicvf *nic);
void nicvf_set_rss_key(struct nicvf *nic);
-void nicvf_free_skb(struct nicvf *nic, struct sk_buff *skb);
void nicvf_set_ethtool_ops(struct net_device *netdev);
void nicvf_update_stats(struct nicvf *nic);
void nicvf_update_lmac_stats(struct nicvf *nic);
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 54bba86..02da802 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -50,10 +50,6 @@ module_param(cpi_alg, int, S_IRUGO);
MODULE_PARM_DESC(cpi_alg,
"PFC algorithm (0=none, 1=VLAN, 2=VLAN16, 3=IP Diffserv)");
-static int nicvf_enable_msix(struct nicvf *nic);
-static netdev_tx_t nicvf_xmit(struct sk_buff *skb, struct net_device *netdev);
-static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx);
-
static inline void nicvf_set_rx_frame_cnt(struct nicvf *nic,
struct sk_buff *skb)
{
@@ -174,6 +170,14 @@ static int nicvf_check_pf_ready(struct nicvf *nic)
return 1;
}
+static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
+{
+ if (bgx->rx)
+ nic->bgx_stats.rx_stats[bgx->idx] = bgx->stats;
+ else
+ nic->bgx_stats.tx_stats[bgx->idx] = bgx->stats;
+}
+
static void nicvf_handle_mbx_intr(struct nicvf *nic)
{
union nic_mbx mbx = {};
@@ -255,7 +259,7 @@ static int nicvf_hw_set_mac_addr(struct nicvf *nic, struct net_device *netdev)
return nicvf_send_msg_to_pf(nic, &mbx);
}
-void nicvf_config_cpi(struct nicvf *nic)
+static void nicvf_config_cpi(struct nicvf *nic)
{
union nic_mbx mbx = {};
@@ -267,7 +271,7 @@ void nicvf_config_cpi(struct nicvf *nic)
nicvf_send_msg_to_pf(nic, &mbx);
}
-void nicvf_get_rss_size(struct nicvf *nic)
+static void nicvf_get_rss_size(struct nicvf *nic)
{
union nic_mbx mbx = {};
@@ -575,7 +579,7 @@ static int nicvf_poll(struct napi_struct *napi, int budget)
*
* As of now only CQ errors are handled
*/
-void nicvf_handle_qs_err(unsigned long data)
+static void nicvf_handle_qs_err(unsigned long data)
{
struct nicvf *nic = (struct nicvf *)data;
struct queue_set *qs = nic->qs;
@@ -1043,14 +1047,6 @@ static int nicvf_set_mac_address(struct net_device *netdev, void *p)
return 0;
}
-static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
-{
- if (bgx->rx)
- nic->bgx_stats.rx_stats[bgx->idx] = bgx->stats;
- else
- nic->bgx_stats.tx_stats[bgx->idx] = bgx->stats;
-}
-
void nicvf_update_lmac_stats(struct nicvf *nic)
{
int stat = 0;
@@ -1141,7 +1137,7 @@ void nicvf_update_stats(struct nicvf *nic)
nicvf_update_sq_stats(nic, qidx);
}
-struct rtnl_link_stats64 *nicvf_get_stats64(struct net_device *netdev,
+static struct rtnl_link_stats64 *nicvf_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *stats)
{
struct nicvf *nic = netdev_priv(netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 1962466..7f0e108 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -228,7 +228,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
/* Refill receive buffer descriptors with new buffers.
*/
-void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp)
+static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp)
{
struct queue_set *qs = nic->qs;
int rbdr_idx = qs->rbdr_cnt;
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 83476f0..633ec05 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -52,7 +52,7 @@ struct bgx {
struct pci_dev *pdev;
};
-struct bgx *bgx_vnic[MAX_BGX_THUNDER];
+static struct bgx *bgx_vnic[MAX_BGX_THUNDER];
static int lmac_count; /* Total no of LMACs in system */
static int bgx_xaui_check_link(struct lmac *lmac);
@@ -253,7 +253,7 @@ static void bgx_sgmii_change_link_state(struct lmac *lmac)
bgx_reg_write(bgx, lmac->lmacid, BGX_CMRX_CFG, cmr_cfg);
}
-void bgx_lmac_handler(struct net_device *netdev)
+static void bgx_lmac_handler(struct net_device *netdev)
{
struct lmac *lmac = container_of(netdev, struct lmac, netdev);
struct phy_device *phydev = lmac->phydev;
@@ -655,7 +655,7 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)
return 0;
}
-void bgx_lmac_disable(struct bgx *bgx, u8 lmacid)
+static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid)
{
struct lmac *lmac;
u64 cmrx_cfg;
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 06/10] net: thunderx: add static
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
This fixes sparse messages like this:
drivers/net/ethernet/cavium/thunder/nicvf_main.c:1141:26: sparse: symbol
'nicvf_get_stats64' was not declared. Should it be static?
Also remove unused declarations
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 2 --
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 28 ++++++++++------------
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +-
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 6 ++---
4 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 6479ce2..a3b43e5 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -413,10 +413,8 @@ int nicvf_set_real_num_queues(struct net_device *netdev,
int nicvf_open(struct net_device *netdev);
int nicvf_stop(struct net_device *netdev);
int nicvf_send_msg_to_pf(struct nicvf *vf, union nic_mbx *mbx);
-void nicvf_config_cpi(struct nicvf *nic);
void nicvf_config_rss(struct nicvf *nic);
void nicvf_set_rss_key(struct nicvf *nic);
-void nicvf_free_skb(struct nicvf *nic, struct sk_buff *skb);
void nicvf_set_ethtool_ops(struct net_device *netdev);
void nicvf_update_stats(struct nicvf *nic);
void nicvf_update_lmac_stats(struct nicvf *nic);
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 54bba86..02da802 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -50,10 +50,6 @@ module_param(cpi_alg, int, S_IRUGO);
MODULE_PARM_DESC(cpi_alg,
"PFC algorithm (0=none, 1=VLAN, 2=VLAN16, 3=IP Diffserv)");
-static int nicvf_enable_msix(struct nicvf *nic);
-static netdev_tx_t nicvf_xmit(struct sk_buff *skb, struct net_device *netdev);
-static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx);
-
static inline void nicvf_set_rx_frame_cnt(struct nicvf *nic,
struct sk_buff *skb)
{
@@ -174,6 +170,14 @@ static int nicvf_check_pf_ready(struct nicvf *nic)
return 1;
}
+static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
+{
+ if (bgx->rx)
+ nic->bgx_stats.rx_stats[bgx->idx] = bgx->stats;
+ else
+ nic->bgx_stats.tx_stats[bgx->idx] = bgx->stats;
+}
+
static void nicvf_handle_mbx_intr(struct nicvf *nic)
{
union nic_mbx mbx = {};
@@ -255,7 +259,7 @@ static int nicvf_hw_set_mac_addr(struct nicvf *nic, struct net_device *netdev)
return nicvf_send_msg_to_pf(nic, &mbx);
}
-void nicvf_config_cpi(struct nicvf *nic)
+static void nicvf_config_cpi(struct nicvf *nic)
{
union nic_mbx mbx = {};
@@ -267,7 +271,7 @@ void nicvf_config_cpi(struct nicvf *nic)
nicvf_send_msg_to_pf(nic, &mbx);
}
-void nicvf_get_rss_size(struct nicvf *nic)
+static void nicvf_get_rss_size(struct nicvf *nic)
{
union nic_mbx mbx = {};
@@ -575,7 +579,7 @@ static int nicvf_poll(struct napi_struct *napi, int budget)
*
* As of now only CQ errors are handled
*/
-void nicvf_handle_qs_err(unsigned long data)
+static void nicvf_handle_qs_err(unsigned long data)
{
struct nicvf *nic = (struct nicvf *)data;
struct queue_set *qs = nic->qs;
@@ -1043,14 +1047,6 @@ static int nicvf_set_mac_address(struct net_device *netdev, void *p)
return 0;
}
-static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
-{
- if (bgx->rx)
- nic->bgx_stats.rx_stats[bgx->idx] = bgx->stats;
- else
- nic->bgx_stats.tx_stats[bgx->idx] = bgx->stats;
-}
-
void nicvf_update_lmac_stats(struct nicvf *nic)
{
int stat = 0;
@@ -1141,7 +1137,7 @@ void nicvf_update_stats(struct nicvf *nic)
nicvf_update_sq_stats(nic, qidx);
}
-struct rtnl_link_stats64 *nicvf_get_stats64(struct net_device *netdev,
+static struct rtnl_link_stats64 *nicvf_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *stats)
{
struct nicvf *nic = netdev_priv(netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 1962466..7f0e108 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -228,7 +228,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
/* Refill receive buffer descriptors with new buffers.
*/
-void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp)
+static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp)
{
struct queue_set *qs = nic->qs;
int rbdr_idx = qs->rbdr_cnt;
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 83476f0..633ec05 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -52,7 +52,7 @@ struct bgx {
struct pci_dev *pdev;
};
-struct bgx *bgx_vnic[MAX_BGX_THUNDER];
+static struct bgx *bgx_vnic[MAX_BGX_THUNDER];
static int lmac_count; /* Total no of LMACs in system */
static int bgx_xaui_check_link(struct lmac *lmac);
@@ -253,7 +253,7 @@ static void bgx_sgmii_change_link_state(struct lmac *lmac)
bgx_reg_write(bgx, lmac->lmacid, BGX_CMRX_CFG, cmr_cfg);
}
-void bgx_lmac_handler(struct net_device *netdev)
+static void bgx_lmac_handler(struct net_device *netdev)
{
struct lmac *lmac = container_of(netdev, struct lmac, netdev);
struct phy_device *phydev = lmac->phydev;
@@ -655,7 +655,7 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)
return 0;
}
-void bgx_lmac_disable(struct bgx *bgx, u8 lmacid)
+static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid)
{
struct lmac *lmac;
u64 cmrx_cfg;
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 07/10] net: thunderx: fix nicvf_set_rxfh()
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
This fixes a copypaste bug that was discovered by a static analysis
tool:
The patch 4863dea3fab0: "net: Adding support for Cavium ThunderX
network controller" from May 26, 2015, leads to the following static
checker warning:
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c:517
nicvf_set_rxfh()
warn: we tested 'hkey' before and it was 'false'
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
506 /* We do not allow change in unsupported parameters */
507 if (hkey ||
^^^^
We return here.
508 (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc !=
ETH_RSS_HASH_TOP))
509 return -EOPNOTSUPP;
510
511 rss->enable = true;
512 if (indir) {
513 for (idx = 0; idx < rss->rss_size; idx++)
514 rss->ind_tbl[idx] = indir[idx];
515 }
516
517 if (hkey) {
^^^^
So this is dead code.
518 memcpy(rss->key, hkey, RSS_HASH_KEY_SIZE *
sizeof(u64));
519 nicvf_set_rss_key(nic);
520 }
521
522 nicvf_config_rss(nic);
523 return 0;
524 }
regards,
dan carpenter
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
index 0fc4a53..16bd2d7 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
@@ -504,8 +504,7 @@ static int nicvf_set_rxfh(struct net_device *dev, const u32 *indir,
}
/* We do not allow change in unsupported parameters */
- if (hkey ||
- (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
+ if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
rss->enable = true;
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 07/10] net: thunderx: fix nicvf_set_rxfh()
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
This fixes a copypaste bug that was discovered by a static analysis
tool:
The patch 4863dea3fab0: "net: Adding support for Cavium ThunderX
network controller" from May 26, 2015, leads to the following static
checker warning:
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c:517
nicvf_set_rxfh()
warn: we tested 'hkey' before and it was 'false'
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
506 /* We do not allow change in unsupported parameters */
507 if (hkey ||
^^^^
We return here.
508 (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc !=
ETH_RSS_HASH_TOP))
509 return -EOPNOTSUPP;
510
511 rss->enable = true;
512 if (indir) {
513 for (idx = 0; idx < rss->rss_size; idx++)
514 rss->ind_tbl[idx] = indir[idx];
515 }
516
517 if (hkey) {
^^^^
So this is dead code.
518 memcpy(rss->key, hkey, RSS_HASH_KEY_SIZE *
sizeof(u64));
519 nicvf_set_rss_key(nic);
520 }
521
522 nicvf_config_rss(nic);
523 return 0;
524 }
regards,
dan carpenter
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
index 0fc4a53..16bd2d7 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
@@ -504,8 +504,7 @@ static int nicvf_set_rxfh(struct net_device *dev, const u32 *indir,
}
/* We do not allow change in unsupported parameters */
- if (hkey ||
- (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
+ if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
rss->enable = true;
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 08/10] net: thunderx: remove unneeded type conversions
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
No need to cast void* to u8*: pointer arithmetics
works same way for both.
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 7f0e108..8929029 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -62,8 +62,7 @@ static int nicvf_alloc_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem,
/* Align memory address for 'align_bytes' */
dmem->phys_base = NICVF_ALIGNED_ADDR((u64)dmem->dma, align_bytes);
- dmem->base = (void *)((u8 *)dmem->unalign_base +
- (dmem->phys_base - dmem->dma));
+ dmem->base = dmem->unalign_base + (dmem->phys_base - dmem->dma);
return 0;
}
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 08/10] net: thunderx: remove unneeded type conversions
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
No need to cast void* to u8*: pointer arithmetics
works same way for both.
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 7f0e108..8929029 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -62,8 +62,7 @@ static int nicvf_alloc_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem,
/* Align memory address for 'align_bytes' */
dmem->phys_base = NICVF_ALIGNED_ADDR((u64)dmem->dma, align_bytes);
- dmem->base = (void *)((u8 *)dmem->unalign_base +
- (dmem->phys_base - dmem->dma));
+ dmem->base = dmem->unalign_base + (dmem->phys_base - dmem->dma);
return 0;
}
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 09/10] net: thunderx: check if memory allocation was successful
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
This fixes a coccinelle warning:
coccinelle warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/cavium/thunder/nicvf_queues.c:360:1-11: alloc
>> with no test, possible model on line 367
vim +360 drivers/net/ethernet/cavium/thunder/nicvf_queues.c
354 err = nicvf_alloc_q_desc_mem(nic, &sq->dmem, q_len,
SND_QUEUE_DESC_SIZE,
355 NICVF_SQ_BASE_ALIGN_BYTES);
356 if (err)
357 return err;
358
359 sq->desc = sq->dmem.base;
> 360 sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_ATOMIC);
361 sq->head = 0;
362 sq->tail = 0;
363 atomic_set(&sq->free_cnt, q_len - 1);
364 sq->thresh = SND_QUEUE_THRESH;
365
366 /* Preallocate memory for TSO segment's header */
> 367 sq->tso_hdrs = dma_alloc_coherent(&nic->pdev->dev,
368 q_len *
TSO_HEADER_SIZE,
369 &sq->tso_hdrs_phys,
GFP_KERNEL);
370 if (!sq->tso_hdrs)
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 8929029..2ed7d1b 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -357,6 +357,8 @@ static int nicvf_init_snd_queue(struct nicvf *nic,
sq->desc = sq->dmem.base;
sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_ATOMIC);
+ if (!sq->skbuff)
+ return -ENOMEM;
sq->head = 0;
sq->tail = 0;
atomic_set(&sq->free_cnt, q_len - 1);
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 09/10] net: thunderx: check if memory allocation was successful
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
This fixes a coccinelle warning:
coccinelle warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/cavium/thunder/nicvf_queues.c:360:1-11: alloc
>> with no test, possible model on line 367
vim +360 drivers/net/ethernet/cavium/thunder/nicvf_queues.c
354 err = nicvf_alloc_q_desc_mem(nic, &sq->dmem, q_len,
SND_QUEUE_DESC_SIZE,
355 NICVF_SQ_BASE_ALIGN_BYTES);
356 if (err)
357 return err;
358
359 sq->desc = sq->dmem.base;
> 360 sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_ATOMIC);
361 sq->head = 0;
362 sq->tail = 0;
363 atomic_set(&sq->free_cnt, q_len - 1);
364 sq->thresh = SND_QUEUE_THRESH;
365
366 /* Preallocate memory for TSO segment's header */
> 367 sq->tso_hdrs = dma_alloc_coherent(&nic->pdev->dev,
368 q_len *
TSO_HEADER_SIZE,
369 &sq->tso_hdrs_phys,
GFP_KERNEL);
370 if (!sq->tso_hdrs)
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 8929029..2ed7d1b 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -357,6 +357,8 @@ static int nicvf_init_snd_queue(struct nicvf *nic,
sq->desc = sq->dmem.base;
sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_ATOMIC);
+ if (!sq->skbuff)
+ return -ENOMEM;
sq->head = 0;
sq->tail = 0;
atomic_set(&sq->free_cnt, q_len - 1);
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 10/10] net: thunderx: use GFP_KERNEL in thread context
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 18:00 ` Aleksey Makarov
-1 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-arm-kernel, David Daney, Robert Richter,
Aleksey Makarov, Sunil Goutham, Robert Richter
GFP_KERNEL should be used in the thread context
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 2ed7d1b..d69d228 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -356,7 +356,7 @@ static int nicvf_init_snd_queue(struct nicvf *nic,
return err;
sq->desc = sq->dmem.base;
- sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_ATOMIC);
+ sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_KERNEL);
if (!sq->skbuff)
return -ENOMEM;
sq->head = 0;
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 10/10] net: thunderx: use GFP_KERNEL in thread context
@ 2015-06-02 18:00 ` Aleksey Makarov
0 siblings, 0 replies; 25+ messages in thread
From: Aleksey Makarov @ 2015-06-02 18:00 UTC (permalink / raw)
To: linux-arm-kernel
GFP_KERNEL should be used in the thread context
Signed-off-by: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 2ed7d1b..d69d228 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -356,7 +356,7 @@ static int nicvf_init_snd_queue(struct nicvf *nic,
return err;
sq->desc = sq->dmem.base;
- sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_ATOMIC);
+ sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_KERNEL);
if (!sq->skbuff)
return -ENOMEM;
sq->head = 0;
--
2.4.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 00/10] net: thunderx: fix problems reported by static check tools
2015-06-02 18:00 ` Aleksey Makarov
@ 2015-06-02 19:56 ` David Miller
-1 siblings, 0 replies; 25+ messages in thread
From: David Miller @ 2015-06-02 19:56 UTC (permalink / raw)
To: aleksey.makarov
Cc: netdev, linux-kernel, linux-arm-kernel, david.daney, robert.richter
From: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
Date: Tue, 2 Jun 2015 11:00:17 -0700
> These are fixes for the problems that were reported by static check tools.
Series applied, thanks.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 00/10] net: thunderx: fix problems reported by static check tools
@ 2015-06-02 19:56 ` David Miller
0 siblings, 0 replies; 25+ messages in thread
From: David Miller @ 2015-06-02 19:56 UTC (permalink / raw)
To: linux-arm-kernel
From: Aleksey Makarov <aleksey.makarov@caviumnetworks.com>
Date: Tue, 2 Jun 2015 11:00:17 -0700
> These are fixes for the problems that were reported by static check tools.
Series applied, thanks.
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2015-06-02 19:56 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-02 18:00 [PATCH 00/10] net: thunderx: fix problems reported by static check tools Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 01/10] net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id() Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 02/10] net: thunderx: fix constants Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 03/10] net: thunderx: introduce a function for mailbox access Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 04/10] net: thunderx: rework mac address handling Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 05/10] net: thunderx: delete unused variables Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 06/10] net: thunderx: add static Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 07/10] net: thunderx: fix nicvf_set_rxfh() Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 08/10] net: thunderx: remove unneeded type conversions Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 09/10] net: thunderx: check if memory allocation was successful Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 18:00 ` [PATCH 10/10] net: thunderx: use GFP_KERNEL in thread context Aleksey Makarov
2015-06-02 18:00 ` Aleksey Makarov
2015-06-02 19:56 ` [PATCH 00/10] net: thunderx: fix problems reported by static check tools David Miller
2015-06-02 19:56 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.