Files @ d6b9b2ac5869
Branch filter:

Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public-bincomp/vmkernel64/release/vds/vmkapi_vds_port.h

unknown
ESXi-5.5-U2
   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
/***********************************************************
 * Copyright 2008 - 2011 VMware, Inc.  All rights reserved.
 ***********************************************************/

/*
 * @VMKAPIMOD_LICENSE@
 */

/*
 ***********************************************************************
 * Port                                                           */ /**
 * \addtogroup VDS
 * @{
 * \defgroup Portset Port APIs
 *
 * The ports on virtual switch provide logical connection points
 * among virtual devices and between virtual and physical devices.
 *
 * In vSphere platform, virtual switch implementation manages ports
 * connected to virtual ethernet adapters in guest OSes (vNICs),
 * virtual device in vmkernel (vmknic), physical adapters (uplinks),
 * and internal ports (i.e. switch management port).
 *
 * Uplink ports are ports associated with physical adapters, providing
 * a connection between a virtual network and a physical network.
 * Physical adapters connect to uplink ports when they are initialized
 * by a device driver or when the teaming policies for virtual switches
 * are reconfigured. Vmkernel and physical adapters provide additional
 * features on uplink ports, e.g. netqueue load balancer, IO resource
 * management, hardware offloading.
 *
 * With vmk_SwitchPortID, switch implementation can call port APIs to
 * control states and operations of ports, including uplinks.
 *
 * @{
 ***********************************************************************
 */

#ifndef _VMKAPI_VDS_PORT_H_
#define _VMKAPI_VDS_PORT_H_

/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */

#include "net/vmkapi_net_uplink.h"
#include "net/vmkapi_net_vlan.h"
#include "vds/vmkapi_vds_prop.h"
#include "vds/vmkapi_vds_portset.h"

/**
 * \brief Possible capabilities for the device associated to an port.
 */

typedef enum {
   /** Scatter-gather */
   VMK_PORT_CLIENT_CAP_SG                =        0x1,

   /** Checksum offloading */
   VMK_PORT_CLIENT_CAP_IP4_CSUM          =        0x2,
   
   /** High dma */
   VMK_PORT_CLIENT_CAP_HIGH_DMA          =        0x8,

   /** TCP Segmentation Offload */
   VMK_PORT_CLIENT_CAP_TSO               =       0x20,   

   /** VLAN tagging offloading on tx path */
   VMK_PORT_CLIENT_CAP_HW_TX_VLAN        =      0x100,
   
   /** VLAN tagging offloading on rx path */
   VMK_PORT_CLIENT_CAP_HW_RX_VLAN        =      0x200,
   
   /** Scatter-gather span multiple pages */
   VMK_PORT_CLIENT_CAP_SG_SPAN_PAGES     =    0x40000,

   /** checksum IPv6 **/
   VMK_PORT_CLIENT_CAP_IP6_CSUM          =    0x80000,

   /** TSO for IPv6 **/
   VMK_PORT_CLIENT_CAP_TSO6              =   0x100000,

   /** TSO size up to 256kB **/
   VMK_PORT_CLIENT_CAP_TSO256k           =   0x200000,

   /** Uniform Passthru, only configurable by uplink device if supported.
       Uplink port shall not explicitly activate/de-activate it */
   VMK_PORT_CLIENT_CAP_UPT               =   0x400000,

   /** Port client modifies the inet headers for any reason */
   VMK_PORT_CLIENT_CAP_RDONLY_INETHDRS   =   0x800000,

   /** Encapsulated Packet Offload (eg. vxlan offload) */
   VMK_PORT_CLIENT_CAP_ENCAP              =  0x1000000,

   /**
    * Data Center Bridging, only configurable by uplink port client if
    * supported. Uplink port shall not explicitly activate/de-activate it
    */
   VMK_PORT_CLIENT_CAP_DCB               =  0x2000000,

   /** TSO/Csum Offloads can be "offset" with an 8 bit value */
   VMK_PORT_CLIENT_CAP_OFFLOAD_8OFFSET   =  0x4000000,

   /** TSO/Csum Offloads can be "offset" with a 16 bit value */
   VMK_PORT_CLIENT_CAP_OFFLOAD_16OFFSET  =  0x8000000,

   /** CSUM for IPV6 with extension headers */
   VMK_PORT_CLIENT_CAP_IP6_CSUM_EXT_HDRS = 0x10000000,

   /** TSO for IPV6 with extension headers */
   VMK_PORT_CLIENT_CAP_TSO6_EXT_HDRS     = 0x20000000,

   /** Network scheduling capable which basically means
       capable of interrupt steering and interrupt coalescing control. */
   VMK_PORT_CLIENT_CAP_SCHED             = 0x40000000,

   /** Single-Root I/O Virtulaization */
   VMK_PORT_CLIENT_CAP_SRIOV             = 0x80000000,

   /** Offload L3/L4 header alignment */
   VMK_PORT_CLIENT_CAP_OFFLOAD_ALIGN_ANY = 0x1000000000000,

   /**
    * Generic hardware offload (eg. vxlan encapsulation offload and offset
    * based offload)
    */
   VMK_PORT_CLIENT_CAP_GENERIC_OFFLOAD   = 0x2000000000000,
} vmk_PortClientCaps;


