diff mbox series

[5/6] slirp/ncsi: add a "Get Parameter" response

Message ID 20180529062838.20556-6-clg@kaod.org
State New
Headers show
Series ftgmac100 and NC-SI enhancements for the Aspeed SoC | expand

Commit Message

Cédric Le Goater May 29, 2018, 6:28 a.m. UTC
This is a minimum response to exercise the kernel.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 slirp/ncsi.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé May 29, 2018, 1:11 p.m. UTC | #1
Hi Cédric,

In title: "Get Parameters" (plural)

On 05/29/2018 03:28 AM, Cédric Le Goater wrote:
> This is a minimum response to exercise the kernel.

This type is mandatory in DMTF Standard v1.0.1 indeed (DSP0222).

> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  slirp/ncsi.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/slirp/ncsi.c b/slirp/ncsi.c
> index 02d0e9def3e8..f00253641ea4 100644
> --- a/slirp/ncsi.c
> +++ b/slirp/ncsi.c
> @@ -35,6 +35,27 @@ static int ncsi_rsp_handler_gls(struct ncsi_rsp_pkt_hdr *rnh)
>      return 0;
>  }
>  
> +/* Get Parameter */

"Parameters"

> +static int ncsi_rsp_handler_gp(struct ncsi_rsp_pkt_hdr *rnh)
> +{
> +    struct ncsi_rsp_gp_pkt *rsp = (struct ncsi_rsp_gp_pkt *) rnh;
> +
> +    rsp->mac_cnt = 0x0;

"MAC Address Count: The number of MAC addresses supported by the channel"

0 means "no [MAC Address] filter [in use]"

> +    rsp->mac_enable = 0x0;

"MAC Address Flags: all [MAC Address filters] disabled" ...

> +
> +    /* TODO: provide the guest configured MAC */
> +    rsp->mac[0] = 0xaa;
> +    rsp->mac[1] = 0xbb;
> +    rsp->mac[2] = 0xcc;
> +    rsp->mac[3] = 0xdd;
> +    rsp->mac[4] = 0xee;
> +    rsp->mac[5] = 0xff;

So there is no need to set this filter,
or you have to set:

    rsp->mac_cnt = 1;
    rsp->mac_enable = 1 << 0;

Also, you forgot to set:

    rsp->vlan_cnt = 0;
    rsp->vlan_enable = 0;

> +
> +    /* more data follows */
> +
> +    return 0;
> +}
> +
>  static const struct ncsi_rsp_handler {
>          unsigned char   type;
>          int             payload;
> @@ -62,7 +83,7 @@ static const struct ncsi_rsp_handler {
>          { NCSI_PKT_RSP_SNFC,    4, NULL },
>          { NCSI_PKT_RSP_GVI,    40, NULL },
>          { NCSI_PKT_RSP_GC,     32, ncsi_rsp_handler_gc },
> -        { NCSI_PKT_RSP_GP,     -1, NULL },
> +        { NCSI_PKT_RSP_GP,     40, ncsi_rsp_handler_gp },
>          { NCSI_PKT_RSP_GCPS,  172, NULL },
>          { NCSI_PKT_RSP_GNS,   172, NULL },
>          { NCSI_PKT_RSP_GNPTS, 172, NULL },
>
Cédric Le Goater May 29, 2018, 5:12 p.m. UTC | #2
On 05/29/2018 03:11 PM, Philippe Mathieu-Daudé wrote:
> Hi Cédric,
> 
> In title: "Get Parameters" (plural)
> 
> On 05/29/2018 03:28 AM, Cédric Le Goater wrote:
>> This is a minimum response to exercise the kernel.
> 
> This type is mandatory in DMTF Standard v1.0.1 indeed (DSP0222).
> 
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  slirp/ncsi.c | 23 ++++++++++++++++++++++-
>>  1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/slirp/ncsi.c b/slirp/ncsi.c
>> index 02d0e9def3e8..f00253641ea4 100644
>> --- a/slirp/ncsi.c
>> +++ b/slirp/ncsi.c
>> @@ -35,6 +35,27 @@ static int ncsi_rsp_handler_gls(struct ncsi_rsp_pkt_hdr *rnh)
>>      return 0;
>>  }
>>  
>> +/* Get Parameter */
> 
> "Parameters"
> 
>> +static int ncsi_rsp_handler_gp(struct ncsi_rsp_pkt_hdr *rnh)
>> +{
>> +    struct ncsi_rsp_gp_pkt *rsp = (struct ncsi_rsp_gp_pkt *) rnh;
>> +
>> +    rsp->mac_cnt = 0x0;
> 
> "MAC Address Count: The number of MAC addresses supported by the channel"
> 
> 0 means "no [MAC Address] filter [in use]"
> 
>> +    rsp->mac_enable = 0x0;
> 
> "MAC Address Flags: all [MAC Address filters] disabled" ...
> 
>> +
>> +    /* TODO: provide the guest configured MAC */
>> +    rsp->mac[0] = 0xaa;
>> +    rsp->mac[1] = 0xbb;
>> +    rsp->mac[2] = 0xcc;
>> +    rsp->mac[3] = 0xdd;
>> +    rsp->mac[4] = 0xee;
>> +    rsp->mac[5] = 0xff;
> 
> So there is no need to set this filter,
> or you have to set:
> 
>     rsp->mac_cnt = 1;
>     rsp->mac_enable = 1 << 0;
> 
> Also, you forgot to set:
> 
>     rsp->vlan_cnt = 0;
>     rsp->vlan_enable = 0;


yes. I will clean up the handler.

Thanks,

C.

>> +
>> +    /* more data follows */
>> +
>> +    return 0;
>> +}
>> +
>>  static const struct ncsi_rsp_handler {
>>          unsigned char   type;
>>          int             payload;
>> @@ -62,7 +83,7 @@ static const struct ncsi_rsp_handler {
>>          { NCSI_PKT_RSP_SNFC,    4, NULL },
>>          { NCSI_PKT_RSP_GVI,    40, NULL },
>>          { NCSI_PKT_RSP_GC,     32, ncsi_rsp_handler_gc },
>> -        { NCSI_PKT_RSP_GP,     -1, NULL },
>> +        { NCSI_PKT_RSP_GP,     40, ncsi_rsp_handler_gp },
>>          { NCSI_PKT_RSP_GCPS,  172, NULL },
>>          { NCSI_PKT_RSP_GNS,   172, NULL },
>>          { NCSI_PKT_RSP_GNPTS, 172, NULL },
>>
diff mbox series

Patch

diff --git a/slirp/ncsi.c b/slirp/ncsi.c
index 02d0e9def3e8..f00253641ea4 100644
--- a/slirp/ncsi.c
+++ b/slirp/ncsi.c
@@ -35,6 +35,27 @@  static int ncsi_rsp_handler_gls(struct ncsi_rsp_pkt_hdr *rnh)
     return 0;
 }
 
+/* Get Parameter */
+static int ncsi_rsp_handler_gp(struct ncsi_rsp_pkt_hdr *rnh)
+{
+    struct ncsi_rsp_gp_pkt *rsp = (struct ncsi_rsp_gp_pkt *) rnh;
+
+    rsp->mac_cnt = 0x0;
+    rsp->mac_enable = 0x0;
+
+    /* TODO: provide the guest configured MAC */
+    rsp->mac[0] = 0xaa;
+    rsp->mac[1] = 0xbb;
+    rsp->mac[2] = 0xcc;
+    rsp->mac[3] = 0xdd;
+    rsp->mac[4] = 0xee;
+    rsp->mac[5] = 0xff;
+
+    /* more data follows */
+
+    return 0;
+}
+
 static const struct ncsi_rsp_handler {
         unsigned char   type;
         int             payload;
@@ -62,7 +83,7 @@  static const struct ncsi_rsp_handler {
         { NCSI_PKT_RSP_SNFC,    4, NULL },
         { NCSI_PKT_RSP_GVI,    40, NULL },
         { NCSI_PKT_RSP_GC,     32, ncsi_rsp_handler_gc },
-        { NCSI_PKT_RSP_GP,     -1, NULL },
+        { NCSI_PKT_RSP_GP,     40, ncsi_rsp_handler_gp },
         { NCSI_PKT_RSP_GCPS,  172, NULL },
         { NCSI_PKT_RSP_GNS,   172, NULL },
         { NCSI_PKT_RSP_GNPTS, 172, NULL },