* [PATCH net-next 09/12] be2net: make be_cmd_get_regs() return a status
From: Sathya Perla @ 2014-09-01 6:24 UTC (permalink / raw)
To: netdev
In-Reply-To: <1409552664-15990-1-git-send-email-sathya.perla@emulex.com>
From: Vasundhara Volam <vasundhara.volam@emulex.com>
There are a few failure cases in be_cmd_get_regs() that ideally must return
an error value. This style is used across all the routines in be_cmds.c with
this routine being an exception. This patch fixes this.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 10 +++++-----
drivers/net/ethernet/emulex/benet/be_cmds.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index ca9ec18..5be100d 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1681,17 +1681,17 @@ err:
return status;
}
-void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
+int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
{
struct be_dma_mem get_fat_cmd;
struct be_mcc_wrb *wrb;
struct be_cmd_req_get_fat *req;
u32 offset = 0, total_size, buf_size,
log_offset = sizeof(u32), payload_len;
- int status;
+ int status = 0;
if (buf_len == 0)
- return;
+ return -EIO;
total_size = buf_len;
@@ -1700,10 +1700,9 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
get_fat_cmd.size,
&get_fat_cmd.dma);
if (!get_fat_cmd.va) {
- status = -ENOMEM;
dev_err(&adapter->pdev->dev,
"Memory allocation failure while retrieving FAT data\n");
- return;
+ return -ENOMEM;
}
spin_lock_bh(&adapter->mcc_lock);
@@ -1746,6 +1745,7 @@ err:
pci_free_consistent(adapter->pdev, get_fat_cmd.size,
get_fat_cmd.va, get_fat_cmd.dma);
spin_unlock_bh(&adapter->mcc_lock);
+ return status;
}
/* Uses synchronous mcc */
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 5284b82..0e11868 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -2101,7 +2101,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter);
int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
int be_cmd_req_native_mode(struct be_adapter *adapter);
int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
-void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
+int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
u32 domain);
int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 06/12] be2net: fix log messages in lancer FW download path
From: Sathya Perla @ 2014-09-01 6:24 UTC (permalink / raw)
To: netdev
In-Reply-To: <1409552664-15990-1-git-send-email-sathya.perla@emulex.com>
From: Kalesh AP <kalesh.purayil@emulex.com>
Log messages in the Lancer FW download path have issues such as:
- a single message spanning multiple lines
- the success message is logged even in failure cases
- status codes are already logged in the FW cmd routines
This patch fixes these issues.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 30 +++++++++-----------------
1 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index c95998f..7e89e5b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -4076,6 +4076,7 @@ static int lancer_fw_download(struct be_adapter *adapter,
{
#define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024)
#define LANCER_FW_DOWNLOAD_LOCATION "/prg"
+ struct device *dev = &adapter->pdev->dev;
struct be_dma_mem flash_cmd;
const u8 *data_ptr = NULL;
u8 *dest_image_ptr = NULL;
@@ -4088,16 +4089,14 @@ static int lancer_fw_download(struct be_adapter *adapter,
u8 change_status;
if (!IS_ALIGNED(fw->size, sizeof(u32))) {
- dev_err(&adapter->pdev->dev,
- "FW Image not properly aligned. "
- "Length must be 4 byte aligned.\n");
+ dev_err(dev, "FW image size should be multiple of 4\n");
status = -EINVAL;
goto lancer_fw_exit;
}
flash_cmd.size = sizeof(struct lancer_cmd_req_write_object)
+ LANCER_FW_DOWNLOAD_CHUNK;
- flash_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, flash_cmd.size,
+ flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size,
&flash_cmd.dma, GFP_KERNEL);
if (!flash_cmd.va) {
status = -ENOMEM;
@@ -4137,33 +4136,26 @@ static int lancer_fw_download(struct be_adapter *adapter,
&add_status);
}
- dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va,
- flash_cmd.dma);
+ dma_free_coherent(dev, flash_cmd.size, flash_cmd.va, flash_cmd.dma);
if (status) {
- dev_err(&adapter->pdev->dev,
- "Firmware load error. "
- "Status code: 0x%x Additional Status: 0x%x\n",
- status, add_status);
+ dev_err(dev, "Firmware load error\n");
goto lancer_fw_exit;
}
+ dev_info(dev, "Firmware flashed successfully\n");
+
if (change_status == LANCER_FW_RESET_NEEDED) {
- dev_info(&adapter->pdev->dev,
- "Resetting adapter to activate new FW\n");
+ dev_info(dev, "Resetting adapter to activate new FW\n");
status = lancer_physdev_ctrl(adapter,
PHYSDEV_CONTROL_FW_RESET_MASK);
if (status) {
- dev_err(&adapter->pdev->dev,
- "Adapter busy for FW reset.\n"
- "New FW will not be active.\n");
+ dev_err(dev, "Adapter busy, could not reset FW\n");
+ dev_err(dev, "Reboot server to activate new FW\n");
goto lancer_fw_exit;
}
} else if (change_status != LANCER_NO_RESET_NEEDED) {
- dev_err(&adapter->pdev->dev,
- "System reboot required for new FW to be active\n");
+ dev_info(dev, "Reboot server to activate new FW\n");
}
-
- dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n");
lancer_fw_exit:
return status;
}
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 08/12] be2net: define BE_MAX_MTU
From: Sathya Perla @ 2014-09-01 6:24 UTC (permalink / raw)
To: netdev
In-Reply-To: <1409552664-15990-1-git-send-email-sathya.perla@emulex.com>
From: Kalesh AP <kalesh.purayil@emulex.com>
This patch defines a new macro BE_MAX_MTU to make the code in be_change_mtu()
more readable.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 2 ++
drivers/net/ethernet/emulex/benet/be_main.c | 14 +++++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 069bdda..5ccfce7 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -86,6 +86,8 @@ static inline char *nic_name(struct pci_dev *pdev)
#define BE_MAX_JUMBO_FRAME_SIZE 9018
#define BE_MIN_MTU 256
+#define BE_MAX_MTU (BE_MAX_JUMBO_FRAME_SIZE - \
+ (ETH_HLEN + ETH_FCS_LEN))
#define BE_NUM_VLANS_SUPPORTED 64
#define BE_MAX_EQD 128u
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index cdad8bc..04a8092 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1073,15 +1073,15 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
static int be_change_mtu(struct net_device *netdev, int new_mtu)
{
struct be_adapter *adapter = netdev_priv(netdev);
- if (new_mtu < BE_MIN_MTU ||
- new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))) {
- dev_info(&adapter->pdev->dev,
- "MTU must be between %d and %d bytes\n",
- BE_MIN_MTU,
- (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN)));
+ struct device *dev = &adapter->pdev->dev;
+
+ if (new_mtu < BE_MIN_MTU || new_mtu > BE_MAX_MTU) {
+ dev_info(dev, "MTU must be between %d and %d bytes\n",
+ BE_MIN_MTU, BE_MAX_MTU);
return -EINVAL;
}
- dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n",
+
+ dev_info(dev, "MTU changed from %d to %d bytes\n",
netdev->mtu, new_mtu);
netdev->mtu = new_mtu;
return 0;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 11/12] be2net: define macro for_all_tx_queues_on_eq()
From: Sathya Perla @ 2014-09-01 6:24 UTC (permalink / raw)
To: netdev
In-Reply-To: <1409552664-15990-1-git-send-email-sathya.perla@emulex.com>
Replace the for() loop that traverses all the TX queues on an EQ
with the macro for_all_tx_queues_on_eq(). With this expalnatory
name, the one line comment is not required anymore.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 4 ++++
drivers/net/ethernet/emulex/benet/be_main.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index d952ca2..a9f239a 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -621,6 +621,10 @@ extern const struct ethtool_ops be_ethtool_ops;
for (i = eqo->idx, rxo = &adapter->rx_obj[i]; i < adapter->num_rx_qs;\
i += adapter->num_evt_qs, rxo += adapter->num_evt_qs)
+#define for_all_tx_queues_on_eq(adapter, eqo, txo, i) \
+ for (i = eqo->idx, txo = &adapter->tx_obj[i]; i < adapter->num_tx_qs;\
+ i += adapter->num_evt_qs, txo += adapter->num_evt_qs)
+
#define is_mcc_eqo(eqo) (eqo->idx == 0)
#define mcc_eqo(adapter) (&adapter->eq_obj[0])
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 53727ad..f3235d1 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2503,12 +2503,12 @@ int be_poll(struct napi_struct *napi, int budget)
struct be_adapter *adapter = eqo->adapter;
int max_work = 0, work, i, num_evts;
struct be_rx_obj *rxo;
+ struct be_tx_obj *txo;
num_evts = events_get(eqo);
- /* Process all TXQs serviced by this EQ */
- for (i = eqo->idx; i < adapter->num_tx_qs; i += adapter->num_evt_qs)
- be_process_tx(adapter, &adapter->tx_obj[i], i);
+ for_all_tx_queues_on_eq(adapter, eqo, txo, i)
+ be_process_tx(adapter, txo, i);
if (be_lock_napi(eqo)) {
/* This loop will iterate twice for EQ0 in which
--
1.7.1
^ permalink raw reply related
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Eliezer Tamir @ 2014-09-01 6:39 UTC (permalink / raw)
To: Jason Wang, Ingo Molnar
Cc: Mike Galbraith, davem, netdev, linux-kernel, mst, Peter Zijlstra,
Ingo Molnar
In-Reply-To: <53FFEEC0.4000304@redhat.com>
On 29/08/2014 06:08, Jason Wang wrote:
> Yes, but rx busy polling only works in process context and does not
> disable bh, so it may be not an issue.
sk_busy_loop() uses rcu_read_lock_bh(), so it does run with bh disabled.
-Eliezer
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Eliezer Tamir @ 2014-09-01 6:55 UTC (permalink / raw)
To: Jason Wang, Eric Dumazet
Cc: Ingo Molnar, Mike Galbraith, davem, netdev, linux-kernel, mst,
Peter Zijlstra, Ingo Molnar jacob.e.keller@intel.com
In-Reply-To: <53FC3466.8000304@redhat.com>
On 26/08/2014 10:16, Jason Wang wrote:
> On 08/25/2014 09:16 PM, Eliezer Tamir wrote:
>> Here are my 2 cents:
>> I think Ingo's suggestion of only yielding to tasks with same or higher
>> priority makes sense.
>
> I'm not sure I get your meaning. Do you mean calling yield_to() directly
> in sk_busy_loop?
Think about the case where two processes are busy polling on the
same CPU and the same device queue. Since busy polling processes
incoming packets on the queue from any process, this scenario works
well currently, and will not work at all when polling yields to other
processes that are of the same priority that are running on the same
CPU.
As a side note, there is a lot of room for improvement when two
processes on the same CPU want to busy poll on different device
queues.
The RFC code I published for epoll support showed one possible
way of solving this, but I'm sure that there are other possibilities.
Maybe the networking subsystem should maintain a list of device
queues that need busypolling and have a thread that would poll
all of them when there's nothing better to do.
I'm aware of similar work on busy polling on NVMe devices, so
maybe there should be a global busypoll thread for all devices
that support it.
BTW, I have someone inside Intel that wants to test future patches. Feel
free to send me patches for testing, even if they are not ready for
publishing yet.
Cheers,
Eliezer
^ permalink raw reply
* [PATCH] netlink: Safer deletion of sk_bind_node
From: Harish, Jenny, K, N @ 2014-09-01 7:08 UTC (permalink / raw)
To: davem
Cc: dborkman, tgraf, ebiederm, darkjames-ws, rgb, eric.dumazet,
stephen, netdev, linux-kernel
From: Harish Jenny K N <harish_kandiga@mentor.com>
Unable to handle kernel NULL pointer dereference at virtual address 00000000
(netlink_release+0x0/0x2a0) from [<8034e78c>] (sock_release+0x28/0xa4)
(sock_release+0x0/0xa4) from [<8034e830>] (sock_close+0x28/0x34)
(sock_close+0x0/0x34) from [<800f3490>] (__fput+0xf0/0x1ec)
(__fput+0x0/0x1ec) from [<800f3634>] (____fput+0x10/0x14)
(____fput+0x0/0x14) from [<80040a64>] (task_work_run+0xb8/0xd8)
(task_work_run+0x0/0xd8) from [<800113a0>] (do_work_pending+0xb0/0xc4)
(do_work_pending+0x0/0xc4) from [<8000d960>] (work_pending+0xc/0x20)
Call flow of the inline and static functions
netlink_release
-----netlink_remove
---------__sk_del_bind_node
--------------__hlist_del
Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com>
---
net/netlink/af_netlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c416725..21a6b32 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1103,7 +1103,7 @@ static void netlink_remove(struct sock *sk)
netlink_table_grab();
if (nlk_sk(sk)->subscriptions)
- __sk_del_bind_node(sk);
+ hlist_del_init(&sk->sk_bind_node);
netlink_table_ungrab();
}
@@ -1382,7 +1382,7 @@ netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
struct netlink_sock *nlk = nlk_sk(sk);
if (nlk->subscriptions && !subscriptions)
- __sk_del_bind_node(sk);
+ hlist_del_init(&sk->sk_bind_node);
else if (!nlk->subscriptions && subscriptions)
sk_add_bind_node(sk, &nl_table[sk->sk_protocol].mc_list);
nlk->subscriptions = subscriptions;
--
1.7.9.5
^ permalink raw reply related
* [PATCH (net.git) 2/2] stmmac: only remove RXCSUM feature if no rx coe is available
From: Giuseppe Cavallaro @ 2014-09-01 7:17 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
In-Reply-To: <1409555873-5478-1-git-send-email-peppe.cavallaro@st.com>
In case of the HW is not able to do the receive checksum offloading
the only feature to remove is NETIF_F_RXCSUM.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 56e5c1b..8da95d56 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2329,8 +2329,6 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
if (priv->plat->rx_coe == STMMAC_RX_COE_NONE)
features &= ~NETIF_F_RXCSUM;
- else if (priv->plat->rx_coe == STMMAC_RX_COE_TYPE1)
- features &= ~NETIF_F_IPV6_CSUM;
if (!priv->plat->tx_coe)
features &= ~NETIF_F_ALL_CSUM;
--
1.7.4.4
^ permalink raw reply related
* [PATCH (net.git) 1/2] stmmac: fix the rx csum feature
From: Giuseppe Cavallaro @ 2014-09-01 7:17 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
For new GMACs it is possible to turn-on/off the COE.
In the current driver, when disabled the Rx-checksum
via ethtool, the tool reported that csum was disabled
but the HW continued to set the IPC. Indeed this is
because the fix_features allows this. So the patch
fixes this problem by adding the set_features.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 6 +++-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 27 ++++++++++++++++++-
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index bd54238..a2aba1f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -445,6 +445,7 @@ struct mac_device_info {
int multicast_filter_bins;
int unicast_filter_entries;
int mcast_bits_log2;
+ unsigned int rx_csum;
};
struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index d8ef187..5efe60e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -58,7 +58,11 @@ static int dwmac1000_rx_ipc_enable(struct mac_device_info *hw)
void __iomem *ioaddr = hw->pcsr;
u32 value = readl(ioaddr + GMAC_CONTROL);
- value |= GMAC_CONTROL_IPC;
+ if (hw->rx_csum)
+ value |= GMAC_CONTROL_IPC;
+ else
+ value &= ~GMAC_CONTROL_IPC;
+
writel(value, ioaddr + GMAC_CONTROL);
value = readl(ioaddr + GMAC_CONTROL);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index df15f00..56e5c1b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1669,6 +1669,7 @@ static int stmmac_hw_setup(struct net_device *dev)
if (!ret) {
pr_warn(" RX IPC Checksum Offload disabled\n");
priv->plat->rx_coe = STMMAC_RX_COE_NONE;
+ priv->hw->rx_csum = 0;
}
/* Enable the MAC Rx/Tx */
@@ -2107,7 +2108,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
unsigned int entry = priv->cur_rx % rxsize;
unsigned int next_entry;
unsigned int count = 0;
- int coe = priv->plat->rx_coe;
+ int coe = priv->hw->rx_csum;
if (netif_msg_rx_status(priv)) {
pr_debug("%s: descriptor ring:\n", __func__);
@@ -2330,6 +2331,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
features &= ~NETIF_F_RXCSUM;
else if (priv->plat->rx_coe == STMMAC_RX_COE_TYPE1)
features &= ~NETIF_F_IPV6_CSUM;
+
if (!priv->plat->tx_coe)
features &= ~NETIF_F_ALL_CSUM;
@@ -2344,6 +2346,24 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
return features;
}
+static int stmmac_set_features(struct net_device *netdev,
+ netdev_features_t features)
+{
+ struct stmmac_priv *priv = netdev_priv(netdev);
+
+ /* Keep the COE Type in case of csum is supporting */
+ if (features & NETIF_F_RXCSUM)
+ priv->hw->rx_csum = priv->plat->rx_coe;
+ else
+ priv->hw->rx_csum = 0;
+ /* No check needed because rx_coe has been set before and it will be
+ * fixed in case of issue.
+ */
+ priv->hw->mac->rx_ipc(priv->hw);
+
+ return 0;
+}
+
/**
* stmmac_interrupt - main ISR
* @irq: interrupt number.
@@ -2624,6 +2644,7 @@ static const struct net_device_ops stmmac_netdev_ops = {
.ndo_stop = stmmac_release,
.ndo_change_mtu = stmmac_change_mtu,
.ndo_fix_features = stmmac_fix_features,
+ .ndo_set_features = stmmac_set_features,
.ndo_set_rx_mode = stmmac_set_rx_mode,
.ndo_tx_timeout = stmmac_tx_timeout,
.ndo_do_ioctl = stmmac_ioctl,
@@ -2700,9 +2721,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
/* To use alternate (extended) or normal descriptor structures */
stmmac_selec_desc_mode(priv);
- if (priv->plat->rx_coe)
+ if (priv->plat->rx_coe) {
+ priv->hw->rx_csum = priv->plat->rx_coe;
pr_info(" RX Checksum Offload Engine supported (type %d)\n",
priv->plat->rx_coe);
+ }
if (priv->plat->tx_coe)
pr_info(" TX Checksum insertion supported\n");
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH 0/3] Basic deferred TX queue flushing infrastructure.
From: Jesper Dangaard Brouer @ 2014-09-01 7:40 UTC (permalink / raw)
To: David Miller
Cc: brouer, cwang, netdev, therbert, jhs, hannes, edumazet,
jeffrey.t.kirsher, rusty
In-Reply-To: <20140825.153146.2165451041039058085.davem@davemloft.net>
On Mon, 25 Aug 2014 15:31:46 -0700 (PDT) David Miller <davem@davemloft.net> wrote:
> It occurs to me that perhaps the thing to do is to pass sk_buff ** to
> dev_hard_start_xmit().
Is this to send an array of skb's to dev_hard_start_xmit()?
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply
* Re: [patch net-next RFC 10/12] openvswitch: add support for datapath hardware offload
From: Simon Horman @ 2014-09-01 8:13 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: ryazanov.s.a-Re5JQEeQqe8AvxtiuMwx3w, ronye-VPRAkNaXOzVWk0Htik3J/w,
jasowang-H+wXaHxf7aLQT0dZR+AlfA,
john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w,
Neil.Jerram-QnUH15yq9NYqDJ6do+/SaQ, Eric Dumazet, Andy Gospodarek,
dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
nbd-p3rKhJxN3npAfugRpC6u6w, Florian Fainelli, Andy Gospodarek,
Shrijeet Mukherjee, John Fastabend,
jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, ogerlitz,
ben-/+tVBieCtBitmTQ+vhA3Yw, buytenh-OLH4Qvv75CYX/NnBR394Jw,
Jiri Pirko, Roopa Prabhu, aviadr-VPRAkNaXOzVWk0Htik3J/w,
Nicolas Dichtel, vyasevic-H+wXaHxf7aLQT0dZR+AlfA, Neil Horman,
netdev, Stephen Hemminger, dborkman, Eric W. Biederman
In-Reply-To: <54008C47.5040503-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
On Fri, Aug 29, 2014 at 10:20:55AM -0400, Jamal Hadi Salim wrote:
> On 08/26/14 16:54, Thomas Graf wrote:
> >On 08/26/14 at 01:13pm, Alexei Starovoitov wrote:
> >>I think it's important distinction. In-kernel OVS is not OF.
> >>It's a networking function that has hard-coded packet parser,
> >>N-tuple match and programmable actions.
> >>There were times when HW vendors were using OF check-box
> >>to sell more chips, but at the end there is not a single HW
> >>that is fully OF compliant. OF brand is still around, but
> >>OF 2.0 is not tcam+action anymore.
> >>Imo trying to standardize HW offload interface based on OF 1.x
> >>principles is strange.
>
>
> I actually have no issues with whatever classifier someone decides
> to use. To each their poison. But I do take issue mandating the
> specified classifer it as THE CLASSIFIER as in this case,
> is where i start taking issue. I have a few things that i offload
> to hardware with speacilized classifiers such that i object strongly
> to the approach this driver has taken.
My reading of this thread is that allowing different classifiers
is not under dispute.
^ permalink raw reply
* Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA
From: Arend van Spriel @ 2014-09-01 8:21 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Brett Rudley, John W. Linville, David S. Miller, linux-wireless,
brcm80211-dev-list, netdev, linux-kernel
In-Reply-To: <1409329464-768-1-git-send-email-geert@linux-m68k.org>
On 08/29/14 18:24, Geert Uytterhoeven wrote:
> If NO_DMA=y:
>
> drivers/built-in.o: In function `brcmf_msgbuf_release_array':
> msgbuf.c:(.text+0x34dbbe): undefined reference to `dma_unmap_single'
> drivers/built-in.o: In function `brcmf_proto_msgbuf_detach':
> (.text+0x34dca4): undefined reference to `dma_free_coherent'
> drivers/built-in.o: In function `brcmf_msgbuf_get_pktid':
> msgbuf.c:(.text+0x34dd2a): undefined reference to `dma_unmap_single'
> drivers/built-in.o: In function `brcmf_msgbuf_alloc_pktid':
> msgbuf.c:(.text+0x34de12): undefined reference to `dma_map_single'
> msgbuf.c:(.text+0x34de20): undefined reference to `dma_mapping_error'
> drivers/built-in.o: In function `brcmf_msgbuf_remove_flowring':
> msgbuf.c:(.text+0x34e3d6): undefined reference to `dma_free_coherent'
> drivers/built-in.o: In function `brcmf_msgbuf_flowring_create':
> msgbuf.c:(.text+0x34e4f8): undefined reference to `dma_alloc_coherent'
> drivers/built-in.o: In function `brcmf_proto_msgbuf_attach':
> (.text+0x34f5fe): undefined reference to `dma_alloc_coherent'
> drivers/built-in.o: In function `brcmf_proto_msgbuf_attach':
> (.text+0x34f798): undefined reference to `dma_free_coherent'
>
> Signed-off-by: Geert Uytterhoeven<geert@linux-m68k.org>
> ---
> drivers/net/wireless/brcm80211/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig
> index b8e2561ea645..2e0da8925834 100644
> --- a/drivers/net/wireless/brcm80211/Kconfig
> +++ b/drivers/net/wireless/brcm80211/Kconfig
> @@ -19,7 +19,7 @@ config BRCMSMAC
>
> config BRCMFMAC
> tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
> - depends on CFG80211
> + depends on CFG80211A&& HAS_DMA
Hi Geert,
Not sure what happened here, but CFG80211 kconfig option did was not
renamed as far as I know. Anyway, I would like to propose a different
solution. Will get back to you when I have it ready.
Regards,
Arend
> select BRCMUTIL
> ---help---
> This module adds support for embedded wireless adapters based on
^ permalink raw reply
* [PATCH v3] ethernet: arc: Add support for Rockchip SoC layer device tree bindings
From: Romain Perier @ 2014-09-01 8:33 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel, netdev, arnd
This patch defines a platform glue layer for Rockchip SoCs which
support arc-emac driver. It ensures that regulator for the rmii is on
before trying to connect to the ethernet controller. It applies right
speed and mode changes to the grf when ethernet settings change.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
drivers/net/ethernet/arc/Kconfig | 10 ++
drivers/net/ethernet/arc/Makefile | 1 +
drivers/net/ethernet/arc/emac.h | 4 +-
drivers/net/ethernet/arc/emac_main.c | 2 +
drivers/net/ethernet/arc/emac_rockchip.c | 224 +++++++++++++++++++++++++++++++
5 files changed, 240 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ethernet/arc/emac_rockchip.c
diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig
index 89e04fd..0c0063b 100644
--- a/drivers/net/ethernet/arc/Kconfig
+++ b/drivers/net/ethernet/arc/Kconfig
@@ -32,4 +32,14 @@ config ARC_EMAC
non-standard on-chip ethernet device ARC EMAC 10/100 is used.
Say Y here if you have such a board. If unsure, say N.
+config EMAC_ROCKCHIP
+ tristate "Rockchip EMAC support"
+ select ARC_EMAC_CORE
+ depends on OF_IRQ && OF_NET && REGULATOR
+ ---help---
+ Support for Rockchip RK3066/RK3188 EMAC ethernet controllers.
+ This selects Rockchip SoC glue layer support for the
+ emac device driver. This driver is used for RK3066/RK3188
+ EMAC ethernet controller.
+
endif # NET_VENDOR_ARC
diff --git a/drivers/net/ethernet/arc/Makefile b/drivers/net/ethernet/arc/Makefile
index 241bb80..79108af 100644
--- a/drivers/net/ethernet/arc/Makefile
+++ b/drivers/net/ethernet/arc/Makefile
@@ -5,3 +5,4 @@
arc_emac-objs := emac_main.o emac_mdio.o
obj-$(CONFIG_ARC_EMAC_CORE) += arc_emac.o
obj-$(CONFIG_ARC_EMAC) += emac_arc.o
+obj-$(CONFIG_EMAC_ROCKCHIP) += emac_rockchip.o
diff --git a/drivers/net/ethernet/arc/emac.h b/drivers/net/ethernet/arc/emac.h
index eb2ba67..dae1ac3 100644
--- a/drivers/net/ethernet/arc/emac.h
+++ b/drivers/net/ethernet/arc/emac.h
@@ -123,9 +123,11 @@ struct buffer_state {
* @speed: PHY's last set speed.
*/
struct arc_emac_priv {
- /* Devices */
const char *drv_name;
const char *drv_version;
+ void (*set_mac_speed)(void *priv, unsigned int speed);
+
+ /* Devices */
struct device *dev;
struct phy_device *phy_dev;
struct mii_bus *bus;
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index b35c69e..a08f343 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -48,6 +48,8 @@ static void arc_emac_adjust_link(struct net_device *ndev)
if (priv->speed != phy_dev->speed) {
priv->speed = phy_dev->speed;
state_changed = 1;
+ if (priv->set_mac_speed)
+ priv->set_mac_speed(priv, priv->speed);
}
if (priv->duplex != phy_dev->duplex) {
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
new file mode 100644
index 0000000..d1d367a
--- /dev/null
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -0,0 +1,224 @@
+/**
+ * emac-rockchip.c - Rockchip EMAC specific glue layer
+ *
+ * Copyright (C) 2014 Romain Perier
+ *
+ * Romain Perier <romain.perier@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/etherdevice.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_net.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+
+#include "emac.h"
+
+#define DRV_NAME "rockchip_emac"
+#define DRV_VERSION "1.0"
+
+#define GRF_MODE_MII (1UL << 0)
+#define GRF_MODE_RMII (0UL << 0)
+#define GRF_SPEED_10M (0UL << 1)
+#define GRF_SPEED_100M (1UL << 1)
+#define GRF_SPEED_ENABLE_BIT (1UL << 17)
+#define GRF_MODE_ENABLE_BIT (1UL << 16)
+
+struct emac_rockchip_soc_data {
+ int grf_offset;
+};
+
+struct rockchip_priv_data {
+ struct arc_emac_priv emac;
+ struct regmap *grf;
+ const struct emac_rockchip_soc_data *soc_data;
+ struct regulator *regulator;
+ struct clk *refclk;
+};
+
+static const struct emac_rockchip_soc_data emac_rockchip_dt_data[] = {
+ { .grf_offset = 0x154 }, /* rk3066 */
+ { .grf_offset = 0x0a4 }, /* rk3188 */
+};
+
+static const struct of_device_id emac_rockchip_dt_ids[] = {
+ { .compatible = "rockchip,rk3066-emac", .data = &emac_rockchip_dt_data[0]},
+ { .compatible = "rockchip,rk3188-emac", .data = &emac_rockchip_dt_data[1]},
+ { /* Sentinel */ }
+};
+
+static void emac_rockchip_set_mac_speed(void *priv, unsigned int speed)
+{
+ struct rockchip_priv_data *emac = priv;
+ u32 data;
+ int err = 0;
+
+ /* write-enable bits */
+ data = GRF_SPEED_ENABLE_BIT;
+
+ switch(speed) {
+ case 10:
+ data |= GRF_SPEED_10M;
+ break;
+ case 100:
+ data |= GRF_SPEED_100M;
+ break;
+ default:
+ pr_err("speed %u not supported\n", speed);
+ return;
+ }
+
+ err = regmap_write(emac->grf, emac->soc_data->grf_offset, data);
+ if (err)
+ pr_err("unable to apply speed %u to grf (%d)\n", speed, err);
+}
+
+static int emac_rockchip_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct net_device *ndev;
+ struct rockchip_priv_data *priv;
+ const struct of_device_id *match;
+ u32 data;
+ int err, interface;
+
+ if (!pdev->dev.of_node)
+ return -ENODEV;
+
+ ndev = alloc_etherdev(sizeof(struct rockchip_priv_data));
+ if (!ndev)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, ndev);
+ SET_NETDEV_DEV(ndev, dev);
+
+ priv = netdev_priv(ndev);
+ priv->emac.drv_name = DRV_NAME;
+ priv->emac.drv_version = DRV_VERSION;
+ priv->emac.set_mac_speed = emac_rockchip_set_mac_speed;
+
+ interface = of_get_phy_mode(dev->of_node);
+
+ /* RK3066 and RK3188 SoCs only support RMII */
+ if (interface != PHY_INTERFACE_MODE_RMII) {
+ dev_err(dev, "unsupported phy interface mode %d\n", interface);
+ err = -ENOTSUPP;
+ goto out_netdev;
+ }
+
+ priv->grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
+ if (IS_ERR(priv->grf)) {
+ dev_err(dev, "failed to retrieve global register file from the device tree (%ld)\n", PTR_ERR(priv->grf));
+ err = PTR_ERR(priv->grf);
+ goto out_netdev;
+ }
+
+ match = of_match_node(emac_rockchip_dt_ids, dev->of_node);
+ priv->soc_data = match->data;
+
+ priv->emac.clk = devm_clk_get(dev, "hclk");
+ if (IS_ERR(priv->emac.clk)) {
+ dev_err(dev, "failed to retrieve host clock from device tree (%ld)\n", PTR_ERR(priv->emac.clk));
+ err = PTR_ERR(priv->emac.clk);
+ goto out_netdev;
+ }
+
+ priv->refclk = devm_clk_get(dev, "macref");
+ if (IS_ERR(priv->refclk)) {
+ dev_err(dev, "failed to retrieve reference clock from device tree (%ld)\n", PTR_ERR(priv->refclk));
+ err = PTR_ERR(priv->refclk);
+ goto out_netdev;
+ }
+
+ err = clk_prepare_enable(priv->refclk);
+ if (err) {
+ dev_err(dev, "failed to enable reference clock (%d)\n", err);
+ goto out_netdev;
+ }
+
+ /* Optional regulator for PHY */
+ priv->regulator = devm_regulator_get_optional(dev, "phy");
+ if (IS_ERR(priv->regulator)) {
+ if (PTR_ERR(priv->regulator) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ dev_err(dev, "no regulator found\n");
+ priv->regulator = NULL;
+ }
+
+ if (priv->regulator) {
+ err = regulator_enable(priv->regulator);
+ if (err) {
+ dev_err(dev, "failed to enable phy-supply (%d)\n", err);
+ goto out_netdev;
+ }
+ }
+
+ err = arc_emac_probe(ndev, interface);
+ if (err)
+ goto out_netdev;
+
+ /* write-enable bits */
+ data = GRF_MODE_ENABLE_BIT | GRF_SPEED_ENABLE_BIT;
+
+ data |= GRF_SPEED_100M;
+ data |= GRF_MODE_RMII;
+
+ err = regmap_write(priv->grf, priv->soc_data->grf_offset, data);
+ if (err) {
+ dev_err(dev, "unable to apply initial settings to grf (%d)\n", err);
+ goto out_netdev;
+ }
+
+ /* RMII interface needs always a rate of 50MHz */
+ err = clk_set_rate(priv->refclk, 50000000);
+ if (err)
+ dev_err(dev, "failed to change reference clock rate (%d)\n", err);
+
+out_netdev:
+ if (err)
+ free_netdev(ndev);
+ return err;
+}
+
+static int emac_rockchip_remove(struct platform_device *pdev)
+{
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct rockchip_priv_data *priv = netdev_priv(ndev);
+ int err;
+
+ clk_disable_unprepare(priv->refclk);
+
+ if (priv->regulator)
+ regulator_disable(priv->regulator);
+ err = arc_emac_remove(ndev);
+ free_netdev(ndev);
+ return err;
+}
+
+MODULE_DEVICE_TABLE(of, emac_rockchip_dt_ids);
+
+static struct platform_driver emac_rockchip_driver = {
+ .probe = emac_rockchip_probe,
+ .remove = emac_rockchip_remove,
+ .driver = {
+ .name = DRV_NAME,
+ .of_match_table = emac_rockchip_dt_ids,
+ },
+};
+
+module_platform_driver(emac_rockchip_driver);
+
+MODULE_AUTHOR("Romain Perier <romain.perier@gmail.com>");
+MODULE_DESCRIPTION("Rockchip EMAC platform driver");
+MODULE_LICENSE("GPL");
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA
From: Geert Uytterhoeven @ 2014-09-01 8:44 UTC (permalink / raw)
To: Arend van Spriel
Cc: Brett Rudley, John W. Linville, David S. Miller, linux-wireless,
brcm80211-dev-list, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <54042CA1.6010904@broadcom.com>
Hi Arend,
On Mon, Sep 1, 2014 at 10:21 AM, Arend van Spriel <arend@broadcom.com> wrote:
>> config BRCMFMAC
>> tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
>> - depends on CFG80211
>> + depends on CFG80211A&& HAS_DMA
>
> Not sure what happened here, but CFG80211 kconfig option did was not renamed
> as far as I know. Anyway, I would like to propose a different solution. Will
Oops, that was me typing the vim append-command twice :-(
Thanks for noticing!
> get back to you when I have it ready.
OK. Thanks again!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH net-next v3] lib/rhashtable: allow user to set the minimum shifts of shrinking
From: Thomas Graf @ 2014-09-01 9:03 UTC (permalink / raw)
To: Ying Xue; +Cc: davem, eric.dumazet, netdev
In-Reply-To: <1409381306-7036-1-git-send-email-ying.xue@windriver.com>
On 08/30/14 at 02:48pm, Ying Xue wrote:
> Although rhashtable library allows user to specify a quiet big size
> for user's created hash table, the table may be shrunk to a
> very small size - HASH_MIN_SIZE(4) after object is removed from
> the table at the first time. Subsequently, even if the total amount
> of objects saved in the table is quite lower than user's initial
> setting in a long time, the hash table size is still dynamically
> adjusted by rhashtable_shrink() or rhashtable_expand() each time
> object is inserted or removed from the table. However, as
> synchronize_rcu() has to be called when table is shrunk or
> expanded by the two functions, we should permit user to set the
> minimum table size through configuring the minimum number of shifts
> according to user specific requirement, avoiding these expensive
> actions of shrinking or expanding because of calling synchronize_rcu().
>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>
I see the following warning when compiling:
In file included from lib/rhashtable.c:17:0:
lib/rhashtable.c: In function ‘rhashtable_init’:
include/linux/kernel.h:715:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void) (&_max1 == &_max2); \
^
lib/rhashtable.c:570:22: note: in expansion of macro ‘max’
params->min_shift = max(params->min_shift, ilog2(HASH_MIN_SIZE));
^ permalink raw reply
* Re: [PATCH net-next v3] lib/rhashtable: allow user to set the minimum shifts of shrinking
From: Ying Xue @ 2014-09-01 9:28 UTC (permalink / raw)
To: Thomas Graf; +Cc: davem, eric.dumazet, netdev
In-Reply-To: <20140901090302.GB27933@casper.infradead.org>
On 09/01/2014 05:03 PM, Thomas Graf wrote:
> On 08/30/14 at 02:48pm, Ying Xue wrote:
>> Although rhashtable library allows user to specify a quiet big size
>> for user's created hash table, the table may be shrunk to a
>> very small size - HASH_MIN_SIZE(4) after object is removed from
>> the table at the first time. Subsequently, even if the total amount
>> of objects saved in the table is quite lower than user's initial
>> setting in a long time, the hash table size is still dynamically
>> adjusted by rhashtable_shrink() or rhashtable_expand() each time
>> object is inserted or removed from the table. However, as
>> synchronize_rcu() has to be called when table is shrunk or
>> expanded by the two functions, we should permit user to set the
>> minimum table size through configuring the minimum number of shifts
>> according to user specific requirement, avoiding these expensive
>> actions of shrinking or expanding because of calling synchronize_rcu().
>>
>> Signed-off-by: Ying Xue <ying.xue@windriver.com>
>
> I see the following warning when compiling:
>
> In file included from lib/rhashtable.c:17:0:
> lib/rhashtable.c: In function ‘rhashtable_init’:
> include/linux/kernel.h:715:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_max1 == &_max2); \
> ^
> lib/rhashtable.c:570:22: note: in expansion of macro ‘max’
> params->min_shift = max(params->min_shift, ilog2(HASH_MIN_SIZE));
>
>
Thanks for your check.
After I made below change, the compiling warning disappears.
+ params->min_shift = max(params->min_shift,
+ (size_t)ilog2(HASH_MIN_SIZE));
+
But when I check the patch format with scripts/checkpatch.pl, below
warning occurs:
./scripts/checkpatch.pl
0001-lib-rhashtable-allow-user-to-set-the-minimum-shifts-.patch
WARNING: max() should probably be max_t(size_t, params->min_shift,
ilog2(HASH_MIN_SIZE))
#77: FILE: lib/rhashtable.c:570:
+ params->min_shift = max(params->min_shift,
(size_t)ilog2(HASH_MIN_SIZE));
total: 0 errors, 1 warnings, 46 lines checked
0001-lib-rhashtable-allow-user-to-set-the-minimum-shifts-.patch has
style problems, please review.
Do you think it's worth replacing max() macro with max_t() regarding
above suggestion?
By the way, if the replacement should do, all max() macro in the
lib/rhashtable.c should be replaced as well.
Thanks,
Ying
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Peter Zijlstra @ 2014-09-01 9:31 UTC (permalink / raw)
To: Mike Galbraith; +Cc: Jason Wang, davem, netdev, linux-kernel, mst, Ingo Molnar
In-Reply-To: <1408683665.5648.69.camel@marge.simpson.net>
On Fri, Aug 22, 2014 at 07:01:05AM +0200, Mike Galbraith wrote:
> > +++ b/include/net/busy_poll.h
> > @@ -109,7 +109,8 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
> > cpu_relax();
> >
> > } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
> > - !need_resched() && !busy_loop_timeout(end_time));
> > + !need_resched() && !busy_loop_timeout(end_time) &&
> > + nr_running_this_cpu() < 2);
> >
So as has been said by now; this is horrible.
We should not export nr_running like this ever. Your usage of < 2
implies this can be hit with nr_running == 0, and therefore you can also
hit it with nr_running == 1 where the one is not network related and you
get random delays.
Worse still, you have BH (and thereby preemption) disabled, you should
not _ever_ have undefined and indefinite waits like that.
You also destroy any hope of dropping into lower power states; even when
there's never going to be a packet ever again, also bad.
All in all, a complete trainwreck.
NAK.
^ permalink raw reply
* Re: [PATCH net-next v3] lib/rhashtable: allow user to set the minimum shifts of shrinking
From: Thomas Graf @ 2014-09-01 9:41 UTC (permalink / raw)
To: Ying Xue; +Cc: davem, eric.dumazet, netdev
In-Reply-To: <54043C45.7090005@windriver.com>
On 09/01/14 at 05:28pm, Ying Xue wrote:
> Do you think it's worth replacing max() macro with max_t() regarding
> above suggestion?
Yes. max_t() is what should be used in this case.
> By the way, if the replacement should do, all max() macro in the
> lib/rhashtable.c should be replaced as well.
I think the other max() usage is fine as both arguments have a type (size_t).
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Michael S. Tsirkin @ 2014-09-01 9:52 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Mike Galbraith, Jason Wang, davem, netdev, linux-kernel,
Ingo Molnar
In-Reply-To: <20140901093159.GB27892@worktop.ger.corp.intel.com>
On Mon, Sep 01, 2014 at 11:31:59AM +0200, Peter Zijlstra wrote:
> On Fri, Aug 22, 2014 at 07:01:05AM +0200, Mike Galbraith wrote:
> > > +++ b/include/net/busy_poll.h
> > > @@ -109,7 +109,8 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
> > > cpu_relax();
> > >
> > > } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
> > > - !need_resched() && !busy_loop_timeout(end_time));
> > > + !need_resched() && !busy_loop_timeout(end_time) &&
> > > + nr_running_this_cpu() < 2);
> > >
>
> So as has been said by now; this is horrible.
>
> We should not export nr_running like this ever. Your usage of < 2
> implies this can be hit with nr_running == 0, and therefore you can also
> hit it with nr_running == 1 where the one is not network related and you
> get random delays.
>
> Worse still, you have BH (and thereby preemption) disabled, you should
> not _ever_ have undefined and indefinite waits like that.
>
> You also destroy any hope of dropping into lower power states; even when
> there's never going to be a packet ever again, also bad.
Hmm this patch sometimes makes us exit from the busy loop *earlier*.
How can this interfere with dropping into lower power states?
> All in all, a complete trainwreck.
>
> NAK.
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Peter Zijlstra @ 2014-09-01 10:04 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Mike Galbraith, Jason Wang, davem, netdev, linux-kernel,
Ingo Molnar
In-Reply-To: <20140901095219.GD21269@redhat.com>
On Mon, Sep 01, 2014 at 12:52:19PM +0300, Michael S. Tsirkin wrote:
> On Mon, Sep 01, 2014 at 11:31:59AM +0200, Peter Zijlstra wrote:
> > On Fri, Aug 22, 2014 at 07:01:05AM +0200, Mike Galbraith wrote:
> > > > +++ b/include/net/busy_poll.h
> > > > @@ -109,7 +109,8 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
> > > > cpu_relax();
> > > >
> > > > } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
> > > > - !need_resched() && !busy_loop_timeout(end_time));
> > > > + !need_resched() && !busy_loop_timeout(end_time) &&
> > > > + nr_running_this_cpu() < 2);
> > > >
> >
> > So as has been said by now; this is horrible.
> >
> > We should not export nr_running like this ever. Your usage of < 2
> > implies this can be hit with nr_running == 0, and therefore you can also
> > hit it with nr_running == 1 where the one is not network related and you
> > get random delays.
> >
> > Worse still, you have BH (and thereby preemption) disabled, you should
> > not _ever_ have undefined and indefinite waits like that.
> >
> > You also destroy any hope of dropping into lower power states; even when
> > there's never going to be a packet ever again, also bad.
>
> Hmm this patch sometimes makes us exit from the busy loop *earlier*.
> How can this interfere with dropping into lower power states?
Ah.. jetlag.. :/ I read it like it owuld indefinitely spin if there was
only the 'one' task, not avoid the spin unless there was the one task.
The nr_running thing is still horrible, but let me reread this patch
description to see if it explains why that is a good thing.
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Peter Zijlstra @ 2014-09-01 10:19 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Mike Galbraith, Jason Wang, davem, netdev, linux-kernel,
Ingo Molnar, Eliezer Tamir
In-Reply-To: <20140901100434.GD27892@worktop.ger.corp.intel.com>
On Mon, Sep 01, 2014 at 12:04:34PM +0200, Peter Zijlstra wrote:
> On Mon, Sep 01, 2014 at 12:52:19PM +0300, Michael S. Tsirkin wrote:
> > On Mon, Sep 01, 2014 at 11:31:59AM +0200, Peter Zijlstra wrote:
> > > On Fri, Aug 22, 2014 at 07:01:05AM +0200, Mike Galbraith wrote:
> > > > > +++ b/include/net/busy_poll.h
> > > > > @@ -109,7 +109,8 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
> > > > > cpu_relax();
> > > > >
> > > > > } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
> > > > > - !need_resched() && !busy_loop_timeout(end_time));
> > > > > + !need_resched() && !busy_loop_timeout(end_time) &&
> > > > > + nr_running_this_cpu() < 2);
> > > > >
> > >
> > > So as has been said by now; this is horrible.
> > >
> > > We should not export nr_running like this ever. Your usage of < 2
> > > implies this can be hit with nr_running == 0, and therefore you can also
> > > hit it with nr_running == 1 where the one is not network related and you
> > > get random delays.
> > >
> > > Worse still, you have BH (and thereby preemption) disabled, you should
> > > not _ever_ have undefined and indefinite waits like that.
> > >
> > > You also destroy any hope of dropping into lower power states; even when
> > > there's never going to be a packet ever again, also bad.
> >
> > Hmm this patch sometimes makes us exit from the busy loop *earlier*.
> > How can this interfere with dropping into lower power states?
>
> Ah.. jetlag.. :/ I read it like it owuld indefinitely spin if there was
> only the 'one' task, not avoid the spin unless there was the one task.
>
> The nr_running thing is still horrible, but let me reread this patch
> description to see if it explains why that is a good thing.
OK I suppose that more or less makes sense, the contextual behaviour is
of course tedious in that it makes behaviour less predictable. The
'other' tasks might not want to generate data and you then destroy
throughput by not spinning.
I'm not entirely sure I see how its all supposed to work though; the
various poll functions call sk_busy_poll() and do_select() also loops.
The patch only kills the sk_busy_poll() loop, but then do_select() will
still loop and not sleep, so how is this helping?
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: exit busy loop when another process is runnable
From: Michael S. Tsirkin @ 2014-09-01 10:22 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Mike Galbraith, Jason Wang, davem, netdev, linux-kernel,
Ingo Molnar
In-Reply-To: <20140901100434.GD27892@worktop.ger.corp.intel.com>
On Mon, Sep 01, 2014 at 12:04:34PM +0200, Peter Zijlstra wrote:
> On Mon, Sep 01, 2014 at 12:52:19PM +0300, Michael S. Tsirkin wrote:
> > On Mon, Sep 01, 2014 at 11:31:59AM +0200, Peter Zijlstra wrote:
> > > On Fri, Aug 22, 2014 at 07:01:05AM +0200, Mike Galbraith wrote:
> > > > > +++ b/include/net/busy_poll.h
> > > > > @@ -109,7 +109,8 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
> > > > > cpu_relax();
> > > > >
> > > > > } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
> > > > > - !need_resched() && !busy_loop_timeout(end_time));
> > > > > + !need_resched() && !busy_loop_timeout(end_time) &&
> > > > > + nr_running_this_cpu() < 2);
> > > > >
> > >
> > > So as has been said by now; this is horrible.
> > >
> > > We should not export nr_running like this ever. Your usage of < 2
> > > implies this can be hit with nr_running == 0, and therefore you can also
> > > hit it with nr_running == 1 where the one is not network related and you
> > > get random delays.
> > >
> > > Worse still, you have BH (and thereby preemption) disabled, you should
> > > not _ever_ have undefined and indefinite waits like that.
> > >
> > > You also destroy any hope of dropping into lower power states; even when
> > > there's never going to be a packet ever again, also bad.
> >
> > Hmm this patch sometimes makes us exit from the busy loop *earlier*.
> > How can this interfere with dropping into lower power states?
>
> Ah.. jetlag.. :/ I read it like it owuld indefinitely spin if there was
> only the 'one' task, not avoid the spin unless there was the one task.
>
> The nr_running thing is still horrible,
Yea, it's a kludge, but busy waiting is a heuristic thing anyway,
so it boils down to whether it's mostly effective.
I agree it would be better to make it more robust/consistent if we can
do it without a lot of complexity.
> but let me reread this patch
> description to see if it explains why that is a good thing.
^ permalink raw reply
* Re: [PATCH net-next v3] xfrm: remove useless hash_resize_mutex locks
From: Steffen Klassert @ 2014-09-01 11:29 UTC (permalink / raw)
To: Ying Xue; +Cc: davem, christophe.gouault, netdev
In-Reply-To: <1409303348-23262-1-git-send-email-ying.xue@windriver.com>
On Fri, Aug 29, 2014 at 05:09:07PM +0800, Ying Xue wrote:
> In xfrm_state.c, hash_resize_mutex is defined as a local variable
> and only used in xfrm_hash_resize() which is declared as a work
> handler of xfrm.state_hash_work. But when the xfrm.state_hash_work
> work is put in the global workqueue(system_wq) with schedule_work(),
> the work will be really inserted in the global workqueue if it was
> not already queued, otherwise, it is still left in the same position
> on the the global workqueue. This means the xfrm_hash_resize() work
> handler is only executed once at any time no matter how many times
> its work is scheduled, that is, xfrm_hash_resize() is not called
> concurrently at all, so hash_resize_mutex is redundant for us.
>
> Cc: Christophe Gouault <christophe.gouault@6wind.com>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>
> Acked-by: David S. Miller <davem@davemloft.net>
Applied to ipsec-next, thanks!
^ permalink raw reply
* [PATCH] Next branch: authgss: authgss.c: Fix warnings for uninitizlized variable expire
From: Shakil A Khan @ 2014-09-01 11:32 UTC (permalink / raw)
To: linux-nfs
Cc: linux-kernel, netdev, peterz, paulmck, andros, jlayton, davem,
bfields, trond.myklebust, Shakil A Khan
Signed-off-by : Shakil A Khan <shakilk1729@gmail.com>
---
net/sunrpc/auth_gss/auth_gss.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index afb292c..bea0951 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -1387,7 +1387,7 @@ gss_key_timeout(struct rpc_cred *rc)
struct gss_cred *gss_cred = container_of(rc, struct gss_cred, gc_base);
struct gss_cl_ctx *ctx;
unsigned long now = jiffies;
- unsigned long expire;
+ unsigned long expire = 0;
rcu_read_lock();
ctx = rcu_dereference(gss_cred->gc_ctx);
--
1.7.1
^ permalink raw reply related
* [PATCH] net: lpc_eth: Fix crash on ip link up
From: stigge @ 2014-09-01 11:46 UTC (permalink / raw)
To: davem, netdev, linux-kernel; +Cc: Roland Stigge
From: Roland Stigge <stigge@antcom.de>
When a link is already up, the following sequence makes the kernel
block completely:
ip link set dev eth0 down
ip link set dev eth0 up
This is because on suspended phy, the following lines
__lpc_eth_reset(pldat);
__lpc_eth_init(pldat);
make the LPC ethernet core block (see LPC32x0 manual). The PHY needs to be
(re-)activated low-level first.
Signed-off-by: Roland Stigge <stigge@antcom.de>
---
Applies to v3.17-rc3
drivers/net/ethernet/nxp/lpc_eth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 8706c0d..a44a03c 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1220,6 +1220,9 @@ static int lpc_eth_open(struct net_device *ndev)
__lpc_eth_clock_enable(pldat, true);
+ /* Suspended PHY makes LPC ethernet core block, so resume now */
+ phy_resume(pldat->phy_dev);
+
/* Reset and initialize */
__lpc_eth_reset(pldat);
__lpc_eth_init(pldat);
--
2.1.0
^ permalink raw reply related
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