Index: /branches/rel_apv_10_7/usr/src/sys/click/net/if_cafw.c
===================================================================
--- /branches/rel_apv_10_7/usr/src/sys/click/net/if_cafw.c	(revision 38274)
+++ /branches/rel_apv_10_7/usr/src/sys/click/net/if_cafw.c	(working copy)
@@ -1359,7 +1359,8 @@
 	 */
 	int nic_map_4x10g_fiber[4] = {2, 3, 0, 1};
 	int nic_map_4x10g_combo[4] = {3, 2, 1, 0};
-	int nic_map_aewin[4] = {3, 2, 1, 0};
+	int nic_map_aewin_4ports[4] = {3, 2, 1, 0};
+	int nic_map_aewin_2ports[2] = {1, 0};
 
 	/* XXX add the mainboard here to re-order NIC port number by pci bridge topplogy */
 	switch (chipset_id) {
@@ -1454,7 +1455,7 @@
 	default:
 		return;
 	}
-	
+
 	for(i = 0; map[i].dev_idx != -1; i++) {
 		idx = map[i].dev_idx;
 		func_idx = map[i].func_idx;
@@ -1473,12 +1474,21 @@
 				is_4x10g_combo_im_nic = 1;
 			}
 		}
-
-		for (j = 0; j < get_num_nics_on_pcib(idx, func_idx); j++) {
+		int num_nics = get_num_nics_on_pcib(idx, func_idx);
+		for (j = 0; j < num_nics; j++) {
 			int n;
 			if (is_aewin && submap == NICS_ON_SLOTS) {
-				n = nic_map_aewin[j];
-			}else if (is_4x10g_fiber_im_nic) {
+				// addon NIC has 4 physical ports
+				if (num_nics == 4) {
+					n = nic_map_aewin_4ports[j];
+				// addon NIC has 2 physical ports
+				} else if (num_nics == 2) {
+					n = nic_map_aewin_2ports[j];
+				// FIXIT: default mapping, in case we have 8 ports NIC in the future.
+				} else {
+					n = j;
+				}
+			} else if (is_4x10g_fiber_im_nic) {
 				n = nic_map_4x10g_fiber[j];
 			} else if (is_4x10g_combo_im_nic) {
 				n = nic_map_4x10g_combo[j];
@@ -1535,7 +1545,7 @@
 					continue;
 				}
 			}
-			printf("found NIC dpdk%d (%02x:%02x.%x) on ", nic_port_id_on_pcib(idx, func_idx, n), bus, dev, func);
+			printf("found %dth NIC dpdk%d (%02x:%02x.%x) on ", n, nic_port_id_on_pcib(idx, func_idx, n), bus, dev, func);
 			get_pcib_bdf(idx, func_idx, &bus, &dev, &func);
 			if (submap == NICS_ON_BOARD) {
 				printf("board (%02x:%02x.%x)\n", bus, dev, func);
