summaryrefslogtreecommitdiff
path: root/drivers/net/npe/IxEthDBVlan.c
blob: 522a30b1ddb6fb7c3c87930617f769d65edaae3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
/**
 * @file IxEthDBVlan.c
 *
 * @brief Implementation of the VLAN API
 * 
 * @par
 * IXP400 SW Release version 2.0
 * 
 * -- Copyright Notice --
 * 
 * @par
 * Copyright 2001-2005, Intel Corporation.
 * All rights reserved.
 * 
 * @par
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Intel Corporation nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 * 
 * @par
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * @par
 * -- End of Copyright Notice --
 */

#include "IxEthDB.h"
#include "IxEthDB_p.h"

/* forward prototypes */
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex);
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBVlanTableGet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet);

/* contants used by various functions as "action" parameter */
#define ADD_VLAN    (0x1)
#define REMOVE_VLAN (0x2)

/**
 * @brief adds or removes a VLAN from a VLAN set
 *
 * @param vlanID VLAN ID to add or remove
 * @param table VLAN set to add into or remove from
 * @param action ADD_VLAN or REMOVE_VLAN
 * 
 * @internal
 */
IX_ETH_DB_PRIVATE
void ixEthDBLocalVlanMembershipChange(UINT32 vlanID, IxEthDBVlanSet table, UINT32 action)
{
    UINT32 setOffset;
    
    /* add/remove VID to membership table */
    setOffset = VLAN_SET_OFFSET(vlanID); /* we need 9 bits to index the 512 byte membership array */

    if (action == ADD_VLAN)
    {
        table[setOffset] |= 1 << VLAN_SET_MASK(vlanID);
    }
    else if (action == REMOVE_VLAN)
    {
        table[setOffset] &= ~(1 << VLAN_SET_MASK(vlanID));
    }
}

/**
 * @brief updates a set of 8 VLANs in an NPE
 *
 * @param portID ID of the port
 * @param setOffset offset of the 8 VLANs
 *
 * This function updates the VLAN membership table
 * and Transmit Tagging Info table for 8 consecutive
 * VLAN IDs indexed by setOffset.
 *
 * For example, a setOffset of 0 indexes VLAN IDs 0
 * through 7, 1 indexes VLAN IDs 8 through 9 etc.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed
 * successfully or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PRIVATE
IxEthDBStatus ixEthDBVlanTableEntryUpdate(IxEthDBPortId portID, UINT32 setOffset)
{
    PortInfo *portInfo = &ixEthDBPortInfo[portID];
    IxNpeMhMessage message;
    IX_STATUS result;
        
    FILL_SETPORTVLANTABLEENTRY_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), 
        2 * setOffset, 
        portInfo->vlanMembership[setOffset], 
        portInfo->transmitTaggingInfo[setOffset]);
    
    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
    
    return result;
}

/**
 * @brief updates a VLAN range in an NPE
 *
 * @param portID ID of the port
 *
 * This function is similar to @ref ixEthDBVlanTableEntryUpdate
 * except that it can update more than one VLAN set (up to
 * the entire VLAN membership and TTI tables if the offset is 0
 * and length is sizeof (IxEthDBVlanSet) (512 bytes).
 *
 * Updating the NPE via this method is slower as it requires
 * a memory copy from SDRAM, hence it is recommended that the
 * ixEthDBVlanTableEntryUpdate function is used where possible.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed
 * successfully or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PRIVATE
IxEthDBStatus ixEthDBVlanTableRangeUpdate(IxEthDBPortId portID)
{
    PortInfo *portInfo    = &ixEthDBPortInfo[portID];
    UINT8 *vlanUpdateZone = (UINT8 *) portInfo->updateMethod.vlanUpdateZone;
    IxNpeMhMessage message;
    UINT32 setIndex;
    IX_STATUS result;

    /* copy membership info and transmit tagging into into exchange area */
    for (setIndex = 0 ; setIndex < sizeof (portInfo->vlanMembership) ; setIndex++)
    {
        /* membership and TTI data are interleaved */
        vlanUpdateZone[setIndex * 2]     = portInfo->vlanMembership[setIndex];
        vlanUpdateZone[setIndex * 2 + 1] = portInfo->transmitTaggingInfo[setIndex];
    }

    IX_OSAL_CACHE_FLUSH(vlanUpdateZone, FULL_VLAN_BYTE_SIZE);
    
    /* build NPE message */
    FILL_SETPORTVLANTABLERANGE_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), 0, 0, 
        IX_OSAL_MMU_VIRT_TO_PHYS(vlanUpdateZone));

    /* send message */    
    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);

    return result;
}