/**
 * \brief State of the device associated to a port.
 */

typedef vmk_uint64 vmk_PortClientStates;

typedef enum {

   /** The device associated to a port is present */
   VMK_PORT_CLIENT_STATE_PRESENT     = 0x1,

   /** The device associated to a port is ready */
   VMK_PORT_CLIENT_STATE_READY       = 0x2,

   /** The device associated to a port is running */
   VMK_PORT_CLIENT_STATE_RUNNING     = 0x4,

   /** The device's queue associated to a port is operational */
   VMK_PORT_CLIENT_STATE_QUEUE_OK    = 0x8,

   /** The device associated to a port is linked */
   VMK_PORT_CLIENT_STATE_LINK_OK     = 0x10,

   /** The device associated to a port is in promiscious mode */
   VMK_PORT_CLIENT_STATE_PROMISC     = 0x20,

   /** The device associated to a port supports broadcast packets */
   VMK_PORT_CLIENT_STATE_BROADCAST   = 0x40,
   
   /** The device associated to a port supports multicast packets */
   VMK_PORT_CLIENT_STATE_MULTICAST   = 0x80
} vmk_PortClientState;

/**
 * \brief Event ids of port events
 */
typedef enum vmk_PortEvent {

   /** None */
    VMK_PORT_EVENT_NONE = 0,

   /** MAC address of a port changes  */
    VMK_PORT_EVENT_MAC_CHANGE = 1,

   /** VLAN ID of a port changes  */
    VMK_PORT_EVENT_VLAN_CHANGE = 2,

   /** MTU of a port changes  */
    VMK_PORT_EVENT_MTU_CHANGE = 3,

   /**
    * An Opaque port property has changed.
    *
    * Opaque property is partner defined port property defined in partner
    * solution. For defining opaque port properties, see
    * vmk_VDSClientPortRegister function documentation.
    */
   VMK_PORT_EVENT_OPAQUE_CHANGE = 4,

} vmk_PortEvent;


/**
 * \brief Structure containing statistics of the device associated to a port.
 */

typedef struct vmk_PortClientStats{

   /** The number of rx packets received by the driver */
   vmk_uint64 rxPkt;

   /** The number of tx packets sent by the driver */
   vmk_uint64 txPkt;

   /** The number of rx bytes by the driver */
   vmk_ByteCount rxBytes;

   /** The number of tx bytes by the driver */
   vmk_ByteCount txBytes;

   /** The number of rx packets with errors */
   vmk_uint64 rxErr;

   /** The number of tx packets with errors */
   vmk_uint64 txErr;

   /** The number of rx packets dropped */
   vmk_uint64 rxDrp;

   /** The number of tx packets dropped */
   vmk_uint64 txDrp;

   /** The number of rx multicast packets */
   vmk_uint64 mltCast;

   /** The number of collisions */
   vmk_uint64 col;

   /** The number of rx length errors */
   vmk_uint64 rxLgtErr;

   /** The number of rx ring buffer overflow */
   vmk_uint64 rxOvErr;

   /** The number of rx packets with crc errors */
   vmk_uint64 rxCrcErr;

   /** The number of rx packets with frame alignment error */
   vmk_uint64 rxFrmErr;

   /** The number of rx fifo overrun */
   vmk_uint64 rxFifoErr;

   /** The number of rx packets missed */
   vmk_uint64 rxMissErr;

   /** The number of tx aborted errors */
   vmk_uint64 txAbortErr;

   /** The number of tx carriers errors */
   vmk_uint64 txCarErr;

   /** The number of tx fifo errors */
   vmk_uint64 txFifoErr;
   
   /** The number of tx heartbeat errors */
   vmk_uint64 txHeartErr;

   /** The number of tx windows errors */
   vmk_uint64 txWinErr;

   /** The number of rx packets received by the interface hosting the driver */
   vmk_uint64 intRxPkt;

   /** The number of tx packets sent by the interface hosting the driver */
   vmk_uint64 intTxPkt;

   /** The number of rx packets dropped by the interface hosting the driver */
   vmk_uint64 intRxDrp;

   /** The number of tx packets dropped by the interface hosting the driver  */
   vmk_uint64 intTxDrp;

   /**
    * String used to store the information specific the device associated
    * to a port
    */
   char *privateStats;

   /** The length of privateStats in bytes */
   vmk_ByteCount privateStatsLength;
} vmk_PortClientStats;

