>Yi Zou wrote:
>> These stats are per LLD, i.e., per netdev, and stored in lport's
>> fcoe_lld_stats struct.
>>
>> Signed-off-by: Yi Zou <[email protected]>
>> ---
>>
>>  drivers/scsi/fcoe/fcoe.c |   24 ++++++++++++++++++++++++
>>  include/scsi/libfc.h     |    6 ++++++
>>  2 files changed, 30 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
>> index 4a43b74..901963a 100644
>> --- a/drivers/scsi/fcoe/fcoe.c
>> +++ b/drivers/scsi/fcoe/fcoe.c
>> @@ -110,6 +110,8 @@ static struct fc_seq *fcoe_elsct_send(struct fc_lport *,
>>                                                 void *),
>>                                    void *, u32 timeout);
>>
>> +static int fcoe_get_lld_stats(struct fc_lport *, struct fcoe_lld_stats *);
>> +
>>  module_param_call(create, fcoe_create, NULL, NULL, S_IWUSR);
>>  __MODULE_PARM_TYPE(create, "string");
>>  MODULE_PARM_DESC(create, "Create fcoe fcoe using net device passed in.");
>> @@ -140,6 +142,7 @@ static struct libfc_function_template
>fcoe_libfc_fcn_templ = {
>>      .ddp_setup = fcoe_ddp_setup,
>>      .ddp_done = fcoe_ddp_done,
>>      .elsct_send = fcoe_elsct_send,
>> +    .lld_stats = fcoe_get_lld_stats,
>>  };
>>
>>  struct fc_function_template fcoe_transport_function = {
>> @@ -2430,3 +2433,24 @@ static void fcoe_set_vport_symbolic_name(struct
>fc_vport *vport)
>>      lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RSPN_ID,
>>                           NULL, NULL, 3 * lport->r_a_tov);
>>  }
>> +
>> +/**
>> + * fcoe_get_lld_stats() - Updates fcoe_dev_stats for LLD
>> + * related stats, e.g., frame check sequence error.
>> + * @lp: The local port
>> + *
>> + * Returns : 0 for success
>> + */
>> +static int fcoe_get_lld_stats(struct fc_lport *lport,
>> +                          struct fcoe_lld_stats *lld_stats)
>> +{
>> +    struct net_device *netdev = fcoe_netdev(lport);
>> +    const struct net_device_stats *net_stats;
>> +
>> +    net_stats = dev_get_stats(netdev);
>> +
>> +    lld_stats->SymbolErrorCount = 0;
>> +    lld_stats->ErroredBlockCount = 0;
>
>The upper layer should pre-zero the entire structure so unsupported
>fields do not need to be filled in here.
Yeah, I did not find anywhere these two can be obtained from a common
place in kernel and not many hw will actually return these two I think.
I will pre-zero the struct and remove them in the update.

>
>> +    lld_stats->FCSErrorCount = net_stats->rx_crc_errors;
>
>Is this correct for FCoE CRC errors, or are these all Ethernet CRC errors?
>I suppose either way is OK.
This is for Ethernet.

yi
>

>> +    return 0;
>> +}
>> diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
>> index 3d9b49f..a447ac6 100644
>> --- a/include/scsi/libfc.h
>> +++ b/include/scsi/libfc.h
>> @@ -523,6 +523,12 @@ struct libfc_function_template {
>>       */
>>      int (*ddp_done)(struct fc_lport *, u16);
>>      /*
>> +     * Allow LLD to pass the statistics to libfc
>> +     *
>> +     * STATUS: OPTIONAL
>> +     */
>> +    int (*lld_stats)(struct fc_lport *, struct fcoe_lld_stats *);
>> +    /*
>>       * Send a frame using an existing sequence and exchange.
>>       *
>>       * STATUS: OPTIONAL
>>
>> _______________________________________________
>> devel mailing list
>> [email protected]
>> http://www.open-fcoe.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to