-
Notifications
You must be signed in to change notification settings - Fork 735
infiniband soft_RoCE implement #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
64cbd61
add infinibandlayer rxe for pcapp
FlashBarryAllen 9f6016f
add bth definiction
FlashBarryAllen bb61530
Merge branch 'dev' into master
FlashBarryAllen 3a7dfaf
fix C-cast and add override to code
FlashBarryAllen 05333c8
fix pre-commit errors
FlashBarryAllen 008eab7
fix macro and coding style
FlashBarryAllen 86d3a58
IB toString use more efficient style
FlashBarryAllen 5cbc3f9
IB coding style fix
FlashBarryAllen b6f3c04
add documentation of IB
FlashBarryAllen b7a2a74
add IB creation test case
FlashBarryAllen 5d2402e
Merge branch 'dev' into master
FlashBarryAllen 9579f68
fix IB code format
FlashBarryAllen 33308c1
Merge branch 'dev' into master
FlashBarryAllen 342367e
doxygen fix
FlashBarryAllen d9aaee5
Merge branch 'master' of github.com:FlashBarryAllen/PcapPlusPlus
FlashBarryAllen 254231f
Merge branch 'dev' into master
FlashBarryAllen 09a9e92
IB code style fix
FlashBarryAllen 451aa5c
Merge branch 'master' of github.com:FlashBarryAllen/PcapPlusPlus
FlashBarryAllen 1f0935e
Merge branch 'dev' into master
FlashBarryAllen 0623403
Merge branch 'dev' into master
FlashBarryAllen 8a05842
IB add pcap
FlashBarryAllen 4a02168
Merge branch 'dev' into master
FlashBarryAllen e2d8f04
fix IB argument type
FlashBarryAllen dd63809
Merge branch 'master' of github.com:FlashBarryAllen/PcapPlusPlus
FlashBarryAllen 6db4619
Merge branch 'dev' into master
FlashBarryAllen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,255 @@ | ||
| #pragma once | ||
|
|
||
| #include "Layer.h" | ||
|
|
||
| /// @file | ||
|
|
||
| /** | ||
| * \namespace pcpp | ||
| * \brief The main namespace for the PcapPlusPlus lib | ||
| */ | ||
| namespace pcpp | ||
| { | ||
| /** | ||
| * @class InfiniBandLayer | ||
| * Represents an InfiniBand protocol layer | ||
| */ | ||
| class InfiniBandLayer : public Layer | ||
| { | ||
| private: | ||
| /** | ||
| * @struct bth | ||
| * Represents an Base Transport Header | ||
| */ | ||
| #pragma pack(push, 1) | ||
| struct rxe_bth | ||
| { | ||
| uint8_t opcode; | ||
| uint8_t flags; | ||
| uint16_t pkey; | ||
| uint32_t qpn; | ||
| uint32_t apsn; | ||
| }; | ||
| #pragma pack(pop) | ||
|
|
||
| public: | ||
| /** | ||
| * A constructor that creates the layer from an existing packet raw data | ||
| * @param[in] data A pointer to the raw data (will be casted to bth_header) | ||
| * @param[in] dataLen Size of the data in bytes | ||
| * @param[in] prevLayer A pointer to the previous layer | ||
| * @param[in] packet A pointer to the Packet instance where layer will be stored in | ||
| */ | ||
| InfiniBandLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) | ||
| : Layer(data, dataLen, prevLayer, packet, InfiniBand) | ||
| {} | ||
|
|
||
| /** | ||
| * A constructor that creates a new rxe_bth header and allocates the data | ||
| * @param[in] opcode The operation code | ||
| * @param[in] soliciteEvent The solicited event | ||
| * @param[in] migrationState The migration state | ||
| * @param[in] padCount The pad count | ||
| * @param[in] partitionKey The partition key | ||
| * @param[in] queuePairNumber The destination queue pair (QP) number | ||
| * @param[in] ackReq The acknowledgment request | ||
| * @param[in] packetSequenceNumber The packet sequence number | ||
| */ | ||
| InfiniBandLayer(uint8_t opcode, int soliciteEvent, int migrationState, int padCount, uint16_t partitionKey, | ||
FlashBarryAllen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| uint32_t queuePairNumber, int ackReq, uint32_t packetSequenceNumber); | ||
|
|
||
| /** | ||
| * @return The operation code which defines the interpretation of the remaining header and payload bytes | ||
| */ | ||
| uint8_t getOpcode() const; | ||
|
|
||
| /** | ||
| * Set operation code | ||
| * @param[in] opcode The opcode to set | ||
| */ | ||
| void setOpcode(uint8_t opcode) const; | ||
|
|
||
| /** | ||
| * @return solicited event that the responder shall invoke the CQ event handler | ||
| */ | ||
| bool getSoliciteEvent() const; | ||
|
|
||
| /** | ||
| * Set solicited event | ||
| * @param[in] se The solicited event to set | ||
| */ | ||
| void setSolicitedEvent(bool se) const; | ||
|
|
||
| /** | ||
| * @return migreq which used to communicate migration state | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is |
||
| */ | ||
| bool getMigrationState() const; | ||
|
|
||
| /** | ||
| * Set migreq | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto: What is |
||
| * @param[in] mig The migration state to set. If set to one, indicates the connection or EE context has been | ||
| * migrated; if set to zero, it means there is no change in the current migration state. | ||
| */ | ||
| void setMigrationState(bool mig) const; | ||
|
|
||
| /** | ||
| * @return PadCount which Packet payloads are sent as a multiple of 4-byte quantities. | ||
| * Pad count indicates the number of pad bytes - 0 to 3 - that are appended to the packetpayload. | ||
| * Pads are used to “stretch” the payload (payloads may be zero or more bytes in length) to be a multiple of 4 | ||
| * bytes | ||
| */ | ||
| uint8_t getPadCount() const; | ||
|
|
||
| /** | ||
| * Set PadCount | ||
| * @param[in] pad The PadCount to set | ||
| */ | ||
| void setPadCount(uint8_t pad) const; | ||
|
|
||
| /** | ||
| * @return Transport Header Version that specifies the version of the IBA Transport used for this packet | ||
| */ | ||
| uint8_t getTransportHeaderVersion() const; | ||
|
|
||
| /** | ||
| * Set Transport Header Version | ||
| * @param[in] tvr The transport header version to set | ||
| */ | ||
| void setTransportHeaderVersion(uint8_t tver) const; | ||
|
|
||
| /** | ||
| * @return partition key identifying the partition | ||
| * that the destination QP (RC, UC, UD, XRC) or EE Context (RD) is a member. | ||
| */ | ||
| uint16_t getPartitionKey() const; | ||
|
|
||
| /** | ||
| * Set partition key | ||
| * @param[in] pkey The partition key to set | ||
| */ | ||
| void setPartitionKey(uint16_t pkey) const; | ||
|
|
||
| /** | ||
| * @return destination queue pair (QP) identifier | ||
| */ | ||
| uint32_t getQueuePairNumber() const; | ||
|
|
||
| /** | ||
| * Set Queue Pair Number | ||
| * @param[in] qpn The queue pair number to set | ||
| */ | ||
| void setQueuePairNumber(uint32_t qpn) const; | ||
|
|
||
| /** | ||
| * @return FECN | ||
| * F (FECN): false indicates that a FECN indication was not received. | ||
| * true indicates that the packet went through a point of congestion | ||
| */ | ||
| bool getFecn() const; | ||
|
|
||
| /** | ||
| * Set Fecn | ||
FlashBarryAllen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * @param[in] fecn The FECN to set | ||
| */ | ||
| void setFecn(bool fecn) const; | ||
|
|
||
| /** | ||
| * @return BECN | ||
| * B (BECN): false the packet did not go through a point of congestion or went | ||
| * through a point of congestion but was not marked. true indicates that the | ||
| * packet indicated by this header was subject to forward congestion. The B | ||
| * bit is set in an ACK or CN BTH | ||
| */ | ||
| bool getBecn() const; | ||
|
|
||
| /** | ||
| * Set BECN | ||
| * @param[in] becn The BECN to set | ||
| */ | ||
| void setBecn(bool becn) const; | ||
|
|
||
| /** | ||
| * Set Reserved 6 bits | ||
| */ | ||
| void setResv6a() const; | ||
|
|
||
| /** | ||
| * @return ackreq that requests responder to schedule an acknowledgment on the associated QP. | ||
| */ | ||
| int getAck() const; | ||
|
|
||
| /** | ||
| * Set acknowledgment for requests | ||
| * @param[in] ack The acknowledgment to set | ||
| */ | ||
| void setAck(int ack) const; | ||
|
|
||
| /** | ||
| * @return packet sequence number that is used to identify the position of a packet | ||
| * within a sequence of packets. | ||
| */ | ||
| uint32_t getPacketSequenceNumber() const; | ||
|
|
||
| /** | ||
| * Set packet sequence number | ||
| * @param[in] psn The packet sequence number to set | ||
| */ | ||
| void setPacketSequenceNumber(uint32_t psn) const; | ||
|
|
||
| /** | ||
| * Identify the next layer as PayloadLayer | ||
| */ | ||
| void parseNextLayer() override; | ||
|
|
||
| /** | ||
| * @return Size of rxe_bth header | ||
| */ | ||
| size_t getHeaderLen() const override | ||
| { | ||
| return sizeof(rxe_bth); | ||
| } | ||
|
|
||
| /** | ||
| * Does nothing for this layer | ||
| */ | ||
| void computeCalculateFields() override | ||
| {} | ||
|
|
||
| std::string toString() const override; | ||
|
|
||
| OsiModelLayer getOsiModelLayer() const override | ||
| { | ||
| return OsiModelTransportLayer; | ||
| } | ||
|
|
||
| /** | ||
| * A static method that check whether is inifiniband RoCE port | ||
| * @param[in] port The port from UDP destination port | ||
| * @return True if the port is inifiniband RoCE and can represent an rxe packet | ||
| */ | ||
| static inline bool isInfiniBandPort(uint16_t port) | ||
| { | ||
| return (port == 4791); | ||
| } | ||
|
|
||
| /** | ||
| * The static method makes validation of UDP data | ||
| * @param[in] udpData The pointer to the UDP payload data. It points to the first byte of rxe_bth header. | ||
| * @param[in] udpDataLen The payload data size | ||
| * @return True if the data is valid and can represent the rxe_bth packet | ||
| */ | ||
| static bool isDataValid(const uint8_t* udpData, size_t udpDataLen); | ||
|
|
||
| private: | ||
| /** | ||
| * Get a pointer to the BTH header. Notice this points directly to the data, so every change will change | ||
| * the actual packet data | ||
| * @return A pointer to the bth_header | ||
| */ | ||
| rxe_bth* getBthHeader() const | ||
| { | ||
| return reinterpret_cast<rxe_bth*>(m_Data); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace pcpp | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.