/*
 ***********************************************************************
 * vmk_PortSetLinkStatus --                                       */ /**
 *
 * \brief Set link status of a switch port.
 *
 * \nativedriversdisallowed
 *
 * The link status includes link state, speed, and duplex.
 *
 * \note As this function will asynchronously call down to the device,
 *       the device state may not have changed yet when this API
 *       returns and vmk_PortGetLinkStatus may return the
 *       non-updated state.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note Link status cannot be set for hidden uplinks.
 *
 * \note This function will not block.
 *
 * \param[in]    portID             Numeric ID of a virtual port
 * \param[in]    linkStatus         Status of the link
 *
 * \retval       VMK_OK             The status was successfully set.
 * \retval       VMK_NOT_FOUND      The device cannot be found or
 *                                  portID is invalid
 * \retval       VMK_NOT_SUPPORTED  The speed/duplex is not supported.
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortSetLinkStatus(vmk_SwitchPortID portID,
                                       vmk_LinkStatus *linkStatus);

/*
 ***********************************************************************
 * vmk_PortGetLinkStatus --                                       */ /**
 *
 * \brief Get link status of a switch port.
 *
 * \nativedriversdisallowed
 *
 * The link status includes link state, speed, and duplex.
 *
 * \see vmk_PortSetLinkStatus().
 *
 * \note A link status change might be pending.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[out]   linkStatus     Status of the link
 *
 * \retval       VMK_OK         The status was successfully retrieved
 * \retval       VMK_NOT_FOUND  The device cannot be found or portID is
 *                              invalid
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetLinkStatus(vmk_SwitchPortID portID,
                                       vmk_LinkStatus *linkStatus);


/*
 ***********************************************************************
 * vmk_PortUpdateDevCap --                                        */ /**
 *
 * \brief Request or release capabilities on a switch port.
 *
 * \nativedriversdisallowed
 *
 * For capabilities that are allowed to be updated, refer to definition
 * of vmk_PortCapability.
 *
 * Some pNIC hardware only support a subset of capabilities. When
 * setting a capability that hardware doesn't support, vmkernel will
 * insert software routine to do the packet processing. 
 *
 * \see vmk_PortCapability().
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[in]    cap            Pointer to new capabilities. Logical
 *                              OR of vmk_PortCapability enum flag
 * \param[out]   resCap         Pointer to result capabilities. Logical
 *                              OR of vmk_PortCapability enum flag
 *
 * \retval       VMK_OK         If capabilities update is successful
 * \retval       VMK_NOT_FOUND  If device cannot be found or portID is
 *                              invalid
 * \retval       VMK_FAILURE    Failed to update device cap
 ***********************************************************************
 */


VMK_ReturnStatus vmk_PortUpdateDevCap(vmk_SwitchPortID portID,
                                      vmk_uint64 cap,
                                      vmk_uint64 *resCap);

