BNX2X: Init of one NIC complete

The second one freezes the machine at:

bnx2x:[bnx2x_fw_command:3013()]wrote command (20010001) to FW MB param 0x00000000
bnx2x:[bnx2x_stats_handle:1434(ether0)]state 0 -> event 2 -> state 0
diff --git a/kern/drivers/net/bnx2x/akaros_compat.h b/kern/drivers/net/bnx2x/akaros_compat.h
index 925d4cb..e7a10b3 100644
--- a/kern/drivers/net/bnx2x/akaros_compat.h
+++ b/kern/drivers/net/bnx2x/akaros_compat.h
@@ -228,6 +228,8 @@
 	printk("[netdev]: " fmt, ##__VA_ARGS__)
 #define netdev_info(dev, fmt, ...) \
 	printk("[netdev]: " fmt, ##__VA_ARGS__)
+#define netdev_dbg(dev, fmt, ...) \
+	printk("[netdev]: " fmt, ##__VA_ARGS__)
 #define dev_err(dev, fmt, ...) \
 	printk("[dev]: " fmt, ##__VA_ARGS__)
 #define dev_info(dev, fmt, ...) \
@@ -488,6 +490,30 @@
 #define NETIF_F_HIGHDMA				0
 #define NETIF_F_HW_VLAN_CTAG_RX		0
 
+#define netif_msg_drv(p)		((p)->msg_enable & NETIF_MSG_DRV)
+#define netif_msg_probe(p)		((p)->msg_enable & NETIF_MSG_PROBE)
+#define netif_msg_link(p)		((p)->msg_enable & NETIF_MSG_LINK)
+#define netif_msg_timer(p)		((p)->msg_enable & NETIF_MSG_TIMER)
+#define netif_msg_ifdown(p)		((p)->msg_enable & NETIF_MSG_IFDOWN)
+#define netif_msg_ifup(p)		((p)->msg_enable & NETIF_MSG_IFUP)
+#define netif_msg_rx_err(p)		((p)->msg_enable & NETIF_MSG_RX_ERR)
+#define netif_msg_tx_err(p)		((p)->msg_enable & NETIF_MSG_TX_ERR)
+#define netif_msg_tx_queued(p)	((p)->msg_enable & NETIF_MSG_TX_QUEUED)
+#define netif_msg_intr(p)		((p)->msg_enable & NETIF_MSG_INTR)
+#define netif_msg_tx_done(p)	((p)->msg_enable & NETIF_MSG_TX_DONE)
+#define netif_msg_rx_status(p)	((p)->msg_enable & NETIF_MSG_RX_STATUS)
+#define netif_msg_pktdata(p)	((p)->msg_enable & NETIF_MSG_PKTDATA)
+#define netif_msg_hw(p)			((p)->msg_enable & NETIF_MSG_HW)
+#define netif_msg_wol(p)		((p)->msg_enable & NETIF_MSG_WOL)
+
+enum netdev_state_t {                       
+	__LINK_STATE_START,                                       
+	__LINK_STATE_PRESENT,                                     
+	__LINK_STATE_NOCARRIER,                          
+	__LINK_STATE_LINKWATCH_PENDING,                  
+	__LINK_STATE_DORMANT,  
+};
+
 /* Global mutex in linux for "routing netlink".  Not sure if we have an
  * equivalent or not in Plan 9. */
 #define rtnl_lock()
@@ -629,6 +655,8 @@
 #define eth_hw_addr_random(...)
 /* checks if the MAC is not 0 and not multicast (all 1s) */
 #define is_valid_ether_addr(...) (TRUE)
+/* The flag this checks is set on before open.  Turned off on failure, etc. */
+#define netif_running(dev) (TRUE)
 
 #define EPROBE_DEFER 1
 #define NET_SKB_PAD 32		/* we'll probably delete code using this */
@@ -690,4 +718,28 @@
 	}
 }
 
+static inline uint32_t ethtool_rxfh_indir_default(uint32_t index,
+                                                  uint32_t n_rx_rings)
+{
+	return index % n_rx_rings;
+}
+
+/* Plan 9 does a memcmp for this.  We should probably have a helper, like for
+ * IP addrs. */
+static inline bool ether_addr_equal(const uint8_t *addr1, const uint8_t *addr2)
+{
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
+	uint32_t fold = ((*(const uint32_t *)addr1) ^ (*(const uint32_t *)addr2)) |
+	((*(const uint16_t *)(addr1 + 4)) ^ (*(const uint16_t *)(addr2 + 4)));
+
+	return fold == 0;
+#else
+	const uint16_t *a = (const uint16_t *)addr1;
+	const uint16_t *b = (const uint16_t *)addr2;
+
+	return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
+#endif
+}
+
+
 #endif /* ROS_KERN_AKAROS_COMPAT_H */
diff --git a/kern/drivers/net/bnx2x/bnx2x.h b/kern/drivers/net/bnx2x/bnx2x.h
index a40d4e9..059c2b0 100644
--- a/kern/drivers/net/bnx2x/bnx2x.h
+++ b/kern/drivers/net/bnx2x/bnx2x.h
@@ -1660,7 +1660,7 @@
 	uint32_t			link_cnt;
 	struct bnx2x_link_report_data last_reported_link;
 
-	struct mdio_if_info	mdio;
+	//struct mdio_if_info	mdio;
 
 	struct bnx2x_common	common;
 	struct bnx2x_port	port;
diff --git a/kern/drivers/net/bnx2x/bnx2x_cmn.c b/kern/drivers/net/bnx2x/bnx2x_cmn.c
index 458b0d1..3353423 100644
--- a/kern/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/kern/drivers/net/bnx2x/bnx2x_cmn.c
@@ -1221,8 +1221,6 @@
 static void bnx2x_fill_report_data(struct bnx2x *bp,
 				   struct bnx2x_link_report_data *data)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	memset(data, 0, sizeof(*data));
 
 	if (IS_PF(bp)) {
@@ -1255,7 +1253,6 @@
 	} else { /* VF */
 		*data = bp->vf_link_vars;
 	}
-#endif
 }
 
 /**
@@ -1285,8 +1282,6 @@
  */
 void __bnx2x_link_report(struct bnx2x *bp)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x_link_report_data cur_data;
 
 	/* reread mf_cfg */
@@ -1353,7 +1348,6 @@
 		netdev_info(bp->dev, "NIC Link is Up, %d Mbps %s duplex, Flow control: %s\n",
 			    cur_data.line_speed, duplex, flow);
 	}
