Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1725473 > unrolled thread
| Started by | Antoine Tenart <antoine.tenart@free-electrons.com> |
|---|---|
| First post | 2017-09-02 11:10 +0200 |
| Last post | 2017-09-04 05:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH net-next v3 0/3] net: mvpp2: improve the mac address retrieval logic Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-09-02 11:10 +0200
[PATCH net-next v3 1/3] net: mvpp2: move the mac retrieval/copy logic into its own function Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-09-02 11:10 +0200
Re: [PATCH net-next v3 0/3] net: mvpp2: improve the mac address retrieval logic David Miller <davem@davemloft.net> - 2017-09-04 05:20 +0200
| From | Antoine Tenart <antoine.tenart@free-electrons.com> |
|---|---|
| Date | 2017-09-02 11:10 +0200 |
| Subject | [PATCH net-next v3 0/3] net: mvpp2: improve the mac address retrieval logic |
| Message-ID | <ulcBd-14i-51@gated-at.bofh.it> |
Hi all,
This series aims at fixing the logic behind the MAC address retrieval in the
PPv2 driver. A possible issue is also fixed in patch 3/3 to introduce fallbacks
when the address given in the device tree isn't valid.
Thanks!
Antoine
Since v2:
- Patch 1/4 from v2 was applied on net (and net was merged in net-next).
- Rebased on net-next.
Since v1:
- Rebased onto net (was on net-next).
Antoine Tenart (3):
net: mvpp2: move the mac retrieval/copy logic into its own function
net: mvpp2: fix use of the random mac address for PPv2.2
net: mvpp2: fallback using h/w and random mac if the dt one isn't
valid
drivers/net/ethernet/marvell/mvpp2.c | 48 ++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 18 deletions(-)
--
2.13.5
[toc] | [next] | [standalone]
| From | Antoine Tenart <antoine.tenart@free-electrons.com> |
|---|---|
| Date | 2017-09-02 11:10 +0200 |
| Subject | [PATCH net-next v3 1/3] net: mvpp2: move the mac retrieval/copy logic into its own function |
| Message-ID | <ulcBe-14i-65@gated-at.bofh.it> |
| In reply to | #1725473 |
The MAC retrieval has a quite complicated logic (which is broken). Moves
it to its own function to prepare for patches fixing its logic, so that
reviews are easier.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/mvpp2.c | 45 +++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index d5624894152e..a702e60ba70d 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7465,6 +7465,31 @@ static bool mvpp2_port_has_tx_irqs(struct mvpp2 *priv,
return true;
}
+static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
+ struct device_node *port_node,
+ char **mac_from)
+{
+ struct mvpp2_port *port = netdev_priv(dev);
+ char hw_mac_addr[ETH_ALEN] = {0};
+ const char *dt_mac_addr;
+
+ dt_mac_addr = of_get_mac_address(port_node);
+ if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) {
+ *mac_from = "device tree";
+ ether_addr_copy(dev->dev_addr, dt_mac_addr);
+ } else {
+ if (priv->hw_version == MVPP21)
+ mvpp21_get_mac_address(port, hw_mac_addr);
+ if (is_valid_ether_addr(hw_mac_addr)) {
+ *mac_from = "hardware";
+ ether_addr_copy(dev->dev_addr, hw_mac_addr);
+ } else {
+ *mac_from = "random";
+ eth_hw_addr_random(dev);
+ }
+ }
+}
+
/* Ports initialization */
static int mvpp2_port_probe(struct platform_device *pdev,
struct device_node *port_node,
@@ -7476,9 +7501,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
struct mvpp2_port_pcpu *port_pcpu;
struct net_device *dev;
struct resource *res;
- const char *dt_mac_addr;
- const char *mac_from;
- char hw_mac_addr[ETH_ALEN] = {0};
+ char *mac_from = "";
unsigned int ntxqs, nrxqs;
bool has_tx_irqs;
u32 id;
@@ -7587,21 +7610,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
goto err_free_irq;
}
- dt_mac_addr = of_get_mac_address(port_node);
- if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) {
- mac_from = "device tree";
- ether_addr_copy(dev->dev_addr, dt_mac_addr);
- } else {
- if (priv->hw_version == MVPP21)
- mvpp21_get_mac_address(port, hw_mac_addr);
- if (is_valid_ether_addr(hw_mac_addr)) {
- mac_from = "hardware";
- ether_addr_copy(dev->dev_addr, hw_mac_addr);
- } else {
- mac_from = "random";
- eth_hw_addr_random(dev);
- }
- }
+ mvpp2_port_copy_mac_addr(dev, priv, port_node, &mac_from);
port->tx_ring_size = MVPP2_MAX_TXD;
port->rx_ring_size = MVPP2_MAX_RXD;
--
2.13.5
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-09-04 05:20 +0200 |
| Subject | Re: [PATCH net-next v3 0/3] net: mvpp2: improve the mac address retrieval logic |
| Message-ID | <ulQ5A-9b-23@gated-at.bofh.it> |
| In reply to | #1725473 |
From: Antoine Tenart <antoine.tenart@free-electrons.com> Date: Sat, 2 Sep 2017 11:06:46 +0200 > This series aims at fixing the logic behind the MAC address retrieval in the > PPv2 driver. A possible issue is also fixed in patch 3/3 to introduce fallbacks > when the address given in the device tree isn't valid. ... > Since v2: > - Patch 1/4 from v2 was applied on net (and net was merged in net-next). > - Rebased on net-next. > > Since v1: > - Rebased onto net (was on net-next). Series applied, thank you.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web