/*
 ***********************************************************************
 * vmk_PortQueryDevCap --                                         */ /**
 *
 * \brief Get the enabled software capabilities on a switch port.
 *
 * \nativedriversdisallowed
 *
 * The function returns all capabilities enabled, whether implemented
 * in software or in hardware.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[out]   cap            Pointer to result of capabilities. Logic
 *                              OR of vmk_PortCapability enum flag
 *
 * \retval       VMK_OK         If capability query is successful
 * \retval       VMK_NOT_FOUND  If device cannot be found or portID is
 *                              invalid
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortQueryDevCap(vmk_SwitchPortID portID,
                                     vmk_uint64 *cap);

/*
 ***********************************************************************
 * vmk_PortGetHwCapSupported --                                   */ /**
 *
 * \brief Get hardware capabilities supported.
 *
 * \nativedriversdisallowed
 *
 * Retrieve hardware capabilities supported by the device connected to
 * a switch port.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[out]   cap            Pointer to result of capabilities. Logic
 *                              OR of vmk_PortCapability enum flag
 *
 * \retval       VMK_OK         Get operation successfully finished
 * \retval       VMK_NOT_FOUND  If device is not found or portID is
 *                              invalid
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetHwCapSupported(vmk_SwitchPortID portID,
                                           vmk_uint64 *cap);

/*
 ***********************************************************************
 * vmk_PortUpdateVlan --                                          */ /**
 *
 * \brief Update vlan IDs on the device connected to a switch port.
 *
 * \nativedriversdisallowed
 *
 * This function updates the set of vlan IDs the device will process.
 * The bitmap, if not NULL, marks permitted vlan IDs on the port.
 * Packets with non-permitted vlan IDs may be filtered by device.
 *
 * Caller must perform two steps to configure VLAN:
 * 1) call vmk_PortUpdateDevCap to set hw or sw vlan capability
 * 2) call vmk_PortUpdateVlan to update vlan bitmap
 * If caller does not first set vlan capabilities on port, this function
 * will return VMK_NOT_READY.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note Some hardware devices do not implement vlan filtering on
 *       packet receive. The switch implementation must be prepared to
 *       receive packets with non-permitted vlan IDs.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[in]    bitmap         Permitted vlan IDs. 
 *
 * \retval       VMK_OK         Update successfully finished
 * \retval       VMK_NOT_FOUND  If device is not found or portID is
 *                              invalid
 * \retval       VMK_FAILURE    Failed to set vlan bitmap
 * \retval       VMK_NOT_READY  The port has not configured vlan
 *                              capabilities
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortUpdateVlan(vmk_SwitchPortID portID,
                                    vmk_VLANBitmap *bitmap);


/*
 ***********************************************************************
 * vmk_PortGetStates --                                           */ /**
 *
 * \brief Fetch device state of the port.
 *
 * \nativedriversdisallowed
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must not hold any locks or portset handles.
 *
 * \note This function may block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[out]   states         Logical OR of vmk_UplinkState enum flag 
 *
 * \retval       VMK_OK         Get operation successfully finished
 * \retval       VMK_NOT_FOUND  If device is not found or portID is
 *                              invalid
 * \retval       VMK_FAILURE    Failed to get states
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetStates(vmk_SwitchPortID portID,
                                   vmk_PortClientStates *states);

/*
 ***********************************************************************
 * vmk_PortSetMTU --                                              */ /**
 *
 * \brief Change device MTU size on the port.
 *
 * \nativedriversdisallowed
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must not hold any locks or portset handles.
 *
 * \note For uplink ports, the actual MTU might be set to a higher value
 *       if the requested size is too small.
 *
 * \note This function may block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[in]    mtu            New MTU size 
 *
 * \retval       VMK_OK         Set operation successfully finished
 * \retval       VMK_FAILURE    Set operation failed
 * \retval       VMK_NOT_FOUND  Cannot find device or portID is invalid
 * \retval       VMK_BAD_PARAM  Mtu is bigger than max jumbo frame size
 *                              that vmkernel supports
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortSetMTU(vmk_SwitchPortID portID,
                                vmk_uint32 mtu);

/*
 ***********************************************************************
 * vmk_PortGetMTU --                                              */ /**
 *
 * \brief Get device MTU size on the port.
 *
 * \nativedriversdisallowed
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified uplink.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[in]    mtu            Current device MTU size 
 *
 * \retval       VMK_OK         Get operation successfully finished
 * \retval       VMK_NOT_FOUND  Device cannot be found or portID is
 *                              invalid
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetMTU(vmk_SwitchPortID portID,
                                vmk_uint32 *mtu);


/*
 ***********************************************************************
 * vmk_PortGetDevName --                                          */ /**
 *
 * \brief Get name of the device connected to the switch port.
 *
 * \nativedriversdisallowed
 *
 * \note A buffer of VMK_DEVICE_NAME_MAX_LENGTH or larger ensures that
 *       the name will fit.
 *
 * \note This API currently only supports ports connected to uplinks.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID        Numeric ID of a virtual port
 * \param[out]   devName       Device name string pointer.
 * \param[in]    devNameLen    Size of buffer for device name string
 *                             pointer.
 *
 * \retval       VMK_OK              If device name is successfully
 *                                   retrieved.
 * \retval       VMK_NOT_FOUND       If device is not found or portID
 *                                   is invalid
 * \retval       VMK_LIMIT_EXCEEDED  If device name is too long for
 *                                   provided buffer.
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetDevName(vmk_SwitchPortID portID,
                                    char *devName,
                                    vmk_ByteCount devNameLen);

/*
 ***********************************************************************
 * vmk_PortGetVirtualMACAddr --                                   */ /**
 *
 * \brief Get virtual MAC address of the port.
 *
 * \nativedriversdisallowed
 *
 * \note  This virtual MAC address may differ from device's physical
 *        MAC address.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified portID.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[out]   macAddr        MAC address of device 
 *
 * \retval       VMK_OK         Get operation successfully finished
 * \retval       VMK_NOT_FOUND  Device is not found or portID is invalid
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetVirtualMACAddr(vmk_SwitchPortID portID,
                                           vmk_EthAddress macAddr);

/*
 ***********************************************************************
 * vmk_PortGetDevStats --                                         */ /**
 *
 * \brief Get device statistics on the port.
 *
 * \nativedriversdisallowed
 *
 * The stats on pNICs are maintained by device drivers, and
 * some drivers only update a subset of stats. Therefore, there is no
 * guarantee that all counters returned are non-zero.
 *
 * Caller must initiate privateStats field in stats data structure
 * before calling this function. Caller must not hold portset lock
 * before calling this function.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must not hold any locks or portset handles.
 *
 * \note This function may block.
 *
 * \param[in]    portID         Numeric ID of a virtual port
 * \param[out]   stats          Device stats 
 *
 * \retval       VMK_OK         Successfully get stats 
 * \retval       VMK_NOT_FOUND  Device is not found or portID is invalid
 * \retval       VMK_FAILURE    Failed to get stats 
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortGetDevStats(vmk_SwitchPortID portID,
                                     vmk_PortClientStats *stats);

/*
 ***********************************************************************
 * vmk_PortApplyPortFilter --                                     */ /**
 *
 * \brief Apply a port filter to a port.
 *
 * \nativedriversdisallowed
 *
 * An advertised filter will become part of the rx load balancing
 * algorithm running in the uplink layer. The nominated "top
 * performers" filters will be given one of the populated uplink
 * hardware queues. Such queues are not dedicated to a unique filter
 * in the case that the uplink can handle multiple filters.
 *
 * Note that an advertised filter with VMK_NETQUEUE_FILTER_PROP_MGMT
 * is considered "top performer" by default. This means that such
 * filters should be affiliated to a hardware queue promptly. Though,
 * this is done on a best effort basis according to actual number of
 * populated hardware queues.
 *
 * \note This API currently only supports ports connected to uplinks 
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified uplink.
 *
 * \note This function will not block.
 *
 * \param[in]    portID        Numeric ID of a virtual port.
 * \param[in]    filter        Filter advertised for this port.
 *
 * \retval       VMK_OK        Filter advertised successfully. 
 * \retval       VMK_BAD_PARAM Invalid filter (invalid class, properties).
 * \retval       VMK_FAILURE   Filter has not been applied.
 * \retval       VMK_NOT_FOUND Device cannot be found or portID is
 *                             invalid
 ***********************************************************************
 */