-#endif
 }
 
 static void bnx2x_set_next_page_sgl(struct bnx2x_fastpath *fp)
@@ -2110,8 +2104,6 @@
 
 static int bnx2x_init_rss(struct bnx2x *bp)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	int i;
 	uint8_t num_eth_queues = BNX2X_NUM_ETH_QUEUES(bp);
 
@@ -2132,14 +2124,11 @@
 	 * configuration.
 	 */
 	return bnx2x_config_rss_eth(bp, bp->port.pmf || !CHIP_IS_E1x(bp));
-#endif
 }
 
 int bnx2x_rss(struct bnx2x *bp, struct bnx2x_rss_config_obj *rss_obj,
 	      bool config_hash, bool enable)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x_config_rss_params params = {NULL};
 
 	/* Although RSS is meaningless when there is a single HW queue we
@@ -2180,7 +2169,12 @@
 
 	if (config_hash) {
 		/* RSS keys */
+		#if 0 // AKAROS_PORT
 		netdev_rss_key_fill(params.rss_key, T_ETH_RSS_KEY * 4);
+		#else
+		/* linux picks a random, once, then uses it here.  it could be 5a! */
+		memset(params.rss_key, 0x5a, T_ETH_RSS_KEY * 4);
+		#endif
 		__set_bit(BNX2X_RSS_SET_SRCH, &params.rss_flags);
 	}
 
@@ -2188,7 +2182,6 @@
 		return bnx2x_config_rss(bp, &params);
 	else
 		return bnx2x_vfpf_config_rss(bp, &params);
-#endif
 }
 
 static int bnx2x_init_hw(struct bnx2x *bp, uint32_t load_code)
@@ -2247,7 +2240,6 @@
 	 * we take a lock surrounding both the initial send and the CONTs,
 	 * as we don't want a true completion to disrupt us in the middle.
 	 */