/**
 * @brief adds or removes a VLAN from a port's VLAN membership table
 * or Transmit Tagging Information table
 *
 * @param portID ID of the port
 * @param vlanID VLAN ID to add or remove
 * @param table to add or remove from
 * @param action ADD_VLAN or REMOVE_VLAN
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed
 * successfully or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PRIVATE
IxEthDBStatus ixEthDBPortVlanMembershipChange(IxEthDBPortId portID, IxEthDBVlanId vlanID, IxEthDBVlanSet table, UINT32 action)
{
    /* change VLAN in local membership table */
    ixEthDBLocalVlanMembershipChange(vlanID, table, action);
    
    /* send updated entry to NPE */
    return ixEthDBVlanTableEntryUpdate(portID, VLAN_SET_OFFSET(vlanID));
}

/**
 * @brief sets the default port VLAN tag (the lower 3 bytes are the PVID)
 *
 * @param portID ID of the port
 * @param vlanTag port VLAN tag (802.1Q tag)
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanTagSet(IxEthDBPortId portID, IxEthDBVlanTag vlanTag)
{
    IxNpeMhMessage message;
    IX_STATUS result;
    
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
 
    IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
        
    /* add VLAN ID to local membership table */
    ixEthDBPortVlanMembershipChange(portID, 
        vlanTag & IX_ETH_DB_802_1Q_VLAN_MASK, 
        ixEthDBPortInfo[portID].vlanMembership, 
        ADD_VLAN);
        
    /* set tag in portInfo */
    ixEthDBPortInfo[portID].vlanTag = vlanTag;
    
    /* build VLAN_SetDefaultRxVID message */
    FILL_SETDEFAULTRXVID_MSG(message, 
        IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), 
        IX_IEEE802_1Q_VLAN_TPID, 
        vlanTag);
    
    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
    
    return result;
}

/**
 * @brief retrieves the default port VLAN tag (the lower 3 bytes are the PVID)
 *
 * @param portID ID of the port
 * @param vlanTag address to write the port VLAN tag (802.1Q tag) into
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(vlanTag);
    
    *vlanTag = ixEthDBPortInfo[portID].vlanTag;
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief sets the VLAN tag (the lower 3 bytes are the PVID) of a 
 * database filtering record
 *
 * @param portID ID of the port
 * @param vlanTag VLAN tag (802.1Q tag)
 * 
 * Important: filtering records are automatically converted to 
 * IX_ETH_DB_FILTERING_VLAN record when added a VLAN tag.
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag)
{
    HashNode *searchResult;
    MacDescriptor *descriptor;
    
    IX_ETH_DB_CHECK_REFERENCE(macAddr);
    
    IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
    
    searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
    
    if (searchResult == NULL)
    {
        return IX_ETH_DB_NO_SUCH_ADDR;
    }
    
    descriptor = (MacDescriptor *) searchResult->data;
    
    /* set record type to VLAN if not already set */
    descriptor->type = IX_ETH_DB_FILTERING_VLAN_RECORD;
    
    /* add vlan tag */
    descriptor->recordData.filteringVlanData.ieee802_1qTag = vlanTag;
    
    /* transaction completed */
    ixEthDBReleaseHashNode(searchResult);
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief retrieves the VLAN tag (the lower 3 bytes are the PVID) from a 
 * database VLAN filtering record
 *
 * @param portID ID of the port
 * @param vlanTag address to write the VLAN tag (802.1Q tag) into
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag)
{
    HashNode *searchResult;
    MacDescriptor *descriptor;
    
    IX_ETH_DB_CHECK_REFERENCE(macAddr);
    
    IX_ETH_DB_CHECK_REFERENCE(vlanTag);
    
    searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_FILTERING_VLAN_RECORD);
    
    if (searchResult == NULL)
    {
        return IX_ETH_DB_NO_SUCH_ADDR;
    }
    
    descriptor = (MacDescriptor *) searchResult->data;
        
    /* get vlan tag */
    *vlanTag = descriptor->recordData.filteringVlanData.ieee802_1qTag;
    
    /* transaction completed */
    ixEthDBReleaseHashNode(searchResult);
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief adds a VLAN to a port's VLAN membership table
 *
 * @param portID ID of the port
 * @param vlanID VLAN ID to add
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID)
{
    IX_ETH_DB_CHECK_PORT(portID);

    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    IX_ETH_DB_CHECK_VLAN_ID(vlanID);

    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);

    return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
}