VMK_ReturnStatus vmk_PortApplyPortFilter(vmk_SwitchPortID portID,
                                         vmk_PortFilter *filter);

/*
 ***********************************************************************
 * vmk_PortRemovePortFilter --                                    */ /**
 *
 * \brief Remove a port filter from an port.
 *
 * \nativedriversdisallowed
 *
 * The filter won't be part of the rx load balancing algorithm running in
 * the uplink layer. If a queue was associated to this filter, it will be
 * released for other filters.
 *
 * \note This API currently only supports ports connected to uplinks
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified uplink.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    filter         Filter advertised for this port.
 *
 * \retval       VMK_OK         Filter removed successfully.
 * \retval       VMK_BAD_PARAM  Invalid filter (invalid class, properties).
 * \retval       VMK_NOT_FOUND  Filter not found or portID is invalid or
 *                              device cannot be found
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortRemovePortFilter(vmk_SwitchPortID portID,
                                          vmk_PortFilter *filter);


/*
 ***********************************************************************
 * vmk_PortUpdateDispatchStats --                                 */ /**
 *
 * \brief Update the port's dispatch stats.
 *
 * \nativedriversdisallowed
 *
 * In normal configurations this function need not be called by the vds
 * implementations. This function will be needed in VXLan type of
 * configuration where vmknic port is used for configuration purpose and
 * its mac address is used to do encapsulation.
 *
 * \note The calling thread must hold immutable handle for the portset
 *       associated with the specified VXLAN vmknic port.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    pkt            Pkt which is being processed.
 *
 * \retval  VMK_OK         Successfully updated dispatch stats of port.
 * \retval  VMK_BAD_PARAM  portID refers invalid Port
 * \retval  VMK_NOT_FOUND  portID is invalid
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortUpdateDispatchStats(vmk_SwitchPortID portID,
                                             vmk_PktHandle *pkt);

/*
 ***********************************************************************
 * vmk_PortUpdateDispatchStatsDir --                              */ /**
 *
 * \brief Update the port's dispatch stats.
 *
 * \nativedriversdisallowed
 *
 * This function has similar behavior to vmk_PortUpdateDispatchStats(),
 * but is preferable in cases where the caller knows the Pkt direction
 * because it is more effiecient.
 * In normal configurations this function need not be called by the vds
 * implementations. This function will be needed in VXLan type of
 * configuration where vmknic port is used for configuration purpose and
 * its mac address is used to do encapsulation.
 *
 * \note The calling thread must hold immutable handle for the portset
 *       associated with the specified VXLAN vmknic port.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    pkt            Pkt which is being processed.
 * \param[in]    IsOutbound     Indicate the direction in which Pkt is being
 *                              tranmitted.
 *                              VMK_TRUE  : Pkt being sent to uplink port
 *                              VMK_FALSE : Pkt being sent to backend port
 *
 * \retval  VMK_OK         Successfully updated dispatch stats of port.
 * \retval  VMK_BAD_PARAM  portID refers invalid Port
 * \retval  VMK_NOT_FOUND  portID is invalid
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortUpdateDispatchStatsDir(vmk_SwitchPortID portID,
                                                vmk_PktHandle *pkt,
                                                vmk_Bool IsOutbound);


/*
 ***********************************************************************
 * vmk_PortRequestUplinkFeature --                                */ /**
 *
 * \brief Set port's requested Uplink feature.
 *
 * \nativedriversdisallowed
 *
 * Port's requested uplink feature will be used by load balancer
 * when allocating rx queue. Typically, VDS implmentation will call this
 * API for vmknic ports.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified port.
 *
 * \note This function will not block.
 *
 * \note This function shouldn't be called for uplink ports.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    feature        Feature to be requested.
 *
 * \retval  VMK_OK                          Successfully requested
 *                                          uplink features for port.
 * \retval  VMK_BAD_PARAM                   portID refers invalid Port
 * \retval  VMK_NOT_FOUND                   portID is invalid 
 * \retval  VMK_PORTSET_HANDLE_NOT_MUTABLE  The caller did not hold a
 *                                          mutable handle.
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortRequestUplinkFeature(
   vmk_SwitchPortID portID,
   vmk_PortUplinkFeatures feature);


/*
 ***********************************************************************
 * vmk_PortClearUplinkFeature --                                  */ /**
 *
 * \brief Clear port's requested Uplink feature.
 *
 * \nativedriversdisallowed
 *
 * With this function, port's already requested uplink features can be
 * cleared. After port's uplink feauture is cleared, load balancer will
 * allocate no-feature rx queue when it allocates new rx queue for that
 * port.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified port.
 *
 * \note This function shouldn't be called for uplink ports.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 *
 * \retval  VMK_OK                          Successfully cleared uplink
 *                                          features of port.
 * \retval  VMK_BAD_PARAM                   portID refers invalid Port
 * \retval  VMK_NOT_FOUND                   portID is invalid 
 * \retval  VMK_PORTSET_HANDLE_NOT_MUTABLE  The caller did not hold a
 *                                          mutable handle.
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortClearUplinkFeature(vmk_SwitchPortID portID);


/*
 ***********************************************************************
 * vmk_PortGetUplinkFeature --                                    */ /**
 *
 * \brief Get port's requested Uplink feature.
 *
 * \nativedriversdisallowed
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified port.
 *
 * \note This function shouldn't be called for uplink ports.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    feature        Feature .
 *
 * \retval  VMK_OK                          Successfully got uplink
 *                                          feature of the port.
 * \retval  VMK_BAD_PARAM                   portID refers invalid Port
 * \retval  VMK_NOT_FOUND                   portID is invalid 
 * \retval  VMK_PORTSET_HANDLE_NOT_MUTABLE  The caller did not hold a
 *                                          mutable handle.
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortGetUplinkFeature(
   vmk_SwitchPortID portID,
   vmk_PortUplinkFeatures *feature);


/*
 ***********************************************************************
 * vmk_PortSetHeadroomLen --                                      */ /**
 *
 * \brief Set port's headroon length.
 *
 * \nativedriversdisallowed
 *
 * Packets allocated by port clients will have that much headroom
 * pre-allocated in the packets.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified port.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    headroomLen    Length of headroom requested.
 *
 * \retval  VMK_OK                          Headroom set successfully.
 * \retval  VMK_BAD_PARAM                   portID refers invalid Port
 * \retval  VMK_NOT_FOUND                   portID is invalid 
 * \retval  VMK_PORTSET_HANDLE_NOT_MUTABLE  The caller did not hold a
 *                                          mutable handle.
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortSetHeadroomLen(vmk_SwitchPortID portID,
                                        vmk_uint32 headroomLen);


/*
 ***********************************************************************
 * vmk_PortGetHeadroomLen --                                      */ /**
 *
 * \brief Get port's headroon length.
 *
 * \nativedriversdisallowed
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified port.
 *
 * \note This function will not block.
 *
 * \param[in]    portID         Numeric ID of a virtual port.
 * \param[in]    headroomLen    Length of headroom requested.
 *
 * \retval  VMK_OK                          Successfully got headroom
 *                                          length configured for port.
 * \retval  VMK_BAD_PARAM                   portID refers invalid Port
 * \retval  VMK_NOT_FOUND                   portID is invalid 
 * \retval  VMK_PORTSET_HANDLE_NOT_MUTABLE  The caller did not hold a
 *                                          mutable handle.
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortGetHeadroomLen(vmk_SwitchPortID portID,
                                        vmk_uint32 *headroomLen);

/*
 ***********************************************************************
 * vmk_PortNotifyChange --                                        */ /**
 *
 * \brief Notify the change of a port property.
 *
 * \nativedriversdisallowed
 *
 * This function generates an event to notify management software that
 * the value of a property has been modified by the switch implementation.
 * It is not required that all runtime property updates need accompanying
 * events, the guidelines to generate events should be -
 * 1) If there is a user visible screen for the property and the management
 *    software does not poll the property value.
 * 2) If there is some reason that the state needs to be persisted right away.
 *
 * For example, the UI already poll for statistics, so there is no reason
 * to send an event every time a statistics value changes.
 *
 * \note The calling thread must hold a mutable handle for the portset
 *       associated with the specified port.
 * 
 * \note This function will not block.
 *
 * \param[in]  portID          Numeric ID of the virtual port
 *
 * \param[in]  eventType       Type of event
 *
 * \retval  VMK_OK                          Event notified successfully.
 * \retval  VMK_NOT_FOUND                   Could not find the port.
 * \retval  VMK_NO_MEMORY                   Could not allocate memory.
 * \retval  VMK_NOT_SUPPORTED               Event type not supported.
 * \retval  VMK_BAD_PARAM                   Portset is not in VDS or
 *                                          port is not associated to
 *                                          DVS
 * \retval  VMK_PORTSET_HANDLE_NOT_MUTABLE  The caller did not hold a
 *                                          mutable handle.
 ***********************************************************************
 */
VMK_ReturnStatus vmk_PortNotifyChange (vmk_SwitchPortID portID,
                                       vmk_uint32 eventType);

#endif
/** @} */
/** @} */