Skip to contentSkip to conversation

accel-config: Add completion record size setup for accfg_device

PATCH Ramesh Thomas 1 participant 1 message Apr 12, 2022 1 message not in the archive

lore
Share & tools
lore

Ramesh Thomas

author
#1 lore raw
In reply to a message not in the archive
Quoted 18 lines · Li Zhang

DSA and IAA test need to get completion record size for allocating and dumping completion record. DSA completion record is 32 bytes while IAA completion record is 64 bytes. So add compl_size field in struct accfg_device for using by DSA and IAA test code.

Signed-off-by Li Zhang <li4.zhang(a)intel.com>
Reviewed-by Dave Jiang <dave.jiang(a)intel.com>
---
  accfg/lib/libaccfg.c    | 17 +++++++++++++++++
  accfg/lib/private.h     |  1 +
  accfg/libaccel_config.h |  5 +++++
  3 files changed, 23 insertions(+)
accfg/lib/libaccfg.c +0 -0
index 8d883b1..200bd70 100644

accfg/lib/libaccfg.c static int device_parse_type(struct accfg_device *device) · line 556

Quoted 10 lines
accfg/lib/libaccfg.c +7 -0
@@ -547,6 +547,19 @@ static int device_parse_type(struct accfg_device *device)
  	return -ENODEV;
  }
 
+/*set completion record size*/
+static int device_parse_compl_size(struct accfg_device *device)
+{
+	if (device->type == ACCFG_DEVICE_DSA)
+		device->compl_size = ACCFG_DEVICE_COMPL_SIZE_DSA;
+	else if (device->type == ACCFG_DEVICE_IAX)
+		device->compl_size = ACCFG_DEVICE_COMPL_SIZE_IAX;

Please make this dynamic. See how basenames is used. No need for this function.

Quoted 10 lines
accfg/lib/libaccfg.c +6 -0
+	else
+		return -ENODEV;
+
+	return 0;
+}
+
  static int mdev_str_to_type(char *mdev_type_str)
  {
  	char **b;

accfg/lib/libaccfg.c static void *add_device(void *parent, int id, const char *ctl_base, · line 722

Quoted 4 lines
accfg/lib/libaccfg.c +1 -0
@@ -706,6 +719,10 @@ static void *add_device(void *parent, int id, const char *ctl_base,
  	if (rc < 0)
  		goto err_dev_path;
 
+	rc = device_parse_compl_size(device);

No need to call function. Assign from array indexed by device type.

Quoted 23 lines
accfg/lib/libaccfg.c +3 -0
+	if (rc < 0)
+		goto err_dev_path;
+
  	device->bus_type_str = bus_type;
 
  	if (is_mdev_registered(device) && add_device_mdevs(ctx, device))
accfg/lib/private.h +1 -0
index f88044c..773aba2 100644
@@ -46,6 +46,7 @@ struct accfg_device {
  	int numa_node;
  	int ims_size;
  	int max_batch_size;
+	int compl_size;
  	int configurable;
  	int max_read_buffers;
  	unsigned int read_buffer_limit;
accfg/libaccel_config.h +0 -0
index 9e952a7..ef7c8ae 100644

accfg/libaccel_config.h enum accfg_device_state { · line 52

Quoted 8 lines
accfg/libaccel_config.h +5 -0
@@ -45,6 +45,11 @@ enum accfg_device_state {
  	ACCFG_DEVICE_UNKNOWN = -1,
  };
 
+enum accfg_device_compl_size {
+	ACCFG_DEVICE_COMPL_SIZE_DSA = 32,
+	ACCFG_DEVICE_COMPL_SIZE_IAX = 64,
+};
+

No need for this enum. Create an array like basenames and store the corresponding value for each type

Quoted 3 lines
accfg/libaccel_config.h +0 -0
  enum accfg_wq_mode {
  	ACCFG_WQ_SHARED = 0,
  	ACCFG_WQ_DEDICATED,