NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Typedefs | Enumerations | Functions | Variables
bdev.h File Reference
#include "bdev-enum.h"
#include "mbuf.h"
#include <spdk/bdev.h>

Go to the source code of this file.

Data Structures

struct  BdevStoredPacket
 Length and alignment descriptor of a stored packet. More...
 
struct  BdevRequest
 Bdev I/O request. More...
 
struct  Bdev
 Block device and related information. More...
 

Typedefs

typedef struct BdevStoredPacket BdevStoredPacket
 Length and alignment descriptor of a stored packet. More...
 
typedef struct BdevRequest BdevRequest
 
typedef void(* BdevRequestCb) (BdevRequest *req, int res)
 
typedef struct Bdev Bdev
 Block device and related information. More...
 

Enumerations

enum  { BdevBlockSize = 512 , BdevMaxMbufSegs = 31 }
 

Functions

void Bdev_ReadPacket (Bdev *bd, struct spdk_io_channel *ch, uint64_t blockOffset, BdevRequest *req)
 Read block device into mbuf. More...
 
bool Bdev_WritePrepare (Bdev *bd, struct rte_mbuf *pkt, BdevStoredPacket *sp)
 Prepare writing according to bdev alignment requirements. More...
 
void Bdev_WritePacket (Bdev *bd, struct spdk_io_channel *ch, uint64_t blockOffset, BdevRequest *req)
 Write block device from mbuf via scatter gather list. More...
 

Variables

uint8_t * BdevFiller_
 

Typedef Documentation

◆ Bdev

typedef struct Bdev Bdev

Block device and related information.

◆ BdevRequest

typedef struct BdevRequest BdevRequest

◆ BdevRequestCb

typedef void(* BdevRequestCb) (BdevRequest *req, int res)

◆ BdevStoredPacket

Length and alignment descriptor of a stored packet.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BdevBlockSize 

Expected block size; other block sizes are not supported.

BdevMaxMbufSegs 

Maximum packet segments acceptable to Bdev_ReadPacket and Bdev_WritePacket.

Function Documentation

◆ Bdev_ReadPacket()

void Bdev_ReadPacket ( Bdev bd,
struct spdk_io_channel *  ch,
uint64_t  blockOffset,
BdevRequest req 
)

Read block device into mbuf.

Precondition
This must be called in a SPDK thread.
Parameters
chan SPDK I/O channel associated with the bdev and the current SPDK thread.
reqrequest context. All fields must be kept alive until req->cb is called.

req->pkt must be a uniquely owned, unsegmented, direct mbuf with sufficient dataroom. req->pkt->data_off may be adjusted (either increased or decreased) to achieve proper alignment as required by SPDK bdev driver.

◆ Bdev_WritePacket()

void Bdev_WritePacket ( Bdev bd,
struct spdk_io_channel *  ch,
uint64_t  blockOffset,
BdevRequest req 
)

Write block device from mbuf via scatter gather list.

Precondition
This must be called in a SPDK thread.
Parameters
chan SPDK I/O channel associated with the bdev and the current SPDK thread.
reqrequest context. req->sp may be freed after this function returns. All other fields must be kept alive until req->cb is called.

req->pkt->pkt_len determines write length. Some headroom and tailroom in each mbuf segment may be written to disk to achieve proper alignment as required by SPDK bdev driver, but they will not appear in readback if the same BdevStorePacket is passed.

◆ Bdev_WritePrepare()

bool Bdev_WritePrepare ( Bdev bd,
struct rte_mbuf *  pkt,
BdevStoredPacket sp 
)

Prepare writing according to bdev alignment requirements.

Parameters
[in]pktinput packet; cannot be modified between this call and Bdev_WritePacket .
[out]spstored packet alignment information, needed to later recover the packet.
Returns
whether success.

Variable Documentation

◆ BdevFiller_

uint8_t* BdevFiller_
extern