aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYitchak Gertner <gertner@broadcom.com>2008-08-13 18:52:28 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-13 19:03:38 -0400
commit3101c2bc9043c1499158837648a29dd79ee2f5e7 (patch)
tree1b0aaa3327fbdd719bb9f0942c8fbd4468d3979e
parent12469401bc5aebb1c1482db1253c986cf8221281 (diff)
bnx2x: Clearing MAC addresses filters
Clearing MAC addresses filters When the driver unloads, it should clear the MAC addresses filters in the HW - this prevents packets from entering the chip when the driver is re-loaded before initializing the right filters Signed-off-by: Yitchak Gertner <gertner@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2x_main.c68
1 files changed, 54 insertions, 14 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index ea6fcf3514b9..db6a3b9a367c 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -6048,7 +6048,7 @@ static int bnx2x_req_irq(struct bnx2x *bp)
6048 * Init service functions 6048 * Init service functions
6049 */ 6049 */
6050 6050
6051static void bnx2x_set_mac_addr_e1(struct bnx2x *bp) 6051static void bnx2x_set_mac_addr_e1(struct bnx2x *bp, int set)
6052{ 6052{
6053 struct mac_configuration_cmd *config = bnx2x_sp(bp, mac_config); 6053 struct mac_configuration_cmd *config = bnx2x_sp(bp, mac_config);
6054 int port = BP_PORT(bp); 6054 int port = BP_PORT(bp);
@@ -6070,11 +6070,15 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
6070 config->config_table[0].cam_entry.lsb_mac_addr = 6070 config->config_table[0].cam_entry.lsb_mac_addr =
6071 swab16(*(u16 *)&bp->dev->dev_addr[4]); 6071 swab16(*(u16 *)&bp->dev->dev_addr[4]);
6072 config->config_table[0].cam_entry.flags = cpu_to_le16(port); 6072 config->config_table[0].cam_entry.flags = cpu_to_le16(port);
6073 config->config_table[0].target_table_entry.flags = 0; 6073 if (set)
6074 config->config_table[0].target_table_entry.flags = 0;
6075 else
6076 CAM_INVALIDATE(config->config_table[0]);
6074 config->config_table[0].target_table_entry.client_id = 0; 6077 config->config_table[0].target_table_entry.client_id = 0;
6075 config->config_table[0].target_table_entry.vlan_id = 0; 6078 config->config_table[0].target_table_entry.vlan_id = 0;
6076 6079
6077 DP(NETIF_MSG_IFUP, "setting MAC (%04x:%04x:%04x)\n", 6080 DP(NETIF_MSG_IFUP, "%s MAC (%04x:%04x:%04x)\n",
6081 (set ? "setting" : "clearing"),
6078 config->config_table[0].cam_entry.msb_mac_addr, 6082 config->config_table[0].cam_entry.msb_mac_addr,
6079 config->config_table[0].cam_entry.middle_mac_addr, 6083 config->config_table[0].cam_entry.middle_mac_addr,
6080 config->config_table[0].cam_entry.lsb_mac_addr); 6084 config->config_table[0].cam_entry.lsb_mac_addr);
@@ -6084,8 +6088,11 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
6084 config->config_table[1].cam_entry.middle_mac_addr = 0xffff; 6088 config->config_table[1].cam_entry.middle_mac_addr = 0xffff;
6085 config->config_table[1].cam_entry.lsb_mac_addr = 0xffff; 6089 config->config_table[1].cam_entry.lsb_mac_addr = 0xffff;
6086 config->config_table[1].cam_entry.flags = cpu_to_le16(port); 6090 config->config_table[1].cam_entry.flags = cpu_to_le16(port);
6087 config->config_table[1].target_table_entry.flags = 6091 if (set)
6092 config->config_table[1].target_table_entry.flags =
6088 TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST; 6093 TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST;
6094 else
6095 CAM_INVALIDATE(config->config_table[1]);
6089 config->config_table[1].target_table_entry.client_id = 0; 6096 config->config_table[1].target_table_entry.client_id = 0;
6090 config->config_table[1].target_table_entry.vlan_id = 0; 6097 config->config_table[1].target_table_entry.vlan_id = 0;
6091 6098
@@ -6094,12 +6101,12 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
6094 U64_LO(bnx2x_sp_mapping(bp, mac_config)), 0); 6101 U64_LO(bnx2x_sp_mapping(bp, mac_config)), 0);
6095} 6102}
6096 6103
6097static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp) 6104static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp, int set)
6098{ 6105{
6099 struct mac_configuration_cmd_e1h *config = 6106 struct mac_configuration_cmd_e1h *config =
6100 (struct mac_configuration_cmd_e1h *)bnx2x_sp(bp, mac_config); 6107 (struct mac_configuration_cmd_e1h *)bnx2x_sp(bp, mac_config);
6101 6108
6102 if (bp->state != BNX2X_STATE_OPEN) { 6109 if (set && (bp->state != BNX2X_STATE_OPEN)) {
6103 DP(NETIF_MSG_IFUP, "state is %x, returning\n", bp->state); 6110 DP(NETIF_MSG_IFUP, "state is %x, returning\n", bp->state);
6104 return; 6111 return;
6105 } 6112 }
@@ -6123,9 +6130,14 @@ static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp)
6123 config->config_table[0].client_id = BP_L_ID(bp); 6130 config->config_table[0].client_id = BP_L_ID(bp);
6124 config->config_table[0].vlan_id = 0; 6131 config->config_table[0].vlan_id = 0;
6125 config->config_table[0].e1hov_id = cpu_to_le16(bp->e1hov); 6132 config->config_table[0].e1hov_id = cpu_to_le16(bp->e1hov);
6126 config->config_table[0].flags = BP_PORT(bp); 6133 if (set)
6134 config->config_table[0].flags = BP_PORT(bp);
6135 else
6136 config->config_table[0].flags =
6137 MAC_CONFIGURATION_ENTRY_E1H_ACTION_TYPE;
6127 6138
6128 DP(NETIF_MSG_IFUP, "setting MAC (%04x:%04x:%04x) E1HOV %d CLID %d\n", 6139 DP(NETIF_MSG_IFUP, "%s MAC (%04x:%04x:%04x) E1HOV %d CLID %d\n",
6140 (set ? "setting" : "clearing"),
6129 config->config_table[0].msb_mac_addr, 6141 config->config_table[0].msb_mac_addr,
6130 config->config_table[0].middle_mac_addr, 6142 config->config_table[0].middle_mac_addr,
6131 config->config_table[0].lsb_mac_addr, bp->e1hov, BP_L_ID(bp)); 6143 config->config_table[0].lsb_mac_addr, bp->e1hov, BP_L_ID(bp));
@@ -6150,13 +6162,13 @@ static int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
6150 bnx2x_rx_int(bp->fp, 10); 6162 bnx2x_rx_int(bp->fp, 10);
6151 /* if index is different from 0 6163 /* if index is different from 0
6152 * the reply for some commands will 6164 * the reply for some commands will
6153 * be on the none default queue 6165 * be on the non default queue
6154 */ 6166 */
6155 if (idx) 6167 if (idx)
6156 bnx2x_rx_int(&bp->fp[idx], 10); 6168 bnx2x_rx_int(&bp->fp[idx], 10);
6157 } 6169 }
6158 mb(); /* state is changed by bnx2x_sp_event() */
6159 6170
6171 mb(); /* state is changed by bnx2x_sp_event() */
6160 if (*state_p == state) 6172 if (*state_p == state)
6161 return 0; 6173 return 0;
6162 6174
@@ -6364,9 +6376,9 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6364 } 6376 }
6365 6377
6366 if (CHIP_IS_E1(bp)) 6378 if (CHIP_IS_E1(bp))
6367 bnx2x_set_mac_addr_e1(bp); 6379 bnx2x_set_mac_addr_e1(bp, 1);
6368 else 6380 else
6369 bnx2x_set_mac_addr_e1h(bp); 6381 bnx2x_set_mac_addr_e1h(bp, 1);
6370 6382
6371 if (bp->port.pmf) 6383 if (bp->port.pmf)
6372 bnx2x_initial_phy_init(bp); 6384 bnx2x_initial_phy_init(bp);
@@ -6668,6 +6680,34 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6668 } else 6680 } else
6669 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; 6681 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6670 6682
6683 if (CHIP_IS_E1(bp)) {
6684 struct mac_configuration_cmd *config =
6685 bnx2x_sp(bp, mcast_config);
6686
6687 bnx2x_set_mac_addr_e1(bp, 0);
6688
6689 for (i = 0; i < config->hdr.length_6b; i++)
6690 CAM_INVALIDATE(config->config_table[i]);
6691
6692 config->hdr.length_6b = i;
6693 if (CHIP_REV_IS_SLOW(bp))
6694 config->hdr.offset = BNX2X_MAX_EMUL_MULTI*(1 + port);
6695 else
6696 config->hdr.offset = BNX2X_MAX_MULTICAST*(1 + port);
6697 config->hdr.client_id = BP_CL_ID(bp);
6698 config->hdr.reserved1 = 0;
6699
6700 bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, 0,
6701 U64_HI(bnx2x_sp_mapping(bp, mcast_config)),
6702 U64_LO(bnx2x_sp_mapping(bp, mcast_config)), 0);
6703
6704 } else { /* E1H */
6705 bnx2x_set_mac_addr_e1h(bp, 0);
6706
6707 for (i = 0; i < MC_HASH_SIZE; i++)
6708 REG_WR(bp, MC_HASH_OFFSET(bp, i), 0);
6709 }
6710
6671 if (CHIP_IS_E1H(bp)) 6711 if (CHIP_IS_E1H(bp))
6672 REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0); 6712 REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0);
6673 6713
@@ -9811,9 +9851,9 @@ static int bnx2x_change_mac_addr(struct net_device *dev, void *p)
9811 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 9851 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
9812 if (netif_running(dev)) { 9852 if (netif_running(dev)) {
9813 if (CHIP_IS_E1(bp)) 9853 if (CHIP_IS_E1(bp))
9814 bnx2x_set_mac_addr_e1(bp); 9854 bnx2x_set_mac_addr_e1(bp, 1);
9815 else 9855 else
9816 bnx2x_set_mac_addr_e1h(bp); 9856 bnx2x_set_mac_addr_e1h(bp, 1);
9817 } 9857 }
9818 9858
9819 return 0; 9859 return 0;