diff --git a/userspace/snmpd/WR-SWITCH-MIB.txt b/userspace/snmpd/WR-SWITCH-MIB.txt
index 03da6fea6c4373c29b1f80fbdbcd4dc44376963c..107ab8b63042486e0eb7cc6a94ca4f46d3d1eb45 100644
--- a/userspace/snmpd/WR-SWITCH-MIB.txt
+++ b/userspace/snmpd/WR-SWITCH-MIB.txt
@@ -2627,22 +2627,28 @@ wrsPtpInstanceEntry OBJECT-TYPE
     STATUS      current
     DESCRIPTION
             "An entry containing pstats counters"
-    INDEX   { wrsPtpInstanceIndex }
+    INDEX   { wrsPtpInstancePortIndex, wrsPtpInstanceOnPortIndex }
     ::= { wrsPtpInstanceTable 1 }
 
 WrsPtpInstanceEntry ::=
     SEQUENCE {
-        wrsPtpInstanceIndex              Unsigned32,
-        wrsPtpInstancePort               Integer,
+        wrsPtpInstancePortIndex          Unsigned32,
+        wrsPtpInstanceOnPortIndex        Unsigned32,
+        wrsPtpInstancePort               INTEGER,
+        wrsPtpInstancePortInstance       INTEGER,
+        wrsPtpInstancePortName           DisplayString,
         wrsPtpInstanceName               DisplayString,
         wrsPtpInstanceState              INTEGER,
         wrsPtpInstanceStateNext          INTEGER,
         wrsPtpInstanceRole               INTEGER,
         wrsPtpInstanceMechanism          INTEGER,
-        wrsPtpInstanceProto              INTEGER
+        wrsPtpInstanceProto              INTEGER,
+        wrsPtpInstanceExt                INTEGER,
+        wrsPtpInstancePeerMac            PhysAddress,
+        wrsPtpInstancePeerVid            INTEGER,
     }
 
-wrsPtpInstanceIndex OBJECT-TYPE
+wrsPtpInstancePortIndex OBJECT-TYPE
     SYNTAX         Unsigned32
     MAX-ACCESS     not-accessible
     STATUS         current
@@ -2650,13 +2656,29 @@ wrsPtpInstanceIndex OBJECT-TYPE
             "Index for wrsPtpInstanceTable"
     ::= { wrsPtpInstanceEntry 1 }
 
+wrsPtpInstanceOnPortIndex OBJECT-TYPE
+    SYNTAX         Unsigned32
+    MAX-ACCESS     not-accessible
+    STATUS         current
+    DESCRIPTION
+            "Index for wrsPtpInstanceTable"
+    ::= { wrsPtpInstanceEntry 2 }
+
 wrsPtpInstancePort OBJECT-TYPE
-    SYNTAX         Integer
+    SYNTAX         INTEGER
     MAX-ACCESS     read-only
     STATUS         current
     DESCRIPTION
             "Port number on which an instance is running"
-    ::= { wrsPtpInstanceEntry 2 }
+    ::= { wrsPtpInstanceEntry 3 }
+
+wrsPtpInstancePortInstance OBJECT-TYPE
+    SYNTAX         INTEGER
+    MAX-ACCESS     read-only
+    STATUS         current
+    DESCRIPTION
+            "Index of an instance running on a port"
+    ::= { wrsPtpInstanceEntry 4 }
 
 wrsPtpInstancePortName OBJECT-TYPE
     SYNTAX         DisplayString (SIZE (0..12))
@@ -2664,7 +2686,7 @@ wrsPtpInstancePortName OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Port name of port"
-    ::= { wrsPtpInstanceEntry 3 }
+    ::= { wrsPtpInstanceEntry 5 }
 
 wrsPtpInstanceName OBJECT-TYPE
     SYNTAX         DisplayString (SIZE (0..12))
