diff mbox

[dpdk-dev,v3,14/28] eal/pci: Add rte_eal_devargs_remove

Message ID 1418106629-22227-15-git-send-email-mukawa@igel.co.jp (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Tetsuya Mukawa Dec. 9, 2014, 6:30 a.m. UTC
The function removes a specified devargs from devargs_list.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 lib/librte_eal/common/eal_common_devargs.c  | 16 ++++++++++++++++
 lib/librte_eal/common/include/rte_devargs.h | 18 ++++++++++++++++++
 2 files changed, 34 insertions(+)

Comments

Michael Qiu Dec. 9, 2014, 3:36 p.m. UTC | #1
I don't know if other reviewers ask you to split so many patches. But I
would like merge some of them, because some are doing same affairs(just
using different args), others should be add/remove affairs. Those could
be merge to one patch, although it is much more easier for review.

Actually, it is much harder to review such long thread....

But just one suggestion, merge or not depends you.

Thanks,
Michael
On 2014/12/9 14:33, Tetsuya Mukawa wrote:
> The function removes a specified devargs from devargs_list.
>
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> ---
>  lib/librte_eal/common/eal_common_devargs.c  | 16 ++++++++++++++++
>  lib/librte_eal/common/include/rte_devargs.h | 18 ++++++++++++++++++
>  2 files changed, 34 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
> index f95a12d..5fd2a2c 100644
> --- a/lib/librte_eal/common/eal_common_devargs.c
> +++ b/lib/librte_eal/common/eal_common_devargs.c
> @@ -140,6 +140,22 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
>  	return 0;
>  }
>  
> +/* remove it from the devargs_list */
> +void
> +rte_eal_devargs_remove(enum rte_devtype devtype, void *args)
> +{
> +	struct rte_devargs *devargs;
> +
> +	if (args == NULL)
> +		return;
> +
> +	devargs = rte_eal_devargs_find(devtype, args);
> +	if (devargs == NULL)
> +		return;
> +
> +	TAILQ_REMOVE(&devargs_list, devargs, next);
> +}
> +
>  /* count the number of devices of a specified type */
>  unsigned int
>  rte_eal_devargs_type_count(enum rte_devtype devtype)
> diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h
> index 9f9c98f..1066efd 100644
> --- a/lib/librte_eal/common/include/rte_devargs.h
> +++ b/lib/librte_eal/common/include/rte_devargs.h
> @@ -123,6 +123,24 @@ extern struct rte_devargs_list devargs_list;
>  int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str);
>  
>  /**
> + * Remove a device from the user device list
> + *
> + * For PCI devices, the format of arguments string is "PCI_ADDR". It shouldn't
> + * involves parameters for the device. Example: "08:00.1".
> + *
> + * For virtual devices, the format of arguments string is "DRIVER_NAME*". It
> + * shouldn't involves parameters for the device. Example: "eth_ring". The
> + * validity of the driver name is not checked by this function, it is done
> + * when closing the drivers.
> + *
> + * @param devtype
> + *   The type of the device.
> + * @param name
> + *   The name of the device.
> + */
> +void rte_eal_devargs_remove(enum rte_devtype devtype, void *args);
> +
> +/**
>   * Count the number of user devices of a specified type
>   *
>   * @param devtype
Tetsuya Mukawa Dec. 11, 2014, 1:40 a.m. UTC | #2
Hi Michael,

(2014/12/10 0:36), Qiu, Michael wrote:
> I don't know if other reviewers ask you to split so many patches. But I
> would like merge some of them, because some are doing same affairs(just
> using different args), others should be add/remove affairs. Those could
> be merge to one patch, although it is much more easier for review.
>
> Actually, it is much harder to review such long thread....

I am sorry for that. I will merge some patches into one.
Also appreciate your other comments.
I will fix my code like your suggestions, and submit it again.

Thanks,
Tetsuya

> But just one suggestion, merge or not depends you.
>
> Thanks,
> Michael
> On 2014/12/9 14:33, Tetsuya Mukawa wrote:
>> The function removes a specified devargs from devargs_list.
>>
>> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
>> ---
>>  lib/librte_eal/common/eal_common_devargs.c  | 16 ++++++++++++++++
>>  lib/librte_eal/common/include/rte_devargs.h | 18 ++++++++++++++++++
>>  2 files changed, 34 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
>> index f95a12d..5fd2a2c 100644
>> --- a/lib/librte_eal/common/eal_common_devargs.c
>> +++ b/lib/librte_eal/common/eal_common_devargs.c
>> @@ -140,6 +140,22 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
>>  	return 0;
>>  }
>>  
>> +/* remove it from the devargs_list */
>> +void
>> +rte_eal_devargs_remove(enum rte_devtype devtype, void *args)
>> +{
>> +	struct rte_devargs *devargs;
>> +
>> +	if (args == NULL)
>> +		return;
>> +
>> +	devargs = rte_eal_devargs_find(devtype, args);
>> +	if (devargs == NULL)
>> +		return;
>> +
>> +	TAILQ_REMOVE(&devargs_list, devargs, next);
>> +}
>> +
>>  /* count the number of devices of a specified type */
>>  unsigned int
>>  rte_eal_devargs_type_count(enum rte_devtype devtype)
>> diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h
>> index 9f9c98f..1066efd 100644
>> --- a/lib/librte_eal/common/include/rte_devargs.h
>> +++ b/lib/librte_eal/common/include/rte_devargs.h
>> @@ -123,6 +123,24 @@ extern struct rte_devargs_list devargs_list;
>>  int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str);
>>  
>>  /**
>> + * Remove a device from the user device list
>> + *
>> + * For PCI devices, the format of arguments string is "PCI_ADDR". It shouldn't
>> + * involves parameters for the device. Example: "08:00.1".
>> + *
>> + * For virtual devices, the format of arguments string is "DRIVER_NAME*". It
>> + * shouldn't involves parameters for the device. Example: "eth_ring". The
>> + * validity of the driver name is not checked by this function, it is done
>> + * when closing the drivers.
>> + *
>> + * @param devtype
>> + *   The type of the device.
>> + * @param name
>> + *   The name of the device.
>> + */
>> +void rte_eal_devargs_remove(enum rte_devtype devtype, void *args);
>> +
>> +/**
>>   * Count the number of user devices of a specified type
>>   *
>>   * @param devtype
diff mbox

Patch

diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
index f95a12d..5fd2a2c 100644
--- a/lib/librte_eal/common/eal_common_devargs.c
+++ b/lib/librte_eal/common/eal_common_devargs.c
@@ -140,6 +140,22 @@  rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 	return 0;
 }
 
+/* remove it from the devargs_list */
+void
+rte_eal_devargs_remove(enum rte_devtype devtype, void *args)
+{
+	struct rte_devargs *devargs;
+
+	if (args == NULL)
+		return;
+
+	devargs = rte_eal_devargs_find(devtype, args);
+	if (devargs == NULL)
+		return;
+
+	TAILQ_REMOVE(&devargs_list, devargs, next);
+}
+
 /* count the number of devices of a specified type */
 unsigned int
 rte_eal_devargs_type_count(enum rte_devtype devtype)
diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h
index 9f9c98f..1066efd 100644
--- a/lib/librte_eal/common/include/rte_devargs.h
+++ b/lib/librte_eal/common/include/rte_devargs.h
@@ -123,6 +123,24 @@  extern struct rte_devargs_list devargs_list;
 int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str);
 
 /**
+ * Remove a device from the user device list
+ *
+ * For PCI devices, the format of arguments string is "PCI_ADDR". It shouldn't
+ * involves parameters for the device. Example: "08:00.1".
+ *
+ * For virtual devices, the format of arguments string is "DRIVER_NAME*". It
+ * shouldn't involves parameters for the device. Example: "eth_ring". The
+ * validity of the driver name is not checked by this function, it is done
+ * when closing the drivers.
+ *
+ * @param devtype
+ *   The type of the device.
+ * @param name
+ *   The name of the device.
+ */
+void rte_eal_devargs_remove(enum rte_devtype devtype, void *args);
+
+/**
  * Count the number of user devices of a specified type
  *
  * @param devtype