/**
 * @brief removes a VLAN from a port's VLAN membership table
 *
 * @param portID ID of the port
 * @param vlanID VLAN ID to remove
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanMembershipRemove(IxEthDBPortId portID, IxEthDBVlanId vlanID)
{
    IX_ETH_DB_CHECK_PORT(portID);

    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);

    IX_ETH_DB_CHECK_VLAN_ID(vlanID);

    /* for safety isolate only the VLAN ID in the tag (the lower 12 bits) */
    vlanID = vlanID & IX_ETH_DB_802_1Q_VLAN_MASK;
    
    /* check we're not asked to remove the default port VID */
    if (vlanID == IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag))
    {
        return IX_ETH_DB_NO_PERMISSION;
    }
    
    return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, REMOVE_VLAN);
}

/**
 * @brief adds or removes a VLAN range from a port's 
 * VLAN membership table or TTI table
 *
 * @param portID ID of the port
 * @param vlanIDMin start of the VLAN range
 * @param vlanIDMax end of the VLAN range
 * @param table VLAN set to add or remove from
 * @param action ADD_VLAN or REMOVE_VLAN
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PRIVATE
IxEthDBStatus ixEthDBPortVlanMembershipRangeChange(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, IxEthDBVlanSet table, UINT32 action)
{
    UINT32 setOffsetMin, setOffsetMax;
    
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_VLAN_ID(vlanIDMin);
    
    IX_ETH_DB_CHECK_VLAN_ID(vlanIDMax);
    
    /* for safety isolate only the VLAN ID in the tags (the lower 12 bits) */
    vlanIDMin = vlanIDMin & IX_ETH_DB_802_1Q_VLAN_MASK;
    vlanIDMax = vlanIDMax & IX_ETH_DB_802_1Q_VLAN_MASK;
    
    /* is this a range? */
    if (vlanIDMax < vlanIDMin)
    {
        return IX_ETH_DB_INVALID_VLAN;
    }
    
    /* check that we're not specifically asked to remove the default port VID */
    if (action == REMOVE_VLAN && vlanIDMax == vlanIDMin && IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag) == vlanIDMin)
    {
        return IX_ETH_DB_NO_PERMISSION;
    }
    
    /* compute set offsets */
    setOffsetMin = VLAN_SET_OFFSET(vlanIDMin);
    setOffsetMax = VLAN_SET_OFFSET(vlanIDMax);

    /* change VLAN range */
    for (; vlanIDMin <= vlanIDMax ; vlanIDMin++)
    {
        /* change vlan in local membership table */
        ixEthDBLocalVlanMembershipChange(vlanIDMin, table, action);
    }

    /* if the range is within one set (max 8 VLANs in one table byte) we can just update that entry in the NPE */
    if (setOffsetMin == setOffsetMax)
    {
        /* send updated entry to NPE */
        return ixEthDBVlanTableEntryUpdate(portID, setOffsetMin);
    }
    else
    {
        /* update a zone of the membership/transmit tag info table */
        return ixEthDBVlanTableRangeUpdate(portID);
    }
}

