SEO wise, is it okay to use an protocol free URL like this?
<link rel="canonical" href="//example.com" />
I redirect all users to HTTPS anyway.
With protocol free I mean not using either http:// or https:// but // instead.
href
attribute on a canonical link is like all href
attribute on <link>
: it supports URIs. And URIs can be full URIs or relative URIs.
Moreover The Canonical Link Relation spec confirms that.
Then: of course you can use a relative URL like a protocol free one.
I will recommend anyway to always use full URLs : scheme, host, path...
Why ? Because canonical URL is made to prevent from wrong URL to be used by robots.
Then using a relative URL might let some wrong URLs used by bots contrary to a full URL which you can be certain it is the right one.