-// KPF HERE (prob not init) XME (devether qlock. really the first time?)
 	qlock(&bp->dev->qlock);
 	rc = bnx2x_config_mcast(bp, &rparam, BNX2X_MCAST_CMD_DEL);
 	if (rc < 0)
@@ -2795,7 +2787,6 @@
 
 	bnx2x_pre_irq_nic_init(bp);
 
-// XME HERE
 	/* Connect to IRQs */
 	rc = bnx2x_setup_irqs(bp);
 	if (rc) {
@@ -2870,14 +2861,11 @@
 	bp->state = BNX2X_STATE_OPEN;
 
 	/* Configure a ucast MAC */
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	if (IS_PF(bp))
 		rc = bnx2x_set_eth_mac(bp, true);
 	else /* vf */
-		rc = bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr, bp->fp->index,
+		rc = bnx2x_vfpf_config_mac(bp, bp->dev->ea, bp->fp->index,
 					   true);
-#endif
 	if (rc) {
 		BNX2X_ERR("Setting Ethernet MAC failed\n");
 		LOAD_ERROR_EXIT(bp, load_error3);
@@ -4828,8 +4816,6 @@
 
 int bnx2x_get_cur_phy_idx(struct bnx2x *bp)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint32_t sel_phy_idx = 0;
 	if (bp->link_params.num_phys <= 1)
 		return INT_PHY;
@@ -4856,8 +4842,8 @@
 	}
 
 	return sel_phy_idx;
-#endif
 }
+
 int bnx2x_get_link_cfg_idx(struct bnx2x *bp)
 {
 	uint32_t sel_phy_idx = bnx2x_get_cur_phy_idx(bp);
diff --git a/kern/drivers/net/bnx2x/bnx2x_dev.c b/kern/drivers/net/bnx2x/bnx2x_dev.c
index e96f087..83d72ff 100644
--- a/kern/drivers/net/bnx2x/bnx2x_dev.c
+++ b/kern/drivers/net/bnx2x/bnx2x_dev.c
@@ -316,6 +316,7 @@
 
 	bnx2x_init_one(ctlr->edev, ctlr, ctlr->pcidev, ctlr->pci_id);
 	bnx2x_open(ctlr->edev);
+	//next ndo_set_rx_mode
 	/* despite the name, we attach at reset time.  BXE attach has a lot of
 	 * mmio mappings that have to happen at boot (in akaros), instead of during
 	 * devether's attach (at runtime) */
@@ -419,6 +420,15 @@
 	if (ctlr == NULL)
 		return -1;
 
+	/* TODO: super-dirty hack.  This lock is normally not init'd until after
+	 * reset reset/pnp.  But we want to use it earlier, since we call open
+	 * during reset, instead of attach.  And that happens because we register
+	 * IRQs in open, and MSIX IRQs need to be done at init time (Akaros could
+	 * fix this).
+	 *
+	 * Anyway, we init the qlock here *and* in netifinit.  Good luck. */
+	qlock_init(&edev->qlock);
+
 	edev->ctlr = ctlr;
 	ctlr->edev = edev;
 
diff --git a/kern/drivers/net/bnx2x/bnx2x_link.c b/kern/drivers/net/bnx2x/bnx2x_link.c
index 31988cc..e9da2f7 100644
--- a/kern/drivers/net/bnx2x/bnx2x_link.c
+++ b/kern/drivers/net/bnx2x/bnx2x_link.c
@@ -1550,8 +1550,6 @@
 static void bnx2x_umac_enable(struct link_params *params,
 			    struct link_vars *vars, uint8_t lb)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint32_t val;
 	uint32_t umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0;
 	struct bnx2x *bp = params->bp;
@@ -1644,8 +1642,6 @@
 	bnx2x_set_xumac_nig(params,
 			    ((vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) != 0), 1);
 	vars->mac_type = MAC_TYPE_UMAC;
-
-#endif
 }
 
 /* Define the XMAC mode */
@@ -1742,8 +1738,6 @@
 static int bnx2x_xmac_enable(struct link_params *params,
 			     struct link_vars *vars, uint8_t lb)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint32_t val, xmac_base;
 	struct bnx2x *bp = params->bp;
 	DP(NETIF_MSG_LINK, "enabling XMAC\n");