/**
 * @brief adds a VLAN range to a port's VLAN membership table
 *
 * @param portID ID of the port
 * @param vlanIDMin start of the VLAN range
 * @param vlanIDMax end of the VLAN range
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
{
    IX_ETH_DB_CHECK_PORT(portID);

    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
}

/**
 * @brief removes a VLAN range from a port's VLAN membership table
 *
 * @param portID ID of the port
 * @param vlanIDMin start of the VLAN range
 * @param vlanIDMax end of the VLAN range
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanMembershipRangeRemove(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
{
    IX_ETH_DB_CHECK_PORT(portID);

    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, REMOVE_VLAN);
}

/**
 * @brief sets a port's VLAN membership table or TTI table and
 * updates the NPE VLAN configuration
 *
 * @param portID ID of the port
 * @param portVlanTable port VLAN table to set
 * @param vlanSet new set contents
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBPortVlanTableSet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(vlanSet);

    memcpy(portVlanTable, vlanSet, sizeof (IxEthDBVlanSet));
    
    return ixEthDBVlanTableRangeUpdate(portID);
}

/**
 * @brief retireves a port's VLAN membership table or TTI table
 *
 * @param portID ID of the port
 * @param portVlanTable port VLAN table to retrieve
 * @param vlanSet address to 
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBVlanTableGet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(vlanSet);
    
    memcpy(vlanSet, portVlanTable, sizeof (IxEthDBVlanSet));
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief sets a port's VLAN membership table
 *
 * @param portID ID of the port
 * @param vlanSet new VLAN membership table
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanMembershipSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
{
    IxEthDBVlanId vlanID;

    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    IX_ETH_DB_CHECK_REFERENCE(vlanSet);

    /* set the bit corresponding to the PVID just in case */
    vlanID = IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag);
    vlanSet[VLAN_SET_OFFSET(vlanID)] |= 1 << VLAN_SET_MASK(vlanID);
    
    return ixEthDBPortVlanTableSet(portID, ixEthDBPortInfo[portID].vlanMembership, vlanSet);
}

/**
 * @brief retrieves a port's VLAN membership table
 *
 * @param portID ID of the port
 * @param vlanSet location to store the port's VLAN membership table
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPortVlanMembershipGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].vlanMembership, vlanSet);
}

/**
 * @brief enables or disables Egress tagging for one VLAN ID
 *
 * @param portID ID of the port
 * @param vlanID VLAN ID to enable or disable Egress tagging on
 * @param enabled true to enable and false to disable tagging
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    IX_ETH_DB_CHECK_VLAN_ID(vlanID);

    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);

    return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
}

/**
 * @brief retrieves the Egress tagging status for one VLAN ID
 *
 * @param portID ID of the port
 * @param vlanID VLAN ID to retrieve the tagging status for
 * @param enabled location to store the tagging status
 * (true - tagging enabled, false - tagging disabled)
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(enabled);

    IX_ETH_DB_CHECK_VLAN_ID(vlanID);
    
    *enabled = ((ixEthDBPortInfo[portID].transmitTaggingInfo[VLAN_SET_OFFSET(vlanID)] & (1 << VLAN_SET_MASK(vlanID))) != 0);
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief enables or disables Egress VLAN tagging for a VLAN range
 *
 * @param portID ID of the port
 * @param vlanIDMin start of VLAN range
 * @param vlanIDMax end of VLAN range
 * @param enabled true to enable or false to disable VLAN tagging
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
}

/**
 * @brief sets the Egress VLAN tagging table (the Transmit Tagging
 * Information table)
 *
 * @param portID ID of the port
 * @param vlanSet new TTI table
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBEgressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
{
    IxEthDBVlanId vlanID;

    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    IX_ETH_DB_CHECK_REFERENCE(vlanSet);

    /* set the PVID bit just in case */
    vlanID = IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag);
    vlanSet[VLAN_SET_OFFSET(vlanID)] |= 1 << VLAN_SET_MASK(vlanID);
    
    return ixEthDBPortVlanTableSet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
}

