Re: [RFC net-next v02 1/3] net: hinic3: module initialization and tx/rx logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +static void hinic3_del_one_adev(struct hinic3_hwdev *hwdev,
> > +				enum hinic3_service_type svc_type)
> > +{
> > +	struct hinic3_pcidev *pci_adapter = hwdev->adapter;
> > +	struct hinic3_adev *hadev;
> > +	bool timeout = true;
> > +	unsigned long end;
> > +
> > +	end = jiffies + msecs_to_jiffies(HINIC3_EVENT_PROCESS_TIMEOUT);
> > +	do {
> > +		if (!test_and_set_bit(svc_type, &pci_adapter->state)) {
> > +			timeout = false;
> > +			break;
> > +		}
> > +		usleep_range(900, 1000);
> > +	} while (time_before(jiffies, end));
> > +
> > +	if (timeout && !test_and_set_bit(svc_type, &pci_adapter->state))
> > +		timeout = false;
>
> Please look at using iopoll.h
>

Ack

> > +static int hinic3_sw_init(struct net_device *netdev)
> > +{
> > +	struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> > +	struct hinic3_hwdev *hwdev = nic_dev->hwdev;
> > +	int err;
> > +
> > +	nic_dev->q_params.sq_depth = HINIC3_SQ_DEPTH;
> > +	nic_dev->q_params.rq_depth = HINIC3_RQ_DEPTH;
> > +
> > +	hinic3_try_to_enable_rss(netdev);
> > +
> > +	eth_hw_addr_random(netdev);
>
> Is using a random MAC just a temporary thing until more code is added
> to access an OTP?
>

No, using a random MAC is not a temporary solution.
This device is designed for cloud environments. VFs are expected to be
used by VMs that may migrate from device to device. Therefore the HW does
not provide a MAC address to VFs, but rather the VF driver selects a
random MAC address and configures it into the (current) device.

Once the driver is extended to support PFs, the PF MAC will be obtained
from the device.

> > +	err = register_netdev(netdev);
> > +	if (err) {
> > +		err = -ENOMEM;
> > +		goto err_netdev;
> > +	}
> > +
> > +	netif_carrier_off(netdev);
> > +
> > +	dev_set_drvdata(&adev->dev, nic_dev);
>
> Is this used anywhere in the driver? Calling register_netdev() makes
> the interface live, even before it returns. If you have NFS root for
> example, it could be sending packets, etc, before drvdata is set.
>

Ack

> > +int hinic3_set_port_mtu(struct net_device *netdev, u16 new_mtu)
> > +{
> > +	struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> > +	struct hinic3_func_tbl_cfg func_tbl_cfg = {};
> > +	struct hinic3_hwdev *hwdev = nic_dev->hwdev;
> > +
> > +	if (new_mtu < HINIC3_MIN_MTU_SIZE) {
> > +		dev_err(hwdev->dev,
> > +			"Invalid mtu size: %ubytes, mtu size < %ubytes\n",
> > +			new_mtu, HINIC3_MIN_MTU_SIZE);
> > +		return -EINVAL;
> > +	}
> > +
> > +	if (new_mtu > HINIC3_MAX_JUMBO_FRAME_SIZE) {
> > +		dev_err(hwdev->dev, "Invalid mtu size: %ubytes, mtu size > %ubytes\n",
> > +			new_mtu, HINIC3_MAX_JUMBO_FRAME_SIZE);
> > +		return -EINVAL;
> > +	}
>
> The core can do this validation for you, if you set ndev->max_mtu,
> ndev->min_mtu.

Ack




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux