diff mbox

[net,5/5] qede: Split PF/VF ndos.

Message ID BLUPR0701MB20042DD110A79E49C2BC0DD78DE40@BLUPR0701MB2004.namprd07.prod.outlook.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Mintz, Yuval May 18, 2017, 4:58 a.m. UTC
> > Looking at my alternatives for solving this, I can't see any 'good'
> > options - it seems mightily unorthodox to modify net_device_ops, I.e.,
> > add/remove an NDO function-pointer based on some device property, and
> > having multiple ops declared for the sake of a single feature seems
> > unscalable.
> 
> Multiple ops is the only thing that works right now.

What about something like - 

--

Other than making it a bit more difficult to use the generic XDP [since the VF would have the NDO],
I think it would behave as it should.
diff mbox

Patch

diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index 333876c..7450c8b 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -1028,6 +1028,13 @@  int qede_xdp(struct net_device *dev, struct netdev_xdp *xdp)
 {
        struct qede_dev *edev = netdev_priv(dev);

+       /* Not all VFs can support XDP; But we can't fail the query */
+       if ((<Actual condition to determine XDP support>) {
+               if (xdp->command == XDP_QUERY_PROG)
+                       return 0;
+               return -EOPNOTSUPP;
+       }
+
        switch (xdp->command) {
        case XDP_SETUP_PROG:
                return qede_xdp_set(edev, xdp->prog);