@@ -1809,7 +1803,6 @@
 	vars->mac_type = MAC_TYPE_XMAC;
 
 	return 0;
-#endif
 }
 
 static int bnx2x_emac_enable(struct link_params *params,
@@ -4168,8 +4161,6 @@
 					   uint8_t fiber_mode,
 					   uint8_t always_autoneg)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint16_t val16, digctrl_kx1, digctrl_kx2;
 
@@ -4245,7 +4236,6 @@
 	bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
 			MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X1,
 			(digctrl_kx1 | 0x10));
-#endif
 }
 
 static void bnx2x_warpcore_reset_lane(struct bnx2x *bp,
@@ -4632,8 +4622,6 @@
 static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy,
 					struct link_params *params)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint16_t val16;
 	uint32_t lane;
@@ -4672,7 +4660,6 @@
 		bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
 					 MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x1);
 	}
-#endif
 }
 
 
@@ -4680,8 +4667,6 @@
 static void bnx2x_sync_link(struct link_params *params,
 			     struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint8_t link_10g_plus;
 	if (vars->link_status & LINK_STATUS_PHYSICAL_LINK_FLAG)
@@ -4783,7 +4768,6 @@
 		if (vars->link_status & LINK_STATUS_SFP_TX_FAULT)
 			vars->phy_flags |= PHY_SFP_TX_FAULT_FLAG;
 	}
-#endif
 }
 
 void bnx2x_link_status_update(struct link_params *params,
@@ -5121,8 +5105,6 @@
 				 struct link_params *params,
 				 struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint16_t reg_val;
 
@@ -5166,7 +5148,6 @@
 			  MDIO_REG_BANK_SERDES_DIGITAL,
 			  MDIO_SERDES_DIGITAL_MISC1, reg_val);
 
-#endif
 }
 
 static void bnx2x_set_brcm_cl37_advertisement(struct bnx2x_phy *phy,
@@ -5254,8 +5235,6 @@
 					   struct link_params *params,
 					   struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint16_t control1;
 
@@ -5320,7 +5299,6 @@
 		/* Enable and restart AN */
 		bnx2x_restart_autoneg(phy, params, 0);
 	}
-#endif
 }
 
 /* Link management
@@ -5522,8 +5500,6 @@
 				      uint16_t speed_mask,
 				      uint16_t is_duplex)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	if (phy->req_line_speed == SPEED_AUTO_NEG)
 		vars->link_status |= LINK_STATUS_AUTO_NEGOTIATE_ENABLED;
@@ -5606,15 +5582,12 @@
 	DP(NETIF_MSG_LINK, " phy_link_up %x line_speed %d\n",
 		    vars->phy_link_up, vars->line_speed);
 	return 0;
-#endif
 }
 
 static int bnx2x_link_settings_status(struct bnx2x_phy *phy,
 				      struct link_params *params,
 				      struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 
 	uint16_t gp_status, duplex = DUPLEX_HALF, link_up = 0, speed_mask;
@@ -5683,15 +5656,12 @@
 	DP(NETIF_MSG_LINK, "duplex %x  flow_ctrl 0x%x link_status 0x%x\n",
 		   vars->duplex, vars->flow_ctrl, vars->link_status);
 	return rc;
-#endif
 }
 
 static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy,
 				     struct link_params *params,
 				     struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint8_t lane;
 	uint16_t gp_status1, gp_speed, link_up, duplex = DUPLEX_FULL;
@@ -5812,7 +5782,6 @@
 	DP(NETIF_MSG_LINK, "duplex %x  flow_ctrl 0x%x link_status 0x%x\n",
 		   vars->duplex, vars->flow_ctrl, vars->link_status);
 	return rc;
-#endif
 }
 static void bnx2x_set_gmii_tx_driver(struct link_params *params)
 {
@@ -5856,8 +5825,6 @@
 static int bnx2x_emac_program(struct link_params *params,
 			      struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	uint8_t port = params->port;
 	uint16_t mode = 0;
@@ -5900,7 +5867,6 @@
 
 	bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed);
 	return 0;
-#endif
 }
 
 static void bnx2x_set_preemphasis(struct bnx2x_phy *phy,
@@ -6538,8 +6504,6 @@
 static int bnx2x_link_initialize(struct link_params *params,
 				 struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint8_t phy_index, non_ext_phy;
 	struct bnx2x *bp = params->bp;
 	/* In case of external phy existence, the line speed would be the
@@ -6613,7 +6577,6 @@
 			NIG_STATUS_SERDES0_LINK_STATUS |
 			NIG_MASK_MI_INT));
 	return 0;
-#endif
 }
 
 static void bnx2x_int_link_reset(struct bnx2x_phy *phy,
@@ -6794,8 +6757,6 @@
  */
 int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = params->bp;
 	struct link_vars phy_vars[MAX_PHYS];
 	uint8_t port = params->port;