/**
 * @brief retrieves the Egress VLAN tagging table (the Transmit 
 * Tagging Information table)
 *
 * @param portID ID of the port
 * @param vlanSet location to store the port's TTI table
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
}

/**
 * @brief sends the NPE the updated frame filter and default
 * Ingress tagging
 *
 * @param portID ID of the port
 * 
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PRIVATE
IxEthDBStatus ixEthDBIngressVlanModeUpdate(IxEthDBPortId portID)
{
    PortInfo *portInfo = &ixEthDBPortInfo[portID];
    IxNpeMhMessage message;
    IX_STATUS result;

    FILL_SETRXTAGMODE_MSG(message, portID, portInfo->npeFrameFilter, portInfo->npeTaggingAction);
    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);

    return result;
}

/**
 * @brief sets the default Ingress tagging behavior
 *
 * @param portID ID of the port
 * @param taggingAction default tagging behavior
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBIngressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBTaggingAction taggingAction)
{
    PortInfo *portInfo;
    
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    portInfo = &ixEthDBPortInfo[portID];
    
    if (taggingAction == IX_ETH_DB_PASS_THROUGH)
    {
        portInfo->npeTaggingAction = 0x00;
    }
    else if (taggingAction == IX_ETH_DB_ADD_TAG)
    {
        portInfo->npeTaggingAction = 0x02;
    }
    else if (taggingAction == IX_ETH_DB_REMOVE_TAG)
    {
        portInfo->npeTaggingAction = 0x01;
    }
    else
    {
        return IX_ETH_DB_INVALID_ARG;
    }
    
    portInfo->taggingAction = taggingAction;
    
    return ixEthDBIngressVlanModeUpdate(portID);
}

/**
 * @brief retrieves the default Ingress tagging behavior of a port
 *
 * @param portID ID of the port
 * @param taggingAction location to save the default tagging behavior
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBIngressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBTaggingAction *taggingAction)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);

    IX_ETH_DB_CHECK_REFERENCE(taggingAction);
    
    *taggingAction = ixEthDBPortInfo[portID].taggingAction;
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief sets the Ingress acceptable frame type filter
 *
 * @param portID ID of the port
 * @param frameFilter acceptable frame type filter
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBAcceptableFrameTypeSet(IxEthDBPortId portID, IxEthDBFrameFilter frameFilter)
{
    PortInfo *portInfo;
    IxEthDBStatus result = IX_ETH_DB_SUCCESS;
        
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    /* check parameter range 
       the ORed value of the valid values is 0x7
       a value having extra bits is invalid */
    if ((frameFilter | 0x7) != 0x7 || frameFilter == 0)
    {
        return IX_ETH_DB_INVALID_ARG;
    }
    
    portInfo = &ixEthDBPortInfo[portID];
    
    portInfo->frameFilter    = frameFilter;
    portInfo->npeFrameFilter = 0; /* allow all by default */
    
    /* if accepting priority tagged but not all VLAN tagged
       set the membership table to contain only VLAN ID 0 
       hence remove vlans 1-4094 and add VLAN ID 0 */
    if (((frameFilter & IX_ETH_DB_PRIORITY_TAGGED_FRAMES) != 0)
        && ((frameFilter & IX_ETH_DB_VLAN_TAGGED_FRAMES) == 0))
    {
        result = ixEthDBPortVlanMembershipRangeChange(portID, 
            1, IX_ETH_DB_802_1Q_MAX_VLAN_ID, portInfo->vlanMembership, REMOVE_VLAN);

        if (result == IX_ETH_DB_SUCCESS)
        {
            ixEthDBLocalVlanMembershipChange(0, portInfo->vlanMembership, ADD_VLAN);
            result = ixEthDBVlanTableRangeUpdate(portID);
        }
    }
    
    /* untagged only? */
    if (frameFilter == IX_ETH_DB_UNTAGGED_FRAMES)
    {
        portInfo->npeFrameFilter = 0x01;
    }
    
    /* tagged only? */
    if ((frameFilter & IX_ETH_DB_UNTAGGED_FRAMES) == 0)
    {
        portInfo->npeFrameFilter = 0x02;
    }

    if (result == IX_ETH_DB_SUCCESS)
    {
        result = ixEthDBIngressVlanModeUpdate(portID);
    }

    return result;
}

