diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-12-19 20:22:51 -0500 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-01-26 19:07:38 -0500 |
commit | e332bcb3d149644c344ee5fdf1f6e4ac39e9d9a3 (patch) | |
tree | 0a935bf3dc0d6242f161a1ffa752009078da4bf9 /drivers | |
parent | cdb08f8fd8642a6d661c920f565e85cf87a0c9be (diff) |
sfc: Remove fallback for invalid permanent MAC address
By the time we look at the MAC address in efx_probe_port(), either the
driver or the firmware has already validated the board configuration.
The possibility of having an invalid MAC address just isn't worth
considering. It certainly isn't worth having a compile-time option
for this.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index d7301d2e81a7..eff5d300aa0a 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -122,15 +122,6 @@ static int napi_weight = 64; | |||
122 | */ | 122 | */ |
123 | static unsigned int efx_monitor_interval = 1 * HZ; | 123 | static unsigned int efx_monitor_interval = 1 * HZ; |
124 | 124 | ||
125 | /* This controls whether or not the driver will initialise devices | ||
126 | * with invalid MAC addresses stored in the EEPROM or flash. If true, | ||
127 | * such devices will be initialised with a random locally-generated | ||
128 | * MAC address. This allows for loading the sfc_mtd driver to | ||
129 | * reprogram the flash, even if the flash contents (including the MAC | ||
130 | * address) have previously been erased. | ||
131 | */ | ||
132 | static unsigned int allow_bad_hwaddr; | ||
133 | |||
134 | /* Initial interrupt moderation settings. They can be modified after | 125 | /* Initial interrupt moderation settings. They can be modified after |
135 | * module load with ethtool. | 126 | * module load with ethtool. |
136 | * | 127 | * |
@@ -916,7 +907,6 @@ static void efx_mac_work(struct work_struct *data) | |||
916 | 907 | ||
917 | static int efx_probe_port(struct efx_nic *efx) | 908 | static int efx_probe_port(struct efx_nic *efx) |
918 | { | 909 | { |
919 | unsigned char *perm_addr; | ||
920 | int rc; | 910 | int rc; |
921 | 911 | ||
922 | netif_dbg(efx, probe, efx->net_dev, "create port\n"); | 912 | netif_dbg(efx, probe, efx->net_dev, "create port\n"); |
@@ -929,28 +919,10 @@ static int efx_probe_port(struct efx_nic *efx) | |||
929 | if (rc) | 919 | if (rc) |
930 | return rc; | 920 | return rc; |
931 | 921 | ||
932 | /* Sanity check MAC address */ | 922 | /* Initialise MAC address to permanent address */ |
933 | perm_addr = efx->net_dev->perm_addr; | 923 | memcpy(efx->net_dev->dev_addr, efx->net_dev->perm_addr, ETH_ALEN); |
934 | if (is_valid_ether_addr(perm_addr)) { | ||
935 | memcpy(efx->net_dev->dev_addr, perm_addr, ETH_ALEN); | ||
936 | } else { | ||
937 | netif_err(efx, probe, efx->net_dev, "invalid MAC address %pM\n", | ||
938 | perm_addr); | ||
939 | if (!allow_bad_hwaddr) { | ||
940 | rc = -EINVAL; | ||
941 | goto err; | ||
942 | } | ||
943 | random_ether_addr(efx->net_dev->dev_addr); | ||
944 | netif_info(efx, probe, efx->net_dev, | ||
945 | "using locally-generated MAC %pM\n", | ||
946 | efx->net_dev->dev_addr); | ||
947 | } | ||
948 | 924 | ||
949 | return 0; | 925 | return 0; |
950 | |||
951 | err: | ||
952 | efx->type->remove_port(efx); | ||
953 | return rc; | ||
954 | } | 926 | } |
955 | 927 | ||
956 | static int efx_init_port(struct efx_nic *efx) | 928 | static int efx_init_port(struct efx_nic *efx) |