@@ -7044,7 +7005,6 @@
 		bnx2x_fw_command(bp, DRV_MSG_CODE_LINK_STATUS_CHANGED, 0);
 
 	return rc;
-#endif
 }
 
 /*****************************************************************************/
diff --git a/kern/drivers/net/bnx2x/bnx2x_main.c b/kern/drivers/net/bnx2x/bnx2x_main.c
index e5e2bc7..076f6da 100644
--- a/kern/drivers/net/bnx2x/bnx2x_main.c
+++ b/kern/drivers/net/bnx2x/bnx2x_main.c
@@ -2275,8 +2275,6 @@
 
 void bnx2x_calc_fc_adv(struct bnx2x *bp)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint8_t cfg_idx = bnx2x_get_link_cfg_idx(bp);
 	switch (bp->link_vars.ieee_fc &
 		MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) {
@@ -2299,7 +2297,6 @@
 						   ADVERTISED_Pause);
 		break;
 	}
-#endif
 }
 
 static void bnx2x_set_requested_fc(struct bnx2x *bp)
@@ -3648,11 +3645,9 @@
 	qunlock(&bp->drv_info_mutex);
 }
 
-static uint32_t bnx2x_update_mng_version_utility(uint8_t *version,
+static uint32_t bnx2x_update_mng_version_utility(char *version,
 					    bool bnx2x_format)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint8_t vals[4];
 	int i = 0;
 
@@ -3670,18 +3665,15 @@
 		vals[i++] = 0;
 
 	return (vals[0] << 24) | (vals[1] << 16) | (vals[2] << 8) | vals[3];
-#endif
 }
 
 void bnx2x_update_mng_version(struct bnx2x *bp)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint32_t iscsiver = DRV_VER_NOT_LOADED;
 	uint32_t fcoever = DRV_VER_NOT_LOADED;
 	uint32_t ethver = DRV_VER_NOT_LOADED;
 	int idx = BP_FW_MB_IDX(bp);
-	uint8_t *version;
+	char *version; // AKAROS_PORT (type conversion issues)
 
 	if (!SHMEM2_HAS(bp, func_os_drv_ver))
 		return;
@@ -3703,13 +3695,13 @@
 	memset(&bp->slowpath->drv_info_to_mcp, 0,
 	       sizeof(union drv_info_to_mcp));
 	bnx2x_drv_info_iscsi_stat(bp);
-	version = bp->slowpath->drv_info_to_mcp.iscsi_stat.version;
+	version = (char*)bp->slowpath->drv_info_to_mcp.iscsi_stat.version;
 	iscsiver = bnx2x_update_mng_version_utility(version, false);
 
 	memset(&bp->slowpath->drv_info_to_mcp, 0,
 	       sizeof(union drv_info_to_mcp));
 	bnx2x_drv_info_fcoe_stat(bp);
-	version = bp->slowpath->drv_info_to_mcp.fcoe_stat.version;
+	version = (char*)bp->slowpath->drv_info_to_mcp.fcoe_stat.version;
 	fcoever = bnx2x_update_mng_version_utility(version, false);
 
 out:
@@ -3721,7 +3713,6 @@
 
 	DP(BNX2X_MSG_MCP, "Setting driver version: ETH [%08x] iSCSI [%08x] FCoE [%08x]\n",
 	   ethver, iscsiver, fcoever);
-#endif
 }
 
 static void bnx2x_oem_event(struct bnx2x *bp, uint32_t event)
