VOL-2273: Check o_pbits value before set it to classifier.
Change-Id: Ifd0974a0fc462e5d0204d7ef732aa11f78ab5e0e
diff --git a/agent/src/core.cc b/agent/src/core.cc
index 10d6c42..5053cd3 100644
--- a/agent/src/core.cc
+++ b/agent/src/core.cc
@@ -2107,12 +2107,28 @@
single_tag = true;
OPENOLT_LOG(DEBUG, openolt_log_id, "classify o_pbits 0x%x\n", classifier.o_pbits());
- BCMOLT_FIELD_SET(&c_val, classifier, o_pbits, classifier.o_pbits());
+ if(classifier.o_pbits()){
+ //According to makeOpenOltClassifierField in voltha-openolt-adapter, o_pbits 0xFF means PCP value 0.
+ //0 vlaue of o_pbits means o_pbits is not available
+ if(0xFF == classifier.o_pbits()){
+ BCMOLT_FIELD_SET(&c_val, classifier, o_pbits, 0);
+ }
+ else{
+ BCMOLT_FIELD_SET(&c_val, classifier, o_pbits, classifier.o_pbits());
+ }
+ }
} else if (classifier.pkt_tag_type().compare("double_tag") == 0) {
BCMOLT_FIELD_SET(&c_val, classifier, pkt_tag_type, BCMOLT_PKT_TAG_TYPE_DOUBLE_TAG);
OPENOLT_LOG(DEBUG, openolt_log_id, "classify o_pbits 0x%x\n", classifier.o_pbits());
- BCMOLT_FIELD_SET(&c_val, classifier, o_pbits, classifier.o_pbits());
+ if(classifier.o_pbits()){
+ if(0xFF == classifier.o_pbits()){
+ BCMOLT_FIELD_SET(&c_val, classifier, o_pbits, 0);
+ }
+ else{
+ BCMOLT_FIELD_SET(&c_val, classifier, o_pbits, classifier.o_pbits());
+ }
+ }
}
}
}