[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BL2PR07MB2306088B2179138BB4557FE58D480@BL2PR07MB2306.namprd07.prod.outlook.com>
Date: Sun, 29 Jan 2017 17:30:51 +0000
From: "Mintz, Yuval" <Yuval.Mintz@...ium.com>
To: Richard Cochran <richardcochran@...il.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Kalluru, Sudarsana" <Sudarsana.Kalluru@...ium.com>
Subject: RE: [PATCH net-next v2 2/2] qede: Add driver support for PTP.
> > +static int qede_ptp_adjfreq(struct ptp_clock_info *info, s32 ppb) {
> > + struct qede_ptp *ptp = container_of(info, struct qede_ptp,
> clock_info);
> > + struct qede_dev *edev = ptp->edev;
> > + int rc;
> > +
> > + __qede_lock(edev);
> > + if (edev->state == QEDE_STATE_OPEN) {
> > + spin_lock_bh(&ptp->lock);
> > + rc = ptp->ops->adjfreq(edev->cdev, ppb);
>
> Why add this extra layer of indirection?
>
> You could put these this test into qed_ptp_hw_adjfreq() and register that
> function directly.
>
Which level of indirection? The usage of ptp->ops->() functions?
That's part of the driver structuring - qed is responsible for accessing HW
so it implements api functions for accessing PTP-related configuration,
while qede is responsible for the network interface and thus is the one to
register the clock and implements its API.
The operations ptp->ops->() originate from qed, so we can't refactor qede
state-logic there and use it directly.
Powered by blists - more mailing lists