@@ -5747,8 +5738,6 @@
 
 static void bnx2x_timer(unsigned long data)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = (struct bnx2x *) data;
 
 	if (!netif_running(bp->dev))
@@ -5784,7 +5773,6 @@
 	if (IS_VF(bp))
 		bnx2x_timer_sriov(bp);
 
-#endif
 }
 
 /* RKM style, set_alarm directly */
@@ -8446,8 +8434,6 @@
 
 int bnx2x_set_eth_mac(struct bnx2x *bp, bool set)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	if (IS_PF(bp)) {
 		unsigned long ramrod_flags = 0;
 
@@ -8460,7 +8446,6 @@
 		return bnx2x_vfpf_config_mac(bp, bp->dev->ea,
 					     bp->fp->index, true);
 	}
-#endif
 }
 
 int bnx2x_setup_leading(struct bnx2x *bp)
@@ -10090,8 +10075,6 @@
  */
 static void bnx2x_sp_rtnl_task(struct work_struct *work)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = container_of(work, struct bnx2x, sp_rtnl_task.work);
 
 	rtnl_lock();
@@ -10154,7 +10137,9 @@
 	 */
 	if (test_and_clear_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state)) {
 		DP(NETIF_MSG_HW, "fan failure detected. Unloading driver\n");
+		#if 0 // AKAROS_PORT
 		netif_device_detach(bp->dev);
+		#endif
 		bnx2x_close(bp->dev);
 		rtnl_unlock();
 		return;
@@ -10167,10 +10152,13 @@
 	}
 	if (test_and_clear_bit(BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
 			       &bp->sp_rtnl_state)){
+		panic("Not implemented");
+		#if 0 // AKAROS_PORT
 		if (!test_bit(__LINK_STATE_NOCARRIER, &bp->dev->state)) {
 			bnx2x_tx_disable(bp);
 			BNX2X_ERR("PF indicated channel is not servicable anymore. This means this VF device is no longer operational\n");
 		}
+		#endif
 	}
 
 	if (test_and_clear_bit(BNX2X_SP_RTNL_RX_MODE, &bp->sp_rtnl_state)) {
@@ -10202,13 +10190,10 @@
 		bnx2x_disable_sriov(bp);
 		bnx2x_enable_sriov(bp);
 	}
-#endif
 }
 
 static void bnx2x_period_task(struct work_struct *work)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x *bp = container_of(work, struct bnx2x, period_task.work);
 
 	if (!netif_running(bp->dev))
@@ -10236,7 +10221,6 @@
 	bnx2x_release_phy_lock(bp);
 period_task_exit:
 	return;
-#endif
 }
 
 /*
@@ -12530,7 +12514,7 @@
 
 	qlock(&bp->dev->qlock);
 
-#if 0 // AKAROS_PORT skip promisc and multicast
+#if 0 // AKAROS_PORT skip promisc, multicast, unicast XME
 	if (bp->dev->flags & IFF_PROMISC) {
 		rx_mode = BNX2X_RX_MODE_PROMISC;
 	} else if ((bp->dev->flags & IFF_ALLMULTI) ||
@@ -12538,9 +12522,6 @@
 		    CHIP_IS_E1(bp))) {
 		rx_mode = BNX2X_RX_MODE_ALLMULTI;
 	} else {
-#else
-	{
-#endif
 		if (IS_PF(bp)) {
 			/* some multicasts */
 			if (bnx2x_set_mc_list(bp) < 0)
@@ -12559,6 +12540,7 @@
 					       BNX2X_SP_RTNL_VFPF_MCAST, 0);
 		}
 	}
+#endif
 
 	bp->rx_mode = rx_mode;
 	/* handle ISCSI SD mode */
diff --git a/kern/drivers/net/bnx2x/bnx2x_sp.c b/kern/drivers/net/bnx2x/bnx2x_sp.c
index 6ef4834..11d7087 100644
--- a/kern/drivers/net/bnx2x/bnx2x_sp.c
+++ b/kern/drivers/net/bnx2x/bnx2x_sp.c
@@ -602,11 +602,9 @@
 			       struct bnx2x_vlan_mac_obj *o,
 			       union bnx2x_classification_ramrod_data *data)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x_vlan_mac_registry_elem *pos;
 