@@ -2672,7 +2694,7 @@ wrsPtpInstanceName OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Name of an instance"
-    ::= { wrsPtpInstanceEntry 4 }
+    ::= { wrsPtpInstanceEntry 6 }
 
 wrsPtpInstanceState OBJECT-TYPE
     SYNTAX         INTEGER {
@@ -2709,7 +2731,7 @@ wrsPtpInstanceState OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Name of instance"
-    ::= { wrsPtpInstanceEntry 5 }
+    ::= { wrsPtpInstanceEntry 7 }
 
 wrsPtpInstanceStateNext OBJECT-TYPE
     SYNTAX         INTEGER {
@@ -2746,7 +2768,7 @@ wrsPtpInstanceStateNext OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Name of instance"
-    ::= { wrsPtpInstanceEntry 6 }
+    ::= { wrsPtpInstanceEntry 8 }
 
 wrsPtpInstanceRole OBJECT-TYPE
     SYNTAX         INTEGER {
@@ -2759,7 +2781,7 @@ wrsPtpInstanceRole OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Role of instance"
-    ::= { wrsPtpInstanceEntry 7 }
+    ::= { wrsPtpInstanceEntry 9 }
 
 wrsPtpInstanceMechanism OBJECT-TYPE
     SYNTAX         INTEGER {
@@ -2771,7 +2793,7 @@ wrsPtpInstanceMechanism OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Mechanism used by an instance"
-    ::= { wrsPtpInstanceEntry 8 }
+    ::= { wrsPtpInstanceEntry 10 }
 
 wrsPtpInstanceProto OBJECT-TYPE
     SYNTAX         INTEGER {
@@ -2784,7 +2806,7 @@ wrsPtpInstanceProto OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Protocol used by an instance"
-    ::= { wrsPtpInstanceEntry 9 }
+    ::= { wrsPtpInstanceEntry 11 }
 
 wrsPtpInstanceExt OBJECT-TYPE
     SYNTAX         INTEGER {
@@ -2796,7 +2818,7 @@ wrsPtpInstanceExt OBJECT-TYPE
     STATUS         current
     DESCRIPTION
             "Extension used by an instance"
-    ::= { wrsPtpInstanceEntry 10 }
+    ::= { wrsPtpInstanceEntry 12 }
 
 wrsPtpInstancePeerMac  OBJECT-TYPE
     SYNTAX             PhysAddress
@@ -2804,7 +2826,7 @@ wrsPtpInstancePeerMac  OBJECT-TYPE
     STATUS             current
     DESCRIPTION
             "VID used by an instance"
-    ::= { wrsPtpInstanceEntry 11 }
+    ::= { wrsPtpInstanceEntry 13 }
 
 wrsPtpInstancePeerVid  OBJECT-TYPE
     SYNTAX             Integer
@@ -2812,7 +2834,7 @@ wrsPtpInstancePeerVid  OBJECT-TYPE
     STATUS             current
     DESCRIPTION
             "VID used by an instance"
-    ::= { wrsPtpInstanceEntry 12 }
+    ::= { wrsPtpInstanceEntry 14 }
 
 --wrsNetworking
 --Configuration
diff --git a/userspace/snmpd/wrsPtpInstanceTable.c b/userspace/snmpd/wrsPtpInstanceTable.c
index 2013a7a1cb0f132b9805a0b6277c123635141193..a2ed0a0e616c6b99d1a4ed0f1ec25d30bd5dcfd9 100644
--- a/userspace/snmpd/wrsPtpInstanceTable.c
+++ b/userspace/snmpd/wrsPtpInstanceTable.c
@@ -6,8 +6,10 @@ struct wrsPtpInstanceTable_s wrsPtpInstanceTable_array[PP_MAX_LINKS];
 
 static struct pickinfo wrsPtpInstanceTable_pickinfo[] = {
 	/* Warning: strings are a special case for snmp format */
-	FIELD(wrsPtpInstanceTable_s, ASN_UNSIGNED, wrsPtpInstanceIndex), /* not reported */
+	FIELD(wrsPtpInstanceTable_s, ASN_UNSIGNED, wrsPtpInstancePortIndex), /* not reported */
+	FIELD(wrsPtpInstanceTable_s, ASN_UNSIGNED, wrsPtpInstanceOnPortIndex), /* not reported */
 	FIELD(wrsPtpInstanceTable_s, ASN_INTEGER, wrsPtpInstancePort),
+	FIELD(wrsPtpInstanceTable_s, ASN_INTEGER, wrsPtpInstancePortInstance),
 	FIELD(wrsPtpInstanceTable_s, ASN_OCTET_STR, wrsPtpInstancePortName),
 	FIELD(wrsPtpInstanceTable_s, ASN_OCTET_STR, wrsPtpInstanceName),
 	FIELD(wrsPtpInstanceTable_s, ASN_INTEGER, wrsPtpInstanceState),
@@ -41,6 +43,9 @@ time_t wrsPtpInstanceTable_data_fill(unsigned int *n_rows)
 	struct pp_instance *ppsi_i;
 	char *tmp_name;
 	struct hal_port_state *p;
+	int phys_port;
+	int last_port = 0;
+	int instance_on_port = 0;
 
 	/* number of rows does not change for wrsPortStatusTable */
 	if (n_rows)
@@ -84,17 +89,28 @@ time_t wrsPtpInstanceTable_data_fill(unsigned int *n_rows)
 
 			tmp_name = (char *) wrs_shm_follow(ppsi_head,
 					       ppsi_i->port_name);
-			strncpy(i_a[i].wrsPtpInstanceName, tmp_name, 12);
-			i_a[i].wrsPtpInstanceName[11] = '\0';
+			strncpy(i_a[i].wrsPtpInstanceName, tmp_name, 16);
+			i_a[i].wrsPtpInstanceName[15] = '\0';
 
 			tmp_name = (char *) wrs_shm_follow(ppsi_head,
 					       ppsi_i->iface_name);
-			strncpy(i_a[i].wrsPtpInstancePortName, tmp_name, 12);
-			i_a[i].wrsPtpInstancePortName[11] = '\0';
+			strncpy(i_a[i].wrsPtpInstancePortName, tmp_name, 16);
+			i_a[i].wrsPtpInstancePortName[15] = '\0';
 
 			p = pp_wrs_lookup_port(tmp_name);
-			if (p)
-				i_a[i].wrsPtpInstancePort = p->hw_index + 1;
+			if (p) {
+				phys_port = p->hw_index + 1;
+				i_a[i].wrsPtpInstancePort = phys_port;
+				
+				if (last_port == phys_port)
+					instance_on_port++;
+				else
+					instance_on_port = 1;
+				
+				last_port = phys_port;
+			}
+			
+			i_a[i].wrsPtpInstancePortInstance = instance_on_port;
 
 			i_a[i].wrsPtpInstanceState = ppsi_i->state;
 			i_a[i].wrsPtpInstanceStateNext = ppsi_i->next_state;
@@ -127,57 +143,49 @@ time_t wrsPtpInstanceTable_data_fill(unsigned int *n_rows)
  * one for each table */
 static unsigned int t_n_rows; /* template n_rows */
 
-struct coordinates_s {
-    int port;
-    int inst;
-};
-
-
-struct coordinates_s inst_c;
 
 static netsnmp_variable_list *
 table_next_entry(void **loop_context,
-			void **data_context,
-			netsnmp_variable_list *index,
-			netsnmp_iterator_info *data)
+		void **data_context,
+		netsnmp_variable_list *index,
+		netsnmp_iterator_info *data)
 {
-	
-	inst_c.inst++;
-	if (inst_c.inst > 1){
-		inst_c.inst = 0;
-		inst_c.port++;
-	}
-	if (inst_c.port > 5){
-		return NULL;
+	int i = (int)(intptr_t)(*loop_context);
+
+	netsnmp_variable_list *idx = index;
+// 	snmp_log(LOG_ERR, "%s: loop_context %d\n", __func__, i);
+	if (i >= t_n_rows) {
+		return NULL; /* no more */
+		snmp_log(LOG_ERR, "%s: no more\n", __func__);
 	}
-	/* create the line ID from counter number */
-// 	i = (intptr_t)*loop_context;
-// 	if (i >= t_n_rows)
-// 		return NULL; /* no more */
-// 	i++;
-	/* Create the row OID: only the counter index */
-	snmp_set_var_value(index, (u_char *)&inst_c.port, sizeof(inst_c.port));
-	snmp_set_var_value(index->next_variable, (u_char *)&inst_c.inst, sizeof(inst_c.inst));
-
-	/* Set the data context (1..4)
-	 * Cannot be set to 0, because netsnmp_extract_iterator_context returns
-	 * NULL in function wrsPstats_handler when table is over */
-	*data_context = (void *)&inst_c;
-	/* and set the loop context for the next iteration */
-	*loop_context = (void *)&inst_c;
+
+	/* Embed into index part of OID a port number */
+	snmp_set_var_typed_value(idx, ASN_INTEGER,
+            (u_char *)&wrsPtpInstanceTable_array[i].wrsPtpInstancePort,
+            sizeof(uint32_t));
+
+	/* Embed into index part of OID an instance index on port */
+	idx = idx->next_variable;
+	snmp_set_var_typed_value(idx, ASN_INTEGER,
+            (u_char *)&wrsPtpInstanceTable_array[i].wrsPtpInstancePortInstance,
+            sizeof(uint32_t));
+	
+	*data_context = &wrsPtpInstanceTable_array[i];
+	*loop_context = (void *)(intptr_t)(++i);
+
 	return index;
 }
 
 static netsnmp_variable_list *
 table_first_entry(void **loop_context,
-			void **data_context,
-			netsnmp_variable_list *index,
-			netsnmp_iterator_info *data)
+		  void **data_context,
+		  netsnmp_variable_list *index,
+		  netsnmp_iterator_info *data)
 {
-	inst_c.port = 0;
-	inst_c.inst = 0;
+	*loop_context = 0;
+	*data_context = 0;
+// 	snmp_log(LOG_ERR, "%s\n", __func__);
 	/* reset internal position, so "next" is "first" */
-	*loop_context = &inst_c; /* first counter */
 	return table_next_entry(loop_context, data_context, index, data);
 }
 
@@ -190,13 +198,15 @@ table_handler(netsnmp_mib_handler          *handler,
 	netsnmp_request_info  *request;
 	netsnmp_variable_list *requestvb;
 	netsnmp_table_request_info *table_info;
+	struct wrsPtpInstanceTable_s *entry;
 
 	struct pickinfo *pi;
-	int row, subid;
+	int subid;
 	int len;
 	void *ptr;
 	struct counter64 tmp_counter64;
 
+// 	snmp_log(LOG_ERR, "%s: before mode check\n", __func__);
 	switch (reqinfo->mode) {
 	case MODE_GET:
 		/* "break;" so read code is not indented too much */
@@ -219,24 +229,23 @@ table_handler(netsnmp_mib_handler          *handler,
 
 
 	for (request = requests; request; request = request->next) {
-		struct coordinates_s *xxx;
 		requestvb = request->requestvb;
 
 		/* "context" is the row number */
-		xxx = (struct coordinates_s*)netsnmp_extract_iterator_context(request);
-		if (!xxx)
+		entry = (struct wrsPtpInstanceTable_s *)netsnmp_extract_iterator_context(request);
+                if (!entry) {
 			/* NULL returned from
-				 * netsnmp_extract_iterator_context shuld be
-				 * interpreted as end of table */
-			break;
-		/* change range of row (1..X (snmp is 1 based) ->
-			 * 0..X (wrs_t_table_array/data array is 0 based)) */
-		row = 5;
+			 * netsnmp_extract_iterator_context shuld be
+			 * interpreted as end of table */
+			continue;
+		}
+		
 		table_info = netsnmp_extract_table_info(request);
 		subid = table_info->colnum - 1;
+// 		snmp_log(LOG_ERR, "%s: %d\n", __func__, subid);
 
 		pi = wrsPtpInstanceTable_pickinfo + subid;
-		ptr = (void *)(wrsPtpInstanceTable_array + row) + pi->offset;
+		ptr = (void *)(entry) + pi->offset;
 		/* snmp_set_var_typed_value function does not support counter64
 		 * as a uint64_t, but as a struct counter64. Their binary
 		 * representation differs by order of 32bit words. We fill
diff --git a/userspace/snmpd/wrsPtpInstanceTable.h b/userspace/snmpd/wrsPtpInstanceTable.h
index f8f24749797ca5740ef554d9da34b472f990cb00..92cd920fa6133e57b72e9275c2fae83ad2005655 100644
--- a/userspace/snmpd/wrsPtpInstanceTable.h
+++ b/userspace/snmpd/wrsPtpInstanceTable.h
@@ -6,11 +6,13 @@
 
 
 struct wrsPtpInstanceTable_s {
-	uint32_t wrsPtpInstanceIndex;		/* not reported, index fields has t o be marked
+	uint32_t wrsPtpInstancePortIndex;		/* not reported, index fields has t o be marked
 				 * as not-accessible in MIB */
+	uint32_t wrsPtpInstanceOnPortIndex;	/* port on which ptp instance is running (index+1) */
 	int wrsPtpInstancePort;	/* port on which ptp instance is running (index+1) */
-	char wrsPtpInstancePortName[12];/* port name on which ptp instance is running (wriX) */
-	char wrsPtpInstanceName[12];	/* Instance name */
+	int wrsPtpInstancePortInstance; /* serial of instance running on a given port  */
+	char wrsPtpInstancePortName[16];/* port name on which ptp instance is running (wriX) */
+	char wrsPtpInstanceName[16];	/* Instance name */
 	int wrsPtpInstanceState;
 	int wrsPtpInstanceStateNext;
 	int wrsPtpInstanceRole;