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

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_ = NULL
 

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_ = NULL

◆ prepare

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

◆ writeIov

int(* writeIov) (Bdev *bd, BdevRequest *req, uint32_t totalLen) ( Bdev bd,
BdevRequest req,
uint32_t  totalLen 
)