Merge "[qca-ssdk] add pppoe vrfid"
diff --git a/include/fal/fal_misc.h b/include/fal/fal_misc.h
index f15709e..fd91c48 100755
--- a/include/fal/fal_misc.h
+++ b/include/fal/fal_misc.h
@@ -34,6 +34,7 @@
         a_uint32_t session_id;
         a_bool_t   multi_session;
         a_bool_t   uni_session;
+        a_uint32_t vrf_id;
     } fal_pppoe_session_t;
 
     typedef enum
@@ -294,20 +295,20 @@
 	sw_error_t
     fal_global_macaddr_get(a_uint32_t dev_id, fal_mac_addr_t * addr);
 
-	
+
 	sw_error_t
 	fal_lldp_status_set(a_uint32_t dev_id, a_bool_t enable);
-	
-	
-	
+
+
+
 	sw_error_t
 	fal_lldp_status_get(a_uint32_t dev_id, a_bool_t * enable);
 
 	sw_error_t
 	fal_frame_crc_reserve_set(a_uint32_t dev_id, a_bool_t enable);
-	
-	
-	
+
+
+
 	sw_error_t
 	fal_frame_crc_reserve_get(a_uint32_t dev_id, a_bool_t * enable);
 
diff --git a/include/hsl/dess/dess_reg.h b/include/hsl/dess/dess_reg.h
index a4bc01a..4ab1243 100755
--- a/include/hsl/dess/dess_reg.h
+++ b/include/hsl/dess/dess_reg.h
@@ -3436,6 +3436,11 @@
 #define PPPOE_SESSION_E_OFFSET                     0x4
 #define PPPOE_SESSION_NR_E                         16
 
+#define VRF_ID
+#define PPPOE_SESSION_VRF_ID_BOFFSET           18
+#define PPPOE_SESSION_VRF_ID_BLEN              3
+#define PPPOE_SESSION_VRF_ID_FLAG              HSL_RW
+
 #define ENTRY_VALID
 #define PPPOE_SESSION_ENTRY_VALID_BOFFSET          16
 #define PPPOE_SESSION_ENTRY_VALID_BLEN             2
@@ -3447,6 +3452,7 @@
 #define PPPOE_SESSION_SEESION_ID_FLAG              HSL_RW
 
 
+
 #define PPPOE_EDIT
 #define PPPOE_EDIT_OFFSET                       0x02200
 #define PPPOE_EDIT_E_LENGTH                     4
diff --git a/src/hsl/dess/dess_misc.c b/src/hsl/dess/dess_misc.c
index a8634b7..413e4fe 100755
--- a/src/hsl/dess/dess_misc.c
+++ b/src/hsl/dess/dess_misc.c
@@ -754,6 +754,11 @@
         return SW_BAD_PARAM;
     }
 