/**
 * @brief retrieves the acceptable frame type filter for a port
 *
 * @param portID ID of the port
 * @param frameFilter location to store the frame filter
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(frameFilter);
    
    *frameFilter = ixEthDBPortInfo[portID].frameFilter;
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief sends an NPE the updated configuration related
 * to one QoS priority (associated traffic class and AQM mapping)
 *
 * @param portID ID of the port
 * @param classIndex QoS priority (traffic class index)
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 *
 * @internal
 */
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex)
{
    IxNpeMhMessage message;
    IX_STATUS result;

    UINT32 trafficClass = ixEthDBPortInfo[portID].priorityTable[classIndex];
    UINT32 aqmQueue     = ixEthDBPortInfo[portID].ixEthDBTrafficClassAQMAssignments[trafficClass];
    
    FILL_SETRXQOSENTRY(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), classIndex, trafficClass, aqmQueue);
    
    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
    
    return result;
}

/**
 * @brief sets the priority mapping table
 *
 * @param portID ID of the port
 * @param priorityTable new priority mapping table
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPriorityMappingTableSet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
{
    UINT32 classIndex;
    
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(priorityTable);
           
    for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)
    {
        /* check range */
        if (priorityTable[classIndex] >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
        {
            return IX_ETH_DB_INVALID_PRIORITY;
        }
    }
    
    /* set new traffic classes */
    for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)
    {
        ixEthDBPortInfo[portID].priorityTable[classIndex] = priorityTable[classIndex];
        
        if (ixEthDBUpdateTrafficClass(portID, classIndex) != IX_ETH_DB_SUCCESS)
        {
            return IX_ETH_DB_FAIL;
        }
    }
    
    return IX_ETH_DB_SUCCESS;
 }

/**
 * @brief retrieves a port's priority mapping table
 *
 * @param portID ID of the port
 * @param priorityTable location to store the priority table
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPriorityMappingTableGet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(priorityTable);
    
    memcpy(priorityTable, ixEthDBPortInfo[portID].priorityTable, sizeof (IxEthDBPriorityTable));
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief sets one QoS priority => traffic class mapping
 *
 * @param portID ID of the port
 * @param userPriority QoS (user) priority
 * @param trafficClass associated traffic class
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);

    /* check ranges for userPriority and trafficClass */
    if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT || trafficClass >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
    {
        return IX_ETH_DB_INVALID_PRIORITY;
    }
    
    ixEthDBPortInfo[portID].priorityTable[userPriority] = trafficClass;
    
    return ixEthDBUpdateTrafficClass(portID, userPriority);
}

/**
 * @brief retrieves one QoS priority => traffic class mapping
 *
 * @param portID ID of the port
 * @param userPriority QoS (user) priority
 * @param trafficClass location to store the associated traffic class
 * 
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBPriorityMappingClassGet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority *trafficClass)
{
    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
    
    IX_ETH_DB_CHECK_REFERENCE(trafficClass);
    
    /* check userPriority range */
    if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT)
    {
        return IX_ETH_DB_INVALID_PRIORITY;
    }
    
    *trafficClass = ixEthDBPortInfo[portID].priorityTable[userPriority];
    
    return IX_ETH_DB_SUCCESS;
}

/**
 * @brief enables or disables the source port extraction
 * from the VLAN TPID field
 *
 * @param portID ID of the port
 * @param enable true to enable or false to disable
 *
 * Note that this function is documented in the main component
 * header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation completed successfully
 * or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBVlanPortExtractionEnable(IxEthDBPortId portID, BOOL enable)
{
    IxNpeMhMessage message;
    IX_STATUS result;

    IX_ETH_DB_CHECK_PORT(portID);
    
    IX_ETH_DB_CHECK_SINGLE_NPE(portID);
    
    IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);

    FILL_SETPORTIDEXTRACTIONMODE(message, portID, enable);

    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
    
    return result;
}