* [PATCH net-next 0/6] be2net: fixes
@ 2011-08-03 5:57 Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 1/6] be2net: remove wrong and unnecessary calls to netif_carrier_off() Sathya Perla
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev
Pls apply.
Sathya Perla (6):
be2net: remove wrong and unnecessary calls to netif_carrier_off()
be2net: no need to query link status
be2net: non-member vlan pkts not received in promiscous mode
be2net: use RX_FILTER cmd to program multicast addresses
be2net: add support for flashing Teranetics PHY firmware
be2net: drop pkts that do not belong to the port
drivers/net/benet/be.h | 8 ++-
drivers/net/benet/be_cmds.c | 140 +++++++++++++-----------------------
drivers/net/benet/be_cmds.h | 38 ++++------
drivers/net/benet/be_ethtool.c | 32 ++-------
drivers/net/benet/be_hw.h | 21 ++++--
drivers/net/benet/be_main.c | 155 ++++++++++++++++++++++++----------------
6 files changed, 185 insertions(+), 209 deletions(-)
--
1.7.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 1/6] be2net: remove wrong and unnecessary calls to netif_carrier_off()
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
@ 2011-08-03 5:57 ` Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 2/6] be2net: no need to query link status Sathya Perla
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev
1) In be_probe(), as soon as the MCC Q is created a gratuitous link status
event is received and processed. Accordingly netif_carrier_off/on() is called.
The extra netif_carrier_off() call in probe can race with this and cause wrong
state.
2) be_close() need not call netif_carrier_off(). It is OK to show the actual
link state even when the device is administratively down.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be_main.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 9f2f66c..553cc0d 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2217,7 +2217,6 @@ static int be_close(struct net_device *netdev)
be_async_mcc_disable(adapter);
- netif_carrier_off(netdev);
adapter->link_up = false;
if (!lancer_chip(adapter))
@@ -3345,7 +3344,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
status = register_netdev(netdev);
if (status != 0)
goto unsetup;
- netif_carrier_off(netdev);
if (be_physfn(adapter) && adapter->sriov_enabled) {
u8 mac_speed;
--
1.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 2/6] be2net: no need to query link status
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 1/6] be2net: remove wrong and unnecessary calls to netif_carrier_off() Sathya Perla
@ 2011-08-03 5:57 ` Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 3/6] be2net: non-member vlan pkts not received in promiscous mode Sathya Perla
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev
Change in the link status generates an MCC event. This is processed and
netif_carrier_on/off is called accordingly. Don't need to query/store the
link_status state.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be.h | 2 +-
drivers/net/benet/be_cmds.c | 10 +++-------
drivers/net/benet/be_cmds.h | 7 ++++---
drivers/net/benet/be_ethtool.c | 9 +++------
drivers/net/benet/be_main.c | 37 +++++++++++--------------------------
5 files changed, 22 insertions(+), 43 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index af57b51..8d897d1 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -521,7 +521,7 @@ static inline bool be_multi_rxq(const struct be_adapter *adapter)
extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
u16 num_popped);
-extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
+extern void be_link_status_update(struct be_adapter *adapter, u32 link_status);
extern void be_parse_stats(struct be_adapter *adapter);
extern int be_load_fw(struct be_adapter *adapter, u8 *func);
#endif /* BE_H */
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 7dc4741..1c25dbd 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -110,8 +110,7 @@ done:
static void be_async_link_state_process(struct be_adapter *adapter,
struct be_async_event_link_state *evt)
{
- be_link_status_update(adapter,
- evt->port_link_status == ASYNC_EVENT_LINK_UP);
+ be_link_status_update(adapter, evt->port_link_status);
}
/* Grp5 CoS Priority evt */
@@ -1261,8 +1260,8 @@ err:
}
/* Uses synchronous mcc */
-int be_cmd_link_status_query(struct be_adapter *adapter,
- bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom)
+int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,
+ u16 *link_speed, u32 dom)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_link_status *req;
@@ -1277,8 +1276,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter,
}
req = embedded_payload(wrb);
- *link_up = false;
-
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
OPCODE_COMMON_NTWK_LINK_STATUS_QUERY);
@@ -1289,7 +1286,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter,
if (!status) {
struct be_cmd_resp_link_status *resp = embedded_payload(wrb);
if (resp->mac_speed != PHY_LINK_SPEED_ZERO) {
- *link_up = true;
*link_speed = le16_to_cpu(resp->link_speed);
*mac_speed = resp->mac_speed;
}
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index d3342c4..6db545f 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -89,9 +89,10 @@ struct be_async_event_trailer {
};
enum {
- ASYNC_EVENT_LINK_DOWN = 0x0,
- ASYNC_EVENT_LINK_UP = 0x1
+ LINK_DOWN = 0x0,
+ LINK_UP = 0x1
};
+#define LINK_STATUS_MASK 0x1
/* When the event code of an async trailer is link-state, the mcc_compl
* must be interpreted as follows
@@ -1442,7 +1443,7 @@ extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
extern int be_cmd_rxq_destroy(struct be_adapter *adapter,
struct be_queue_info *q);
extern int be_cmd_link_status_query(struct be_adapter *adapter,
- bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom);
+ u8 *mac_speed, u16 *link_speed, u32 dom);
extern int be_cmd_reset(struct be_adapter *adapter);
extern int be_cmd_get_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd);
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index e92a8d8..60c85f6 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -353,15 +353,13 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
struct be_cmd_resp_get_phy_info *resp;
u8 mac_speed = 0;
u16 link_speed = 0;
- bool link_up = false;
int status;
u16 intf_type;
if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) {
- status = be_cmd_link_status_query(adapter, &link_up,
- &mac_speed, &link_speed, 0);
+ status = be_cmd_link_status_query(adapter, &mac_speed,
+ &link_speed, 0);
- be_link_status_update(adapter, link_up);
/* link_speed is in units of 10 Mbps */
if (link_speed) {
ethtool_cmd_speed_set(ecmd, link_speed*10);
@@ -617,7 +615,6 @@ static void
be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
{
struct be_adapter *adapter = netdev_priv(netdev);
- bool link_up;
u8 mac_speed = 0;
u16 qos_link_speed = 0;
@@ -643,7 +640,7 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
test->flags |= ETH_TEST_FL_FAILED;
}
- if (be_cmd_link_status_query(adapter, &link_up, &mac_speed,
+ if (be_cmd_link_status_query(adapter, &mac_speed,
&qos_link_speed, 0) != 0) {
test->flags |= ETH_TEST_FL_FAILED;
data[4] = -1;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 553cc0d..3b2c5e6 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -462,21 +462,18 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
return stats;
}
-void be_link_status_update(struct be_adapter *adapter, bool link_up)
+void be_link_status_update(struct be_adapter *adapter, u32 link_status)
{
struct net_device *netdev = adapter->netdev;
- /* If link came up or went down */
- if (adapter->link_up != link_up) {
- adapter->link_speed = -1;
- if (link_up) {
- netif_carrier_on(netdev);
- printk(KERN_INFO "%s: Link up\n", netdev->name);
- } else {
- netif_carrier_off(netdev);
- printk(KERN_INFO "%s: Link down\n", netdev->name);
- }
- adapter->link_up = link_up;
+ /* when link status changes, link speed must be re-queried from card */
+ adapter->link_speed = -1;
+ if ((link_status & LINK_STATUS_MASK) == LINK_UP) {
+ netif_carrier_on(netdev);
+ dev_info(&adapter->pdev->dev, "%s: Link up\n", netdev->name);
+ } else {
+ netif_carrier_off(netdev);
+ dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name);
}
}
@@ -2217,8 +2214,6 @@ static int be_close(struct net_device *netdev)
be_async_mcc_disable(adapter);
- adapter->link_up = false;
-
if (!lancer_chip(adapter))
be_intr_set(adapter, false);
@@ -2296,10 +2291,7 @@ static int be_open(struct net_device *netdev)
struct be_adapter *adapter = netdev_priv(netdev);
struct be_eq_obj *tx_eq = &adapter->tx_eq;
struct be_rx_obj *rxo;
- bool link_up;
int status, i;
- u8 mac_speed;
- u16 link_speed;
status = be_rx_queues_setup(adapter);
if (status)
@@ -2322,12 +2314,6 @@ static int be_open(struct net_device *netdev)
/* Now that interrupts are on we can process async mcc */
be_async_mcc_enable(adapter);
- status = be_cmd_link_status_query(adapter, &link_up, &mac_speed,
- &link_speed, 0);
- if (status)
- goto err;
- be_link_status_update(adapter, link_up);
-
if (be_physfn(adapter)) {
status = be_vid_config(adapter, false, 0);
if (status)
@@ -3347,7 +3333,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
if (be_physfn(adapter) && adapter->sriov_enabled) {
u8 mac_speed;
- bool link_up;
u16 vf, lnk_speed;
if (!lancer_chip(adapter)) {
@@ -3357,8 +3342,8 @@ static int __devinit be_probe(struct pci_dev *pdev,
}
for (vf = 0; vf < num_vfs; vf++) {
- status = be_cmd_link_status_query(adapter, &link_up,
- &mac_speed, &lnk_speed, vf + 1);
+ status = be_cmd_link_status_query(adapter, &mac_speed,
+ &lnk_speed, vf + 1);
if (!status)
adapter->vf_cfg[vf].vf_tx_rate = lnk_speed * 10;
else
--
1.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 3/6] be2net: non-member vlan pkts not received in promiscous mode
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 1/6] be2net: remove wrong and unnecessary calls to netif_carrier_off() Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 2/6] be2net: no need to query link status Sathya Perla
@ 2011-08-03 5:57 ` Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 4/6] be2net: use RX_FILTER cmd to program multicast addresses Sathya Perla
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev; +Cc: Xavier Selvin
While configuring promiscous mode, explicitly set the
VLAN_PROMISCOUS bit to make this happen. When switching off
promiscous mode, re-program the vids.
Signed-off-by: Xavier Selvin <xavier.selvin@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be_cmds.c | 6 ++++--
drivers/net/benet/be_main.c | 7 +++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 1c25dbd..73fd949 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1586,9 +1586,11 @@ int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en)
OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req));
req->if_id = cpu_to_le32(adapter->if_handle);
- req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS);
+ req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS
+ | BE_IF_FLAGS_VLAN_PROMISCUOUS);
if (en)
- req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS);
+ req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS
+ | BE_IF_FLAGS_VLAN_PROMISCUOUS);
sge->pa_hi = cpu_to_le32(upper_32_bits(promiscous_cmd.dma));
sge->pa_lo = cpu_to_le32(promiscous_cmd.dma & 0xFFFFFFFF);
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 3b2c5e6..32a5b11 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -728,6 +728,10 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num)
status = be_cmd_vlan_config(adapter, if_handle, vtag, 1, 1, 0);
}
+ /* No need to further configure vids if in promiscuous mode */
+ if (adapter->promiscuous)
+ return 0;
+
if (adapter->vlans_added <= adapter->max_vlans) {
/* Construct VLAN Table to give to HW */
for (i = 0; i < VLAN_N_VID; i++) {
@@ -787,6 +791,9 @@ static void be_set_multicast_list(struct net_device *netdev)
if (adapter->promiscuous) {
adapter->promiscuous = false;
be_cmd_promiscuous_config(adapter, false);
+
+ if (adapter->vlans_added)
+ be_vid_config(adapter, false, 0);
}
/* Enable multicast promisc if num configured exceeds what we support */
--
1.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 4/6] be2net: use RX_FILTER cmd to program multicast addresses
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
` (2 preceding siblings ...)
2011-08-03 5:57 ` [PATCH net-next 3/6] be2net: non-member vlan pkts not received in promiscous mode Sathya Perla
@ 2011-08-03 5:57 ` Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 5/6] be2net: add support for flashing Teranetics PHY firmware Sathya Perla
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev
Use this cmd for both promiscous and multicast address programming. Get rid
of the old MULTICAST_SET cmd.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be.h | 4 +-
drivers/net/benet/be_cmds.c | 103 +++++++++---------------------------------
drivers/net/benet/be_cmds.h | 20 ++-------
drivers/net/benet/be_main.c | 28 +++++-------
4 files changed, 41 insertions(+), 114 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 8d897d1..1e7f009 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -334,7 +334,7 @@ struct be_adapter {
u8 vlan_tag[VLAN_N_VID];
u8 vlan_prio_bmap; /* Available Priority BitMap */
u16 recommended_prio; /* Recommended Priority */
- struct be_dma_mem mc_cmd_mem;
+ struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */
struct be_dma_mem stats_cmd;
/* Work queue used to perform periodic tasks like getting statistics */
@@ -381,6 +381,8 @@ struct be_adapter {
#define BE_GEN2 2
#define BE_GEN3 3
+#define ON 1
+#define OFF 0
#define lancer_chip(adapter) ((adapter->pdev->device == OC_DEVICE_ID3) || \
(adapter->pdev->device == OC_DEVICE_ID4))
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 73fd949..f138fbb 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1548,72 +1548,11 @@ err:
return status;
}
-/* Uses MCC for this command as it may be called in BH context
- * Uses synchronous mcc
- */
-int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en)
-{
- struct be_mcc_wrb *wrb;
- struct be_cmd_req_rx_filter *req;
- struct be_dma_mem promiscous_cmd;
- struct be_sge *sge;
- int status;
-
- memset(&promiscous_cmd, 0, sizeof(struct be_dma_mem));
- promiscous_cmd.size = sizeof(struct be_cmd_req_rx_filter);
- promiscous_cmd.va = pci_alloc_consistent(adapter->pdev,
- promiscous_cmd.size, &promiscous_cmd.dma);
- if (!promiscous_cmd.va) {
- dev_err(&adapter->pdev->dev,
- "Memory allocation failure\n");
- return -ENOMEM;
- }
-
- spin_lock_bh(&adapter->mcc_lock);
-
- wrb = wrb_from_mccq(adapter);
- if (!wrb) {
- status = -EBUSY;
- goto err;
- }
-
- req = promiscous_cmd.va;
- sge = nonembedded_sgl(wrb);
-
- be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
- OPCODE_COMMON_NTWK_RX_FILTER);
- be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
- OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req));
-
- req->if_id = cpu_to_le32(adapter->if_handle);
- req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS
- | BE_IF_FLAGS_VLAN_PROMISCUOUS);
- if (en)
- req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS
- | BE_IF_FLAGS_VLAN_PROMISCUOUS);
-
- sge->pa_hi = cpu_to_le32(upper_32_bits(promiscous_cmd.dma));
- sge->pa_lo = cpu_to_le32(promiscous_cmd.dma & 0xFFFFFFFF);
- sge->len = cpu_to_le32(promiscous_cmd.size);
-
- status = be_mcc_notify_wait(adapter);
-
-err:
- spin_unlock_bh(&adapter->mcc_lock);
- pci_free_consistent(adapter->pdev, promiscous_cmd.size,
- promiscous_cmd.va, promiscous_cmd.dma);
- return status;
-}
-
-/*
- * Uses MCC for this command as it may be called in BH context
- * (mc == NULL) => multicast promiscuous
- */
-int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
- struct net_device *netdev, struct be_dma_mem *mem)
+int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
{
struct be_mcc_wrb *wrb;
- struct be_cmd_req_mcast_mac_config *req = mem->va;
+ struct be_dma_mem *mem = &adapter->rx_filter;
+ struct be_cmd_req_rx_filter *req = mem->va;
struct be_sge *sge;
int status;
@@ -1625,33 +1564,35 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
goto err;
}
sge = nonembedded_sgl(wrb);
- memset(req, 0, sizeof(*req));
-
- be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
- OPCODE_COMMON_NTWK_MULTICAST_SET);
sge->pa_hi = cpu_to_le32(upper_32_bits(mem->dma));
sge->pa_lo = cpu_to_le32(mem->dma & 0xFFFFFFFF);
sge->len = cpu_to_le32(mem->size);
+ be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
+ OPCODE_COMMON_NTWK_RX_FILTER);
+ memset(req, 0, sizeof(*req));
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
- OPCODE_COMMON_NTWK_MULTICAST_SET, sizeof(*req));
+ OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req));
- req->interface_id = if_id;
- if (netdev) {
- int i;
+ req->if_id = cpu_to_le32(adapter->if_handle);
+ if (flags & IFF_PROMISC) {
+ req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS |
+ BE_IF_FLAGS_VLAN_PROMISCUOUS);
+ if (value == ON)
+ req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS |
+ BE_IF_FLAGS_VLAN_PROMISCUOUS);
+ } else if (flags & IFF_ALLMULTI) {
+ req->if_flags_mask = req->if_flags =
+ cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS);
+ } else {
struct netdev_hw_addr *ha;
+ int i = 0;
- req->num_mac = cpu_to_le16(netdev_mc_count(netdev));
-
- i = 0;
- netdev_for_each_mc_addr(ha, netdev)
- memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN);
- } else {
- req->promiscuous = 1;
+ req->mcast_num = cpu_to_le16(netdev_mc_count(adapter->netdev));
+ netdev_for_each_mc_addr(ha, adapter->netdev)
+ memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
}
- status = be_mcc_notify_wait(adapter);
-
err:
spin_unlock_bh(&adapter->mcc_lock);
return status;
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 6db545f..008bfae9 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -910,21 +910,12 @@ struct be_cmd_req_vlan_config {
u16 normal_vlan[64];
} __packed;
-/******************** Multicast MAC Config *******************/
+/******************* RX FILTER ******************************/
#define BE_MAX_MC 64 /* set mcast promisc if > 64 */
struct macaddr {
u8 byte[ETH_ALEN];
};
-struct be_cmd_req_mcast_mac_config {
- struct be_cmd_req_hdr hdr;
- u16 num_mac;
- u8 promiscuous;
- u8 interface_id;
- struct macaddr mac[BE_MAX_MC];
-} __packed;
-
-/******************* RX FILTER ******************************/
struct be_cmd_req_rx_filter {
struct be_cmd_req_hdr hdr;
u32 global_flags_mask;
@@ -932,11 +923,10 @@ struct be_cmd_req_rx_filter {
u32 if_flags_mask;
u32 if_flags;
u32 if_id;
- u32 multicast_num;
- struct macaddr mac[BE_MAX_MC];
+ u32 mcast_num;
+ struct macaddr mcast_mac[BE_MAX_MC];
};
-
/******************** Link Status Query *******************/
struct be_cmd_req_link_status {
struct be_cmd_req_hdr hdr;
@@ -1455,9 +1445,7 @@ extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
u16 *vtag_array, u32 num, bool untagged,
bool promiscuous);
-extern int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en);
-extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
- struct net_device *netdev, struct be_dma_mem *mem);
+extern int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
extern int be_cmd_set_flow_control(struct be_adapter *adapter,
u32 tx_fc, u32 rx_fc);
extern int be_cmd_get_flow_control(struct be_adapter *adapter,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 32a5b11..5890bca 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -782,7 +782,7 @@ static void be_set_multicast_list(struct net_device *netdev)
struct be_adapter *adapter = netdev_priv(netdev);
if (netdev->flags & IFF_PROMISC) {
- be_cmd_promiscuous_config(adapter, true);
+ be_cmd_rx_filter(adapter, IFF_PROMISC, ON);
adapter->promiscuous = true;
goto done;
}
@@ -790,7 +790,7 @@ static void be_set_multicast_list(struct net_device *netdev)
/* BE was previously in promiscuous mode; disable it */
if (adapter->promiscuous) {
adapter->promiscuous = false;
- be_cmd_promiscuous_config(adapter, false);
+ be_cmd_rx_filter(adapter, IFF_PROMISC, OFF);
if (adapter->vlans_added)
be_vid_config(adapter, false, 0);
@@ -798,14 +798,12 @@ static void be_set_multicast_list(struct net_device *netdev)
/* Enable multicast promisc if num configured exceeds what we support */
if (netdev->flags & IFF_ALLMULTI ||
- netdev_mc_count(netdev) > BE_MAX_MC) {
- be_cmd_multicast_set(adapter, adapter->if_handle, NULL,
- &adapter->mc_cmd_mem);
+ netdev_mc_count(netdev) > BE_MAX_MC) {
+ be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON);
goto done;
}
- be_cmd_multicast_set(adapter, adapter->if_handle, netdev,
- &adapter->mc_cmd_mem);
+ be_cmd_rx_filter(adapter, IFF_MULTICAST, ON);
done:
return;
}
@@ -2976,7 +2974,7 @@ static void be_ctrl_cleanup(struct be_adapter *adapter)
dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
mem->dma);
- mem = &adapter->mc_cmd_mem;
+ mem = &adapter->rx_filter;
if (mem->va)
dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
mem->dma);
@@ -2986,7 +2984,7 @@ static int be_ctrl_init(struct be_adapter *adapter)
{
struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced;
struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem;
- struct be_dma_mem *mc_cmd_mem = &adapter->mc_cmd_mem;
+ struct be_dma_mem *rx_filter = &adapter->rx_filter;
int status;
status = be_map_pci_bars(adapter);
@@ -3002,21 +3000,19 @@ static int be_ctrl_init(struct be_adapter *adapter)
status = -ENOMEM;
goto unmap_pci_bars;
}
-
mbox_mem_align->size = sizeof(struct be_mcc_mailbox);
mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16);
mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16);
memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
- mc_cmd_mem->size = sizeof(struct be_cmd_req_mcast_mac_config);
- mc_cmd_mem->va = dma_alloc_coherent(&adapter->pdev->dev,
- mc_cmd_mem->size, &mc_cmd_mem->dma,
- GFP_KERNEL);
- if (mc_cmd_mem->va == NULL) {
+ rx_filter->size = sizeof(struct be_cmd_req_rx_filter);
+ rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size,
+ &rx_filter->dma, GFP_KERNEL);
+ if (rx_filter->va == NULL) {
status = -ENOMEM;
goto free_mbox;
}
- memset(mc_cmd_mem->va, 0, mc_cmd_mem->size);
+ memset(rx_filter->va, 0, rx_filter->size);
mutex_init(&adapter->mbox_lock);
spin_lock_init(&adapter->mcc_lock);
--
1.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 5/6] be2net: add support for flashing Teranetics PHY firmware
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
` (3 preceding siblings ...)
2011-08-03 5:57 ` [PATCH net-next 4/6] be2net: use RX_FILTER cmd to program multicast addresses Sathya Perla
@ 2011-08-03 5:57 ` Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 6/6] be2net: drop pkts that do not belong to the port Sathya Perla
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev; +Cc: Naresh G
Support for flashing RJ45 PHY (from Teranetics) on a 10GBaseT BE3 card.
Signed-off-by: Naresh G <bgottumukkala@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be_cmds.c | 29 ++++++++++++++++++----
drivers/net/benet/be_cmds.h | 11 ++++++--
drivers/net/benet/be_ethtool.c | 23 +++---------------
drivers/net/benet/be_hw.h | 21 +++++++++++-----
drivers/net/benet/be_main.c | 51 ++++++++++++++++++++++++++++++++--------
5 files changed, 91 insertions(+), 44 deletions(-)
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index f138fbb..7292be6 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -2186,11 +2186,13 @@ err:
return status;
}
-int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd)
+int be_cmd_get_phy_info(struct be_adapter *adapter,
+ struct be_phy_info *phy_info)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_get_phy_info *req;
struct be_sge *sge;
+ struct be_dma_mem cmd;
int status;
spin_lock_bh(&adapter->mcc_lock);
@@ -2200,8 +2202,16 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd)
status = -EBUSY;
goto err;
}
+ cmd.size = sizeof(struct be_cmd_req_get_phy_info);
+ cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size,
+ &cmd.dma);
+ if (!cmd.va) {
+ dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
+ status = -ENOMEM;
+ goto err;
+ }
- req = cmd->va;
+ req = cmd.va;
sge = nonembedded_sgl(wrb);
be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
@@ -2211,11 +2221,20 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd)
OPCODE_COMMON_GET_PHY_DETAILS,
sizeof(*req));
- sge->pa_hi = cpu_to_le32(upper_32_bits(cmd->dma));
- sge->pa_lo = cpu_to_le32(cmd->dma & 0xFFFFFFFF);
- sge->len = cpu_to_le32(cmd->size);
+ sge->pa_hi = cpu_to_le32(upper_32_bits(cmd.dma));
+ sge->pa_lo = cpu_to_le32(cmd.dma & 0xFFFFFFFF);
+ sge->len = cpu_to_le32(cmd.size);
status = be_mcc_notify_wait(adapter);
+ if (!status) {
+ struct be_phy_info *resp_phy_info =
+ cmd.va + sizeof(struct be_cmd_req_hdr);
+ phy_info->phy_type = le16_to_cpu(resp_phy_info->phy_type);
+ phy_info->interface_type =
+ le16_to_cpu(resp_phy_info->interface_type);
+ }
+ pci_free_consistent(adapter->pdev, cmd.size,
+ cmd.va, cmd.dma);
err:
spin_unlock_bh(&adapter->mcc_lock);
return status;
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 008bfae9..b61eac7 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -1244,14 +1244,19 @@ struct be_cmd_req_get_phy_info {
struct be_cmd_req_hdr hdr;
u8 rsvd0[24];
};
-struct be_cmd_resp_get_phy_info {
- struct be_cmd_req_hdr hdr;
+
+struct be_phy_info {
u16 phy_type;
u16 interface_type;
u32 misc_params;
u32 future_use[4];
};
+struct be_cmd_resp_get_phy_info {
+ struct be_cmd_req_hdr hdr;
+ struct be_phy_info phy_info;
+};
+
/*********************** Set QOS ***********************/
#define BE_QOS_BITS_NIC 1
@@ -1486,7 +1491,7 @@ extern int be_cmd_get_seeprom_data(struct be_adapter *adapter,
extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
u8 loopback_type, u8 enable);
extern int be_cmd_get_phy_info(struct be_adapter *adapter,
- struct be_dma_mem *cmd);
+ struct be_phy_info *phy_info);
extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
extern void be_detect_dump_ue(struct be_adapter *adapter);
extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 60c85f6..f144a6f 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -349,12 +349,10 @@ static int be_get_sset_count(struct net_device *netdev, int stringset)
static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
{
struct be_adapter *adapter = netdev_priv(netdev);
- struct be_dma_mem phy_cmd;
- struct be_cmd_resp_get_phy_info *resp;
+ struct be_phy_info phy_info;
u8 mac_speed = 0;
u16 link_speed = 0;
int status;
- u16 intf_type;
if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) {
status = be_cmd_link_status_query(adapter, &mac_speed,
@@ -383,20 +381,9 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
}
}
- phy_cmd.size = sizeof(struct be_cmd_req_get_phy_info);
- phy_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
- phy_cmd.size, &phy_cmd.dma,
- GFP_KERNEL);
- if (!phy_cmd.va) {
- dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
- return -ENOMEM;
- }
- status = be_cmd_get_phy_info(adapter, &phy_cmd);
+ status = be_cmd_get_phy_info(adapter, &phy_info);
if (!status) {
- resp = phy_cmd.va;
- intf_type = le16_to_cpu(resp->interface_type);
-
- switch (intf_type) {
+ switch (phy_info.interface_type) {
case PHY_TYPE_XFP_10GB:
case PHY_TYPE_SFP_1GB:
case PHY_TYPE_SFP_PLUS_10GB:
@@ -407,7 +394,7 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
break;
}
- switch (intf_type) {
+ switch (phy_info.interface_type) {
case PHY_TYPE_KR_10GB:
case PHY_TYPE_KX4_10GB:
ecmd->autoneg = AUTONEG_ENABLE;
@@ -425,8 +412,6 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
adapter->port_type = ecmd->port;
adapter->transceiver = ecmd->transceiver;
adapter->autoneg = ecmd->autoneg;
- dma_free_coherent(&adapter->pdev->dev, phy_cmd.size, phy_cmd.va,
- phy_cmd.dma);
} else {
ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->port = adapter->port_type;
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index 53d658a..fbc8a91 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -175,18 +175,24 @@
#define IMG_TYPE_FCOE_FW_ACTIVE 10
#define IMG_TYPE_FCOE_FW_BACKUP 11
#define IMG_TYPE_NCSI_FW 13
+#define IMG_TYPE_PHY_FW 99
+#define TN_8022 13
+#define ILLEGAL_IOCTL_REQ 2
+#define FLASHROM_OPER_PHY_FLASH 9
+#define FLASHROM_OPER_PHY_SAVE 10
#define FLASHROM_OPER_FLASH 1
#define FLASHROM_OPER_SAVE 2
#define FLASHROM_OPER_REPORT 4
-#define FLASH_IMAGE_MAX_SIZE_g2 (1310720) /* Max firmware image sz */
-#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 (262144) /* Max OPTION ROM img sz */
-#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 (262144) /* Max Redboot image sz */
-#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */
-#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */
-#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */
-#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144) /* Max NSCI image sz */
+#define FLASH_IMAGE_MAX_SIZE_g2 (1310720) /* Max firmware image size */
+#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 (262144) /* Max OPTION ROM image sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 (262144) /* Max Redboot image sz */
+#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max firmware image size */
+#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM image sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */
+#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144)
+#define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144
#define FLASH_NCSI_MAGIC (0x16032009)
#define FLASH_NCSI_DISABLED (0)
@@ -213,6 +219,7 @@
#define FLASH_PXE_BIOS_START_g3 (13107200)
#define FLASH_FCoE_BIOS_START_g3 (13631488)
#define FLASH_REDBOOT_START_g3 (262144)
+#define FLASH_PHY_FW_START_g3 1310720
/************* Rx Packet Type Encoding **************/
#define BE_UNICAST_PACKET 0
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 5890bca..dba6941f 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2569,6 +2569,21 @@ static bool be_flash_redboot(struct be_adapter *adapter,
return true;
}
+static bool phy_flashing_required(struct be_adapter *adapter)
+{
+ int status = 0;
+ struct be_phy_info phy_info;
+
+ status = be_cmd_get_phy_info(adapter, &phy_info);
+ if (status)
+ return false;
+ if ((phy_info.phy_type == TN_8022) &&
+ (phy_info.interface_type == PHY_TYPE_BASET_10GB)) {
+ return true;
+ }
+ return false;
+}
+
static int be_flash_data(struct be_adapter *adapter,
const struct firmware *fw,
struct be_dma_mem *flash_cmd, int num_of_images)
@@ -2582,7 +2597,7 @@ static int be_flash_data(struct be_adapter *adapter,
const struct flash_comp *pflashcomp;
int num_comp;
- static const struct flash_comp gen3_flash_types[9] = {
+ static const struct flash_comp gen3_flash_types[10] = {
{ FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g3},
{ FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT,
@@ -2600,7 +2615,9 @@ static int be_flash_data(struct be_adapter *adapter,
{ FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP,
FLASH_IMAGE_MAX_SIZE_g3},
{ FLASH_NCSI_START_g3, IMG_TYPE_NCSI_FW,
- FLASH_NCSI_IMAGE_MAX_SIZE_g3}
+ FLASH_NCSI_IMAGE_MAX_SIZE_g3},
+ { FLASH_PHY_FW_START_g3, IMG_TYPE_PHY_FW,
+ FLASH_PHY_FW_IMAGE_MAX_SIZE_g3}
};
static const struct flash_comp gen2_flash_types[8] = {
{ FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE,
@@ -2634,6 +2651,10 @@ static int be_flash_data(struct be_adapter *adapter,
if ((pflashcomp[i].optype == IMG_TYPE_NCSI_FW) &&
memcmp(adapter->fw_ver, "3.102.148.0", 11) < 0)
continue;
+ if (pflashcomp[i].optype == IMG_TYPE_PHY_FW) {
+ if (!phy_flashing_required(adapter))
+ continue;
+ }
if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) &&
(!be_flash_redboot(adapter, fw->data,
pflashcomp[i].offset, pflashcomp[i].size, filehdr_size +
@@ -2642,25 +2663,35 @@ static int be_flash_data(struct be_adapter *adapter,
p = fw->data;
p += filehdr_size + pflashcomp[i].offset
+ (num_of_images * sizeof(struct image_hdr));
- if (p + pflashcomp[i].size > fw->data + fw->size)
- return -1;
- total_bytes = pflashcomp[i].size;
+ if (p + pflashcomp[i].size > fw->data + fw->size)
+ return -1;
+ total_bytes = pflashcomp[i].size;
while (total_bytes) {
if (total_bytes > 32*1024)
num_bytes = 32*1024;
else
num_bytes = total_bytes;
total_bytes -= num_bytes;
-
- if (!total_bytes)
- flash_op = FLASHROM_OPER_FLASH;
- else
- flash_op = FLASHROM_OPER_SAVE;
+ if (!total_bytes) {
+ if (pflashcomp[i].optype == IMG_TYPE_PHY_FW)
+ flash_op = FLASHROM_OPER_PHY_FLASH;
+ else
+ flash_op = FLASHROM_OPER_FLASH;
+ } else {
+ if (pflashcomp[i].optype == IMG_TYPE_PHY_FW)
+ flash_op = FLASHROM_OPER_PHY_SAVE;
+ else
+ flash_op = FLASHROM_OPER_SAVE;
+ }
memcpy(req->params.data_buf, p, num_bytes);
p += num_bytes;
status = be_cmd_write_flashrom(adapter, flash_cmd,
pflashcomp[i].optype, flash_op, num_bytes);
if (status) {
+ if ((status == ILLEGAL_IOCTL_REQ) &&
+ (pflashcomp[i].optype ==
+ IMG_TYPE_PHY_FW))
+ break;
dev_err(&adapter->pdev->dev,
"cmd to write to flash rom failed.\n");
return -1;
--
1.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 6/6] be2net: drop pkts that do not belong to the port
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
` (4 preceding siblings ...)
2011-08-03 5:57 ` [PATCH net-next 5/6] be2net: add support for flashing Teranetics PHY firmware Sathya Perla
@ 2011-08-03 5:57 ` Sathya Perla
2011-08-03 10:27 ` [PATCH net-next 0/6] be2net: fixes David Miller
2011-08-09 15:47 ` Eric Dumazet
7 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2011-08-03 5:57 UTC (permalink / raw)
To: netdev; +Cc: Somnath Kotur
On some BE skews, while in promiscuous mode, pkts that do not belong to a
port can arrive on that port. Drop such pkts.
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be.h | 2 +-
drivers/net/benet/be_main.c | 30 +++++++++++++++++++++++-------
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 1e7f009..12b5b51 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -217,7 +217,7 @@ struct be_rx_compl_info {
u16 vlan_tag;
u16 pkt_size;
u16 rxq_idx;
- u16 mac_id;
+ u16 port;
u8 vlanf;
u8 num_rcvd;
u8 err;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index dba6941f..1a3acca 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1213,6 +1213,7 @@ static void be_parse_rx_compl_v1(struct be_adapter *adapter,
rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag,
compl);
}
+ rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl);
}
static void be_parse_rx_compl_v0(struct be_adapter *adapter,
@@ -1245,6 +1246,7 @@ static void be_parse_rx_compl_v0(struct be_adapter *adapter,
rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag,
compl);
}
+ rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl);
}
static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
@@ -1833,16 +1835,30 @@ static int be_poll_rx(struct napi_struct *napi, int budget)
if (!rxcp)
break;
- /* Ignore flush completions */
- if (rxcp->num_rcvd && rxcp->pkt_size) {
- if (do_gro(rxcp))
- be_rx_compl_process_gro(adapter, rxo, rxcp);
- else
- be_rx_compl_process(adapter, rxo, rxcp);
- } else if (rxcp->pkt_size == 0) {
+ /* Is it a flush compl that has no data */
+ if (unlikely(rxcp->num_rcvd == 0))
+ goto loop_continue;
+
+ /* Discard compl with partial DMA Lancer B0 */
+ if (unlikely(!rxcp->pkt_size)) {
be_rx_compl_discard(adapter, rxo, rxcp);
+ goto loop_continue;
}
+ /* On BE drop pkts that arrive due to imperfect filtering in
+ * promiscuous mode on some skews
+ */
+ if (unlikely(rxcp->port != adapter->port_num &&
+ !lancer_chip(adapter))) {
+ be_rx_compl_discard(adapter, rxo, rxcp);
+ goto loop_continue;
+ }
+
+ if (do_gro(rxcp))
+ be_rx_compl_process_gro(adapter, rxo, rxcp);
+ else
+ be_rx_compl_process(adapter, rxo, rxcp);
+loop_continue:
be_rx_stats_update(rxo, rxcp);
}
--
1.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 0/6] be2net: fixes
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
` (5 preceding siblings ...)
2011-08-03 5:57 ` [PATCH net-next 6/6] be2net: drop pkts that do not belong to the port Sathya Perla
@ 2011-08-03 10:27 ` David Miller
2011-08-09 15:47 ` Eric Dumazet
7 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2011-08-03 10:27 UTC (permalink / raw)
To: sathya.perla; +Cc: netdev
From: Sathya Perla <sathya.perla@emulex.com>
Date: Wed, 3 Aug 2011 11:27:40 +0530
> Pls apply.
>
> Sathya Perla (6):
> be2net: remove wrong and unnecessary calls to netif_carrier_off()
> be2net: no need to query link status
> be2net: non-member vlan pkts not received in promiscous mode
> be2net: use RX_FILTER cmd to program multicast addresses
> be2net: add support for flashing Teranetics PHY firmware
> be2net: drop pkts that do not belong to the port
Queued up for net-next, thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 0/6] be2net: fixes
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
` (6 preceding siblings ...)
2011-08-03 10:27 ` [PATCH net-next 0/6] be2net: fixes David Miller
@ 2011-08-09 15:47 ` Eric Dumazet
2011-08-09 16:23 ` Eric Dumazet
7 siblings, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2011-08-09 15:47 UTC (permalink / raw)
To: Sathya Perla; +Cc: netdev, David Miller
Le mercredi 03 août 2011 à 11:27 +0530, Sathya Perla a écrit :
> Pls apply.
>
> Sathya Perla (6):
> be2net: remove wrong and unnecessary calls to netif_carrier_off()
> be2net: no need to query link status
> be2net: non-member vlan pkts not received in promiscous mode
> be2net: use RX_FILTER cmd to program multicast addresses
> be2net: add support for flashing Teranetics PHY firmware
> be2net: drop pkts that do not belong to the port
>
> drivers/net/benet/be.h | 8 ++-
> drivers/net/benet/be_cmds.c | 140 +++++++++++++-----------------------
> drivers/net/benet/be_cmds.h | 38 ++++------
> drivers/net/benet/be_ethtool.c | 32 ++-------
> drivers/net/benet/be_hw.h | 21 ++++--
> drivers/net/benet/be_main.c | 155 ++++++++++++++++++++++++----------------
> 6 files changed, 185 insertions(+), 209 deletions(-)
>
Not sure which recent be2net patch is problematic on 32bit arches :
Kernel: arch/x86/boot/bzImage is ready (#280)
Building modules, stage 2.
MODPOST 1854 modules
ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
make[1]: *** [__modpost] Erreur 1
make: *** [modules] Erreur 2
Please fix this, thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 0/6] be2net: fixes
2011-08-09 15:47 ` Eric Dumazet
@ 2011-08-09 16:23 ` Eric Dumazet
2011-08-10 10:15 ` Sathya.Perla
2011-08-12 9:56 ` David Miller
0 siblings, 2 replies; 12+ messages in thread
From: Eric Dumazet @ 2011-08-09 16:23 UTC (permalink / raw)
To: Sathya Perla; +Cc: netdev, David Miller
Le mardi 09 août 2011 à 17:47 +0200, Eric Dumazet a écrit :
> Le mercredi 03 août 2011 à 11:27 +0530, Sathya Perla a écrit :
>
> > Pls apply.
> >
> > Sathya Perla (6):
> > be2net: remove wrong and unnecessary calls to netif_carrier_off()
> > be2net: no need to query link status
> > be2net: non-member vlan pkts not received in promiscous mode
> > be2net: use RX_FILTER cmd to program multicast addresses
> > be2net: add support for flashing Teranetics PHY firmware
> > be2net: drop pkts that do not belong to the port
> >
> > drivers/net/benet/be.h | 8 ++-
> > drivers/net/benet/be_cmds.c | 140 +++++++++++++-----------------------
> > drivers/net/benet/be_cmds.h | 38 ++++------
> > drivers/net/benet/be_ethtool.c | 32 ++-------
> > drivers/net/benet/be_hw.h | 21 ++++--
> > drivers/net/benet/be_main.c | 155 ++++++++++++++++++++++++----------------
> > 6 files changed, 185 insertions(+), 209 deletions(-)
> >
>
> Not sure which recent be2net patch is problematic on 32bit arches :
>
> Kernel: arch/x86/boot/bzImage is ready (#280)
> Building modules, stage 2.
> MODPOST 1854 modules
> ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
> make[1]: *** [__modpost] Erreur 1
> make: *** [modules] Erreur 2
>
> Please fix this, thanks.
>
>
Comes from commit ac124ff973e27802797
(be2net: cleanup and refactor stats code)
be_rx_eqd_update() now performs u64 divides.
Following patch should be enough, there is no way packet count can
overwrap a long anyway between two samples...
[PATCH] benet: fix build error on 32bit arch
Error comes from commit ac124ff973e27802797
(be2net: cleanup and refactor stats code)
ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/benet/be_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 1a3acca..7c98d8e 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -936,7 +936,7 @@ static void be_rx_eqd_update(struct be_adapter *adapter, struct be_rx_obj *rxo)
pkts = stats->rx_pkts;
} while (u64_stats_fetch_retry_bh(&stats->sync, start));
- stats->rx_pps = (pkts - stats->rx_pkts_prev) / (delta / HZ);
+ stats->rx_pps = (unsigned long)(pkts - stats->rx_pkts_prev) / (delta / HZ);
stats->rx_pkts_prev = pkts;
stats->rx_jiffies = now;
eqd = stats->rx_pps / 110000;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* RE: [PATCH net-next 0/6] be2net: fixes
2011-08-09 16:23 ` Eric Dumazet
@ 2011-08-10 10:15 ` Sathya.Perla
2011-08-12 9:56 ` David Miller
1 sibling, 0 replies; 12+ messages in thread
From: Sathya.Perla @ 2011-08-10 10:15 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
>From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
>Sent: Tuesday, August 09, 2011 9:53 PM
>> >
>>
>> Not sure which recent be2net patch is problematic on 32bit arches :
>>
>> Kernel: arch/x86/boot/bzImage is ready (#280)
>> Building modules, stage 2.
>> MODPOST 1854 modules
>> ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
>> make[1]: *** [__modpost] Erreur 1
>> make: *** [modules] Erreur 2
>>
>> Please fix this, thanks.
>>
>>
>
>Comes from commit ac124ff973e27802797
>(be2net: cleanup and refactor stats code)
>
>be_rx_eqd_update() now performs u64 divides.
>
>Following patch should be enough, there is no way packet count can
>overwrap a long anyway between two samples...
>
>
>
>[PATCH] benet: fix build error on 32bit arch
>
Thanks for the quick patch.
-Sathya
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 0/6] be2net: fixes
2011-08-09 16:23 ` Eric Dumazet
2011-08-10 10:15 ` Sathya.Perla
@ 2011-08-12 9:56 ` David Miller
1 sibling, 0 replies; 12+ messages in thread
From: David Miller @ 2011-08-12 9:56 UTC (permalink / raw)
To: eric.dumazet; +Cc: sathya.perla, netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 09 Aug 2011 18:23:07 +0200
> [PATCH] benet: fix build error on 32bit arch
>
> Error comes from commit ac124ff973e27802797
> (be2net: cleanup and refactor stats code)
>
> ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Sathya Perla <sathya.perla@emulex.com>
Applied.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-08-12 9:57 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 5:57 [PATCH net-next 0/6] be2net: fixes Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 1/6] be2net: remove wrong and unnecessary calls to netif_carrier_off() Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 2/6] be2net: no need to query link status Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 3/6] be2net: non-member vlan pkts not received in promiscous mode Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 4/6] be2net: use RX_FILTER cmd to program multicast addresses Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 5/6] be2net: add support for flashing Teranetics PHY firmware Sathya Perla
2011-08-03 5:57 ` [PATCH net-next 6/6] be2net: drop pkts that do not belong to the port Sathya Perla
2011-08-03 10:27 ` [PATCH net-next 0/6] be2net: fixes David Miller
2011-08-09 15:47 ` Eric Dumazet
2011-08-09 16:23 ` Eric Dumazet
2011-08-10 10:15 ` Sathya.Perla
2011-08-12 9:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).