Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32e7bfc4 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

net: use helpers to access uc list V2



This patch introduces three macros to work with uc list from net drivers.

Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9010bc33
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@
#include <linux/cache.h>
#include <linux/firmware.h>
#include <linux/log2.h>
#include <linux/list.h>

#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE)
#define BCM_CNIC 1
@@ -3579,14 +3578,14 @@ bnx2_set_rx_mode(struct net_device *dev)
		sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN;
	}

	if (dev->uc.count > BNX2_MAX_UNICAST_ADDRESSES) {
	if (netdev_uc_count(dev) > BNX2_MAX_UNICAST_ADDRESSES) {
		rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS;
		sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN |
			     BNX2_RPM_SORT_USER0_PROM_VLAN;
	} else if (!(dev->flags & IFF_PROMISC)) {
		/* Add all entries into to the match filter list */
		i = 0;
		list_for_each_entry(ha, &dev->uc.list, list) {
		netdev_for_each_uc_addr(ha, dev) {
			bnx2_set_mac_addr(bp, ha->addr,
					  i + BNX2_START_UNICAST_ADDRESS_INDEX);
			sort_mode |= (1 <<
+2 −2
Original line number Diff line number Diff line
@@ -2139,7 +2139,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
			rctl |= E1000_RCTL_VFE;
	}

	if (netdev->uc.count > rar_entries - 1) {
	if (netdev_uc_count(netdev) > rar_entries - 1) {
		rctl |= E1000_RCTL_UPE;
	} else if (!(netdev->flags & IFF_PROMISC)) {
		rctl &= ~E1000_RCTL_UPE;
@@ -2162,7 +2162,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
	 */
	i = 1;
	if (use_uc)
		list_for_each_entry(ha, &netdev->uc.list, list) {
		netdev_for_each_uc_addr(ha, netdev) {
			if (i == rar_entries)
				break;
			e1000_rar_set(hw, ha->addr, i++);
+4 −3
Original line number Diff line number Diff line
@@ -2905,12 +2905,13 @@ static int igb_write_uc_addr_list(struct net_device *netdev)
	int count = 0;

	/* return ENOMEM indicating insufficient memory for addresses */
	if (netdev->uc.count > rar_entries)
	if (netdev_uc_count(netdev) > rar_entries)
		return -ENOMEM;

	if (netdev->uc.count && rar_entries) {
	if (!netdev_uc_empty(netdev) && rar_entries) {
		struct netdev_hw_addr *ha;
		list_for_each_entry(ha, &netdev->uc.list, list) {

		netdev_for_each_uc_addr(ha, netdev) {
			if (!rar_entries)
				break;
			igb_rar_set_qsel(adapter, ha->addr,
+3 −4
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/netdevice.h>

#include "ixgbe.h"
@@ -1347,7 +1346,7 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
/**
 *  ixgbe_update_uc_addr_list_generic - Updates MAC list of secondary addresses
 *  @hw: pointer to hardware structure
 *  @uc_list: the list of new addresses
 *  @netdev: pointer to net device structure
 *
 *  The given list replaces any existing list.  Clears the secondary addrs from
 *  receive address registers.  Uses unused receive address registers for the
@@ -1357,7 +1356,7 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
 *  manually putting the device into promiscuous mode.
 **/
s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
				      struct list_head *uc_list)
				      struct net_device *netdev)
{
	u32 i;
	u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc;
@@ -1381,7 +1380,7 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
	}

	/* Add the new addresses */
	list_for_each_entry(ha, uc_list, list) {
	netdev_for_each_uc_addr(ha, netdev) {
		hw_dbg(hw, " Adding the secondary addresses:\n");
		ixgbe_add_uc_addr(hw, ha->addr, 0);
	}
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
                                      u32 mc_addr_count,
                                      ixgbe_mc_addr_itr func);
s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
				      struct list_head *uc_list);
				      struct net_device *netdev);
s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw);
s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval);
Loading