[dpdk-dev,1/2] net/tap: improve link_update
Checks
Commit Message
Reflect device link status according to the state of the tap netdevice
and the remote netdevice (if any). If both are UP and RUNNING, then the
device link status is set to ETH_LINK_UP, otherwise ETH_LINK_DOWN.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
drivers/net/tap/rte_eth_tap.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
Comments
> On Mar 22, 2017, at 3:40 AM, Pascal Mazon <pascal.mazon@6wind.com> wrote:
>
> Reflect device link status according to the state of the tap netdevice
> and the remote netdevice (if any). If both are UP and RUNNING, then the
> device link status is set to ETH_LINK_UP, otherwise ETH_LINK_DOWN.
>
> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
Regards,
Keith
On 3/22/2017 2:11 PM, Wiles, Keith wrote:
>
>> On Mar 22, 2017, at 3:40 AM, Pascal Mazon <pascal.mazon@6wind.com> wrote:
>>
>> Reflect device link status according to the state of the tap netdevice
>> and the remote netdevice (if any). If both are UP and RUNNING, then the
>> device link status is set to ETH_LINK_UP, otherwise ETH_LINK_DOWN.
>>
>> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
>
> Acked-by: Keith Wiles <keith.wiles@intel.com>
Series applied to dpdk-next-net/master, thanks.
Hi Pascal,
Many features added to the tap PMD in this realease.
Would you mind adding a release notes item, in a single patch, to
mention from all tap updates?
Thanks,
ferruh
On Fri, 24 Mar 2017 16:02:48 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 3/22/2017 2:11 PM, Wiles, Keith wrote:
> >
> >> On Mar 22, 2017, at 3:40 AM, Pascal Mazon <pascal.mazon@6wind.com>
> >> wrote:
> >>
> >> Reflect device link status according to the state of the tap
> >> netdevice and the remote netdevice (if any). If both are UP and
> >> RUNNING, then the device link status is set to ETH_LINK_UP,
> >> otherwise ETH_LINK_DOWN.
> >>
> >> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
> >
> > Acked-by: Keith Wiles <keith.wiles@intel.com>
>
> Series applied to dpdk-next-net/master, thanks.
>
>
> Hi Pascal,
>
> Many features added to the tap PMD in this realease.
>
> Would you mind adding a release notes item, in a single patch, to
> mention from all tap updates?
>
> Thanks,
> ferruh
Hi Ferruh,
Yes there's been a banch of changes in tap. I have still a few things
I'd like to push yet. I'll send a patch with the release note at the end
of those.
Best regards,
Pascal
On 3/27/2017 10:45 AM, Pascal Mazon wrote:
> On Fri, 24 Mar 2017 16:02:48 +0000
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
>> On 3/22/2017 2:11 PM, Wiles, Keith wrote:
>>>
>>>> On Mar 22, 2017, at 3:40 AM, Pascal Mazon <pascal.mazon@6wind.com>
>>>> wrote:
>>>>
>>>> Reflect device link status according to the state of the tap
>>>> netdevice and the remote netdevice (if any). If both are UP and
>>>> RUNNING, then the device link status is set to ETH_LINK_UP,
>>>> otherwise ETH_LINK_DOWN.
>>>>
>>>> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
>>>
>>> Acked-by: Keith Wiles <keith.wiles@intel.com>
>>
>> Series applied to dpdk-next-net/master, thanks.
>>
>>
>> Hi Pascal,
>>
>> Many features added to the tap PMD in this realease.
>>
>> Would you mind adding a release notes item, in a single patch, to
>> mention from all tap updates?
>>
>> Thanks,
>> ferruh
>
> Hi Ferruh,
>
> Yes there's been a banch of changes in tap. I have still a few things
> I'd like to push yet.
There isn't time left for this release, proposal (v1) deadline is passed
long ago. Almost integration deadline is hit (end of this week).
> I'll send a patch with the release note at the end
> of those.
If your other patches slip into next release, can you please send a
release notes updates for this release for the features included in this
release?
>
> Best regards,
> Pascal
>
On Mon, 27 Mar 2017 12:21:45 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> There isn't time left for this release, proposal (v1) deadline is
> passed long ago. Almost integration deadline is hit (end of this
> week).
>
> If your other patches slip into next release, can you please send a
> release notes updates for this release for the features included in
> this release?
>
>
You're right, I'm out of the deadline, my patch will wait.
I'll prepare a release note item for what's integrated at least.
Best regards,
Pascal
@@ -443,6 +443,14 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
* If there is a remote netdevice, apply ioctl on it, then apply it on
* the tap netdevice.
*/
+ if (request == SIOCGIFFLAGS && !set) {
+ /*
+ * Special case for getting flags. If set is given,
+ * then return the flags from the remote netdevice only.
+ * Otherwise return the flags from the tap netdevice.
+ */
+ remote = 0;
+ }
apply:
if (remote)
snprintf(ifr->ifr_name, IFNAMSIZ, "%s", pmd->remote_iface);
@@ -458,6 +466,10 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
else
ifr->ifr_flags &= ~req_flags;
break;
+ case SIOCGIFFLAGS:
+ if (remote && set)
+ remote = 0; /* don't loop */
+ break;
case SIOCGIFHWADDR:
/* Set remote MAC on the tap netdevice */
if (!remote && pmd->remote_if_index) {
@@ -674,9 +686,25 @@ tap_tx_queue_release(void *queue)
}
static int
-tap_link_update(struct rte_eth_dev *dev __rte_unused,
- int wait_to_complete __rte_unused)
+tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
{
+ struct rte_eth_link *dev_link = &dev->data->dev_link;
+ struct pmd_internals *pmd = dev->data->dev_private;
+ struct ifreq ifr = { .ifr_flags = 0 };
+
+ if (pmd->remote_if_index) {
+ tap_ioctl(pmd, SIOCGIFFLAGS, &ifr, 1);
+ if (!(ifr.ifr_flags & IFF_UP) ||
+ !(ifr.ifr_flags & IFF_RUNNING)) {
+ dev_link->link_status = ETH_LINK_DOWN;
+ return 0;
+ }
+ }
+ tap_ioctl(pmd, SIOCGIFFLAGS, &ifr, 0);
+ dev_link->link_status =
+ ((ifr.ifr_flags & IFF_UP) && (ifr.ifr_flags & IFF_RUNNING) ?
+ ETH_LINK_UP :
+ ETH_LINK_DOWN);
return 0;
}