+    if(session_tbl->vrf_id > FAL_MAX_VRF_ID)
+    {
+        return SW_BAD_PARAM;
+    }
+
     for (i = 0; i < DESS_MAX_PPPOE_SESSION; i++)
     {
         HSL_REG_ENTRY_GET(rv, dev_id, PPPOE_SESSION, i,
@@ -778,18 +783,19 @@
         return SW_NO_RESOURCE;
     }
 
-#if 0
     if (A_TRUE == session_tbl->uni_session)
     {
         SW_SET_REG_BY_FIELD(PPPOE_SESSION, ENTRY_VALID, 2, reg);
     }
     else
-#endif
     {
         SW_SET_REG_BY_FIELD(PPPOE_SESSION, ENTRY_VALID, 1, reg);
     }
+
     SW_SET_REG_BY_FIELD(PPPOE_SESSION, SEESION_ID, session_tbl->session_id,
                         reg);
+    SW_SET_REG_BY_FIELD(PPPOE_SESSION, VRF_ID, session_tbl->vrf_id,
+                        reg);
 
     HSL_REG_ENTRY_SET(rv, dev_id, PPPOE_SESSION, entry_idx,
                       (a_uint8_t *) (&reg), sizeof (a_uint32_t));
@@ -825,6 +831,7 @@
         {
             SW_SET_REG_BY_FIELD(PPPOE_SESSION, ENTRY_VALID, 0, reg);
             SW_SET_REG_BY_FIELD(PPPOE_SESSION, SEESION_ID, 0, reg);
+            SW_SET_REG_BY_FIELD(PPPOE_SESSION, VRF_ID, 0, reg);
             HSL_REG_ENTRY_SET(rv, dev_id, PPPOE_SESSION, i,
                               (a_uint8_t *) (&reg), sizeof (a_uint32_t));
             return rv;
@@ -838,7 +845,7 @@
 _dess_pppoe_session_get(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl)
 {
     sw_error_t rv;
-    a_uint32_t reg, i, valid, id;
+    a_uint32_t reg, i, valid, id, vrf_id;
 
     HSL_DEV_ID_CHECK(dev_id);
 
@@ -855,6 +862,7 @@
 
         SW_GET_FIELD_BY_REG(PPPOE_SESSION, ENTRY_VALID, valid, reg);
         SW_GET_FIELD_BY_REG(PPPOE_SESSION, SEESION_ID, id, reg);
+        SW_GET_FIELD_BY_REG(PPPOE_SESSION, VRF_ID, vrf_id, reg);
 
         if (((1 == valid) || (2 == valid)) && (id == session_tbl->session_id))
         {
@@ -870,6 +878,7 @@
             }
 
             session_tbl->entry_id = i;
+            session_tbl->vrf_id = vrf_id;
             return SW_OK;
         }
     }
@@ -1231,7 +1240,7 @@
 	sw_error_t rv;
     a_uint32_t reg = 0;
 
-	
+
 	HSL_DEV_ID_CHECK(dev_id);
 
 	reg = (addr->uc[4] << 8) | addr->uc[5];
@@ -1248,7 +1257,7 @@
 	sw_error_t rv;
     a_uint32_t reg = 0;
 
-	
+
 	HSL_DEV_ID_CHECK(dev_id);
 	HSL_REG_ENTRY_GET(rv, dev_id, GLOBAL_MAC_ADDR0, 0, (a_uint8_t *) (&reg), sizeof (a_uint32_t));
 	addr->uc[4] = (reg >> 8) & 0xff;
@@ -2258,7 +2267,7 @@
 /**
  * @brief Get global macaddr on particular device.
  * @param[in]  dev_id device id
- * @param[out] addr   addr 
+ * @param[out] addr   addr
  * @return SW_OK or error code
  */
 HSL_LOCAL sw_error_t
diff --git a/src/ref/ref_uci.c b/src/ref/ref_uci.c
index fa4681b..aacdd51 100755
--- a/src/ref/ref_uci.c
+++ b/src/ref/ref_uci.c
@@ -3610,6 +3610,8 @@
 			val_ptr[2] = ext_value_p->option_value;
 		} else if(!strcmp(ext_value_p->option_name, "unicast_seesion")) {
 			val_ptr[3] = ext_value_p->option_value;
+		} else if(!strcmp(ext_value_p->option_name, "vrf_id")) {
+			val_ptr[4] = ext_value_p->option_value;
 		}  else {
 			rv = -1;
 			break;
diff --git a/src/shell_lib/shell_io.c b/src/shell_lib/shell_io.c
index 2173a8b..cad75e7 100755
--- a/src/shell_lib/shell_io.c
+++ b/src/shell_lib/shell_io.c
@@ -2152,6 +2152,13 @@
     if (rv)
         return rv;
 
+    rv = __cmd_data_check_complex("vrf_id", "0",
+                        "usage: the range is 0 -- 7\n",
+                        cmd_data_check_uint32, &entry.vrf_id,
+                        sizeof (a_uint32_t));
+    if (rv)
+        return rv;
+
     *(fal_pppoe_session_t*)val = entry;
     return SW_OK;
 }