[PATCH 09/15] net: hbl_en: add habanalabs Ethernet driver

Omer Shpigelman oshpigelman at habana.ai
Tue Jun 18 19:39:12 UTC 2024


On 6/15/24 03:16, Stephen Hemminger wrote:
> [You don't often get email from stephen at networkplumber.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
>> +
>> +/* get the src IP as it is done in devinet_ioctl() */
>> +static int hbl_en_get_src_ip(struct hbl_aux_dev *aux_dev, u32 port_idx, u32 *src_ip)
>> +{
>> +     struct hbl_en_port *port = HBL_EN_PORT(aux_dev, port_idx);
>> +     struct net_device *ndev = port->ndev;
>> +     struct in_device *in_dev;
>> +     struct in_ifaddr *ifa;
>> +     int rc = 0;
>> +
>> +     /* for the case where no src IP is configured */
>> +     *src_ip = 0;
>> +
>> +     /* rtnl lock should be acquired in relevant flows before taking configuration lock */
>> +     if (!rtnl_is_locked()) {
>> +             netdev_err(port->ndev, "Rtnl lock is not acquired, can't proceed\n");
>> +             rc = -EFAULT;
>> +             goto out;
>> +     }
>> +
>> +     in_dev = __in_dev_get_rtnl(ndev);
>> +     if (!in_dev) {
>> +             netdev_err(port->ndev, "Failed to get IPv4 struct\n");
>> +             rc = -EFAULT;
>> +             goto out;
>> +     }
>> +
>> +     ifa = rtnl_dereference(in_dev->ifa_list);
>> +
>> +     while (ifa) {
>> +             if (!strcmp(ndev->name, ifa->ifa_label)) {
>> +                     /* convert the BE to native and later on it will be
>> +                      * written to the HW as LE in QPC_SET
>> +                      */
>> +                     *src_ip = be32_to_cpu(ifa->ifa_local);
>> +                     break;
>> +             }
>> +             ifa = rtnl_dereference(ifa->ifa_next);
>> +     }
>> +out:
>> +     return rc;
>> +}
> 
> Does this device require IPv4? What about users and infrastructures that use IPv6 only?
> IPv4 is legacy at this point.

Gaudi2 supports IPv4 only.


More information about the dri-devel mailing list