Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171960
b: refs/heads/master
c: 8be4f3e
h: refs/heads/master
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Nov 26, 2009
1 parent 6b6c660 commit 17bf8c5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9007b9fa368b172e6b9a985899080fbebb7d3204
refs/heads/master: 8be4f3e6f7b670529bd67aa1f0319bec1e29ebcf
38 changes: 24 additions & 14 deletions trunk/drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,18 @@ static void efx_phy_work(struct work_struct *data)
mutex_unlock(&efx->mac_lock);
}

/* Asynchronous work item for changing MAC promiscuity and multicast
* hash. Avoid a drain/rx_ingress enable by reconfiguring the current
* MAC directly. */
static void efx_mac_work(struct work_struct *data)
{
struct efx_nic *efx = container_of(data, struct efx_nic, mac_work);

mutex_lock(&efx->mac_lock);
if (efx->port_enabled) {
falcon_push_multicast_hash(efx);
efx->mac_op->reconfigure(efx);
}
mutex_unlock(&efx->mac_lock);
}

Expand Down Expand Up @@ -771,7 +778,12 @@ static void efx_start_port(struct efx_nic *efx)

mutex_lock(&efx->mac_lock);
efx->port_enabled = true;
__efx_reconfigure_port(efx);

/* efx_mac_work() might have been scheduled after efx_stop_port(),
* and then cancelled by efx_flush_all() */
falcon_push_multicast_hash(efx);
efx->mac_op->reconfigure(efx);

mutex_unlock(&efx->mac_lock);
}

Expand Down Expand Up @@ -1534,16 +1546,14 @@ static void efx_set_multicast_list(struct net_device *net_dev)
struct efx_nic *efx = netdev_priv(net_dev);
struct dev_mc_list *mc_list = net_dev->mc_list;
union efx_multicast_hash *mc_hash = &efx->multicast_hash;
bool promiscuous = !!(net_dev->flags & IFF_PROMISC);
bool changed = (efx->promiscuous != promiscuous);
u32 crc;
int bit;
int i;

efx->promiscuous = promiscuous;
efx->promiscuous = !!(net_dev->flags & IFF_PROMISC);

/* Build multicast hash table */
if (promiscuous || (net_dev->flags & IFF_ALLMULTI)) {
if (efx->promiscuous || (net_dev->flags & IFF_ALLMULTI)) {
memset(mc_hash, 0xff, sizeof(*mc_hash));
} else {
memset(mc_hash, 0x00, sizeof(*mc_hash));
Expand All @@ -1553,17 +1563,17 @@ static void efx_set_multicast_list(struct net_device *net_dev)
set_bit_le(bit, mc_hash->byte);
mc_list = mc_list->next;
}
}

if (!efx->port_enabled)
/* Delay pushing settings until efx_start_port() */
return;

if (changed)
queue_work(efx->workqueue, &efx->phy_work);
/* Broadcast packets go through the multicast hash filter.
* ether_crc_le() of the broadcast address is 0xbe2612ff
* so we always add bit 0xff to the mask.
*/
set_bit_le(0xff, mc_hash->byte);
}

/* Create and activate new global multicast hash table */
falcon_set_multicast_hash(efx);
if (efx->port_enabled)
queue_work(efx->workqueue, &efx->mac_work);
/* Otherwise efx_start_port() will do this */
}

static const struct net_device_ops efx_netdev_ops = {
Expand Down
10 changes: 3 additions & 7 deletions trunk/drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
efx_writeo(efx, &reg, FR_AB_MAC_CTRL);

/* Restore the multicast hash registers. */
falcon_set_multicast_hash(efx);
falcon_push_multicast_hash(efx);

/* Transmission of pause frames when RX crosses the threshold is
* covered by RX_XOFF_MAC_EN and XM_TX_CFG_REG:XM_FCNTL.
Expand Down Expand Up @@ -2327,15 +2327,11 @@ void falcon_remove_port(struct efx_nic *efx)
**************************************************************************
*/

void falcon_set_multicast_hash(struct efx_nic *efx)
void falcon_push_multicast_hash(struct efx_nic *efx)
{
union efx_multicast_hash *mc_hash = &efx->multicast_hash;

/* Broadcast packets go through the multicast hash filter.
* ether_crc_le() of the broadcast address is 0xbe2612ff
* so we always add bit 0xff to the mask.
*/
set_bit_le(0xff, mc_hash->byte);
WARN_ON(!mutex_is_locked(&efx->mac_lock));

efx_writeo(efx, &mc_hash->oword[0], FR_AB_MAC_MC_HASH_REG0);
efx_writeo(efx, &mc_hash->oword[1], FR_AB_MAC_MC_HASH_REG1);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/sfc/falcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ extern void falcon_remove_nic(struct efx_nic *efx);
extern void falcon_update_nic_stats(struct efx_nic *efx);
extern void falcon_start_nic_stats(struct efx_nic *efx);
extern void falcon_stop_nic_stats(struct efx_nic *efx);
extern void falcon_set_multicast_hash(struct efx_nic *efx);
extern void falcon_push_multicast_hash(struct efx_nic *efx);
extern int falcon_reset_xaui(struct efx_nic *efx);

/* Tests */
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/sfc/net_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ union efx_multicast_hash {
* @multicast_hash: Multicast hash table
* @wanted_fc: Wanted flow control flags
* @phy_work: work item for dealing with PHY events
* @mac_work: work item for dealing with MAC events
* @mac_work: Work item for changing MAC promiscuity and multicast hash
* @loopback_mode: Loopback status
* @loopback_modes: Supported loopback mode bitmask
* @loopback_selftest: Offline self-test private state
Expand Down

0 comments on commit 17bf8c5

Please sign in to comment.