-	DP(BNX2X_MSG_SP, "Checking MAC %pM for ADD command\n", data->mac.mac);
+	DP(BNX2X_MSG_SP, "Checking MAC %E for ADD command\n", data->mac.mac);
 
 	if (!is_valid_ether_addr(data->mac.mac))
 		return -EINVAL;
@@ -618,7 +616,6 @@
 			return -EEXIST;
 
 	return 0;
-#endif
 }
 
 static int bnx2x_check_vlan_add(struct bnx2x *bp,
@@ -3757,8 +3754,6 @@
 
 static bool bnx2x_credit_pool_get(struct bnx2x_credit_pool_obj *o, int cnt)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	bool rc;
 
 	mb();
@@ -3766,13 +3761,10 @@
 	mb();
 
 	return rc;
-#endif
 }
 
 static bool bnx2x_credit_pool_put(struct bnx2x_credit_pool_obj *o, int cnt)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	bool rc;
 
 	mb();
@@ -3783,7 +3775,6 @@
 	mb();
 
 	return rc;
-#endif
 }
 
 static int bnx2x_credit_pool_check(struct bnx2x_credit_pool_obj *o)
@@ -4037,8 +4028,6 @@
 static int bnx2x_setup_rss(struct bnx2x *bp,
 			   struct bnx2x_config_rss_params *p)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	struct bnx2x_rss_config_obj *o = p->rss_obj;
 	struct bnx2x_raw_obj *r = &o->raw;
 	struct eth_rss_update_ramrod_data *data =
@@ -4112,7 +4101,9 @@
 	memcpy(o->ind_table, p->ind_table, T_ETH_INDIRECTION_TABLE_SIZE);
 
 	/* Print the indirection table */
+	#if 0 // AKAROS_PORT
 	if (netif_msg_ifup(bp))
+	#endif
 		bnx2x_debug_print_ind_table(bp, p);
 
 	/* No need for an explicit memory barrier here as long as we
@@ -4132,7 +4123,6 @@
 		return rc;
 
 	return 1;
-#endif
 }
 
 void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj,
diff --git a/kern/drivers/net/bnx2x/bnx2x_stats.c b/kern/drivers/net/bnx2x/bnx2x_stats.c
index 1979139..20e13b8 100644
--- a/kern/drivers/net/bnx2x/bnx2x_stats.c
+++ b/kern/drivers/net/bnx2x/bnx2x_stats.c
@@ -1142,9 +1142,8 @@
 
 static void bnx2x_net_stats_update(struct bnx2x *bp)
 {
+#if 0 // AKAROS_PORT XME skipping net_stats_update
 	struct bnx2x_eth_stats *estats = &bp->eth_stats;
-panic("NOT IMPLEMENTED");
-#if 0 // AKAROS_PORT
 	struct net_device_stats *nstats = &bp->dev->stats;
 	unsigned long tmp;
 	int i;
@@ -1247,8 +1246,6 @@
 
 static void bnx2x_stats_update(struct bnx2x *bp)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	uint32_t *stats_comp = bnx2x_sp(bp, stats_comp);
 
 	/* we run update from timer context, so give up
@@ -1300,7 +1297,6 @@
 
 out:
 	up(&bp->stats_sema);
-#endif
 }
 
 static void bnx2x_port_stats_stop(struct bnx2x *bp)
@@ -1416,8 +1412,6 @@
 
 void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	enum bnx2x_stats_state state;
 	void (*action)(struct bnx2x *bp);
 	if (unlikely(bp->panic))
@@ -1434,7 +1428,6 @@
 	if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
 		DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
 		   state, event, bp->stats_state);
-#endif
 }
 
 static void bnx2x_port_stats_base_init(struct bnx2x *bp)
@@ -2016,13 +2009,10 @@
 			   void (func_to_exec)(void *cookie),
 			   void *cookie)
 {
-panic("Not implemented");
-#if 0 // AKAROS_PORT
 	if (down_timeout(&bp->stats_sema, HZ/10))
 		BNX2X_ERR("Unable to acquire stats lock\n");
 	bnx2x_stats_comp(bp);
 	func_to_exec(cookie);
 	__bnx2x_stats_start(bp);
 	up(&bp->stats_sema